[Lldb-commits] [PATCH] D51175: Add support for descriptions with command completions.

2018-09-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

@jingham I'm confused, what are the requested changes? Because the behavior we 
seem to agree on is that we keep completions with the same value but different 
descriptions which is already the current implementation (see lines 138 and 148 
in CompletionRequestTest.cpp)




Comment at: source/Utility/CompletionRequest.cpp:79
+  // Add the completion if we haven't seen the same value before.
+  if (m_added_values.insert(r.GetUniqueKey()).second)
+m_results.push_back(r);

jingham wrote:
> JDevlieghere wrote:
> > Do you think there's any value in in checking the description? For example, 
> > if the description was empty for the existing value but a description is 
> > provided for the duplicate?
> This seems reasonable.  For instance, for process attach we might want to do 
> something like:
> 
> (lldb) process attach -n Foo
> Foo - pid 123
> Foo - pid 234
> FooBar - pid 345
> 
> But then the two Foo's would have the same unique key and you would only 
> print one.
Also, when providing for example completions for the expression command, we 
would have the same function name with different argument lists. E.g.
```
  foo( -- int foo(int, int)
  foo( -- int foo(double, double)
```


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51175



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D50809: Remove byte counting from SourceManager [NFC]

2018-09-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 165225.
teemperor added a comment.

- Fixed conflicts before merging.


https://reviews.llvm.org/D50809

Files:
  source/Core/SourceManager.cpp


Index: source/Core/SourceManager.cpp
===
--- source/Core/SourceManager.cpp
+++ source/Core/SourceManager.cpp
@@ -158,7 +158,9 @@
 const SymbolContextList *bp_locs) {
   if (count == 0)
 return 0;
-  size_t return_value = 0;
+
+  Stream::ByteDelta delta(*s);
+
   if (start_line == 0) {
 if (m_last_line != 0 && m_last_line != UINT32_MAX)
   start_line = m_last_line + m_last_count;
@@ -193,9 +195,8 @@
   ::snprintf(prefix, sizeof(prefix), "");
   }
 
-  return_value +=
-  s->Printf("%s%2.2s %-4u\t", prefix,
-line == curr_line ? current_line_cstr : "", line);
+  s->Printf("%s%2.2s %-4u\t", prefix,
+line == curr_line ? current_line_cstr : "", line);
 
   // So far we treated column 0 as a special 'no column value', but
   // DisplaySourceLines starts counting columns from 0 (and no column is
@@ -211,21 +212,20 @@
 // Display caret cursor.
 std::string src_line;
 m_last_file_sp->GetLine(line, src_line);
-return_value += s->Printf("\t");
+s->Printf("\t");
 // Insert a space for every non-tab character in the source line.
 for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i)
-  return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
+  s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
 // Now add the caret.
-return_value += s->Printf("^\n");
+s->Printf("^\n");
   }
   if (this_line_size == 0) {
 m_last_line = UINT32_MAX;
 break;
-  } else
-return_value += this_line_size;
+  }
 }
   }
-  return return_value;
+  return *delta;
 }
 
 size_t SourceManager::DisplaySourceLinesWithLineNumbers(


Index: source/Core/SourceManager.cpp
===
--- source/Core/SourceManager.cpp
+++ source/Core/SourceManager.cpp
@@ -158,7 +158,9 @@
 const SymbolContextList *bp_locs) {
   if (count == 0)
 return 0;
-  size_t return_value = 0;
+
+  Stream::ByteDelta delta(*s);
+
   if (start_line == 0) {
 if (m_last_line != 0 && m_last_line != UINT32_MAX)
   start_line = m_last_line + m_last_count;
@@ -193,9 +195,8 @@
   ::snprintf(prefix, sizeof(prefix), "");
   }
 
-  return_value +=
-  s->Printf("%s%2.2s %-4u\t", prefix,
-line == curr_line ? current_line_cstr : "", line);
+  s->Printf("%s%2.2s %-4u\t", prefix,
+line == curr_line ? current_line_cstr : "", line);
 
   // So far we treated column 0 as a special 'no column value', but
   // DisplaySourceLines starts counting columns from 0 (and no column is
@@ -211,21 +212,20 @@
 // Display caret cursor.
 std::string src_line;
 m_last_file_sp->GetLine(line, src_line);
-return_value += s->Printf("\t");
+s->Printf("\t");
 // Insert a space for every non-tab character in the source line.
 for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i)
-  return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
+  s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
 // Now add the caret.
-return_value += s->Printf("^\n");
+s->Printf("^\n");
   }
   if (this_line_size == 0) {
 m_last_line = UINT32_MAX;
 break;
-  } else
-return_value += this_line_size;
+  }
 }
   }
-  return return_value;
+  return *delta;
 }
 
 size_t SourceManager::DisplaySourceLinesWithLineNumbers(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r342121 - Remove byte counting from SourceManager [NFC]

2018-09-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Sep 13 02:19:40 2018
New Revision: 342121

URL: http://llvm.org/viewvc/llvm-project?rev=342121&view=rev
Log:
Remove byte counting from SourceManager [NFC]

Summary:
Similar to what we did in D50681, we now stop manually byte counting here
in the SourceManager.

Reviewers: #lldb, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: JDevlieghere, abidh, lldb-commits

Differential Revision: https://reviews.llvm.org/D50809

Modified:
lldb/trunk/source/Core/SourceManager.cpp

Modified: lldb/trunk/source/Core/SourceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=342121&r1=342120&r2=342121&view=diff
==
--- lldb/trunk/source/Core/SourceManager.cpp (original)
+++ lldb/trunk/source/Core/SourceManager.cpp Thu Sep 13 02:19:40 2018
@@ -158,7 +158,9 @@ size_t SourceManager::DisplaySourceLines
 const SymbolContextList *bp_locs) {
   if (count == 0)
 return 0;
-  size_t return_value = 0;
+
+  Stream::ByteDelta delta(*s);
+
   if (start_line == 0) {
 if (m_last_line != 0 && m_last_line != UINT32_MAX)
   start_line = m_last_line + m_last_count;
@@ -193,9 +195,8 @@ size_t SourceManager::DisplaySourceLines
   ::snprintf(prefix, sizeof(prefix), "");
   }
 
-  return_value +=
-  s->Printf("%s%2.2s %-4u\t", prefix,
-line == curr_line ? current_line_cstr : "", line);
+  s->Printf("%s%2.2s %-4u\t", prefix,
+line == curr_line ? current_line_cstr : "", line);
 
   // So far we treated column 0 as a special 'no column value', but
   // DisplaySourceLines starts counting columns from 0 (and no column is
@@ -211,21 +212,20 @@ size_t SourceManager::DisplaySourceLines
 // Display caret cursor.
 std::string src_line;
 m_last_file_sp->GetLine(line, src_line);
-return_value += s->Printf("\t");
+s->Printf("\t");
 // Insert a space for every non-tab character in the source line.
 for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i)
-  return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
+  s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
 // Now add the caret.
-return_value += s->Printf("^\n");
+s->Printf("^\n");
   }
   if (this_line_size == 0) {
 m_last_line = UINT32_MAX;
 break;
-  } else
-return_value += this_line_size;
+  }
 }
   }
-  return return_value;
+  return *delta;
 }
 
 size_t SourceManager::DisplaySourceLinesWithLineNumbers(


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D50809: Remove byte counting from SourceManager [NFC]

2018-09-13 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342121: Remove byte counting from SourceManager [NFC] 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D50809?vs=165225&id=165226#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50809

Files:
  lldb/trunk/source/Core/SourceManager.cpp


Index: lldb/trunk/source/Core/SourceManager.cpp
===
--- lldb/trunk/source/Core/SourceManager.cpp
+++ lldb/trunk/source/Core/SourceManager.cpp
@@ -158,7 +158,9 @@
 const SymbolContextList *bp_locs) {
   if (count == 0)
 return 0;
-  size_t return_value = 0;
+
+  Stream::ByteDelta delta(*s);
+
   if (start_line == 0) {
 if (m_last_line != 0 && m_last_line != UINT32_MAX)
   start_line = m_last_line + m_last_count;
@@ -193,9 +195,8 @@
   ::snprintf(prefix, sizeof(prefix), "");
   }
 
-  return_value +=
-  s->Printf("%s%2.2s %-4u\t", prefix,
-line == curr_line ? current_line_cstr : "", line);
+  s->Printf("%s%2.2s %-4u\t", prefix,
+line == curr_line ? current_line_cstr : "", line);
 
   // So far we treated column 0 as a special 'no column value', but
   // DisplaySourceLines starts counting columns from 0 (and no column is
@@ -211,21 +212,20 @@
 // Display caret cursor.
 std::string src_line;
 m_last_file_sp->GetLine(line, src_line);
-return_value += s->Printf("\t");
+s->Printf("\t");
 // Insert a space for every non-tab character in the source line.
 for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i)
-  return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
+  s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
 // Now add the caret.
-return_value += s->Printf("^\n");
+s->Printf("^\n");
   }
   if (this_line_size == 0) {
 m_last_line = UINT32_MAX;
 break;
-  } else
-return_value += this_line_size;
+  }
 }
   }
-  return return_value;
+  return *delta;
 }
 
 size_t SourceManager::DisplaySourceLinesWithLineNumbers(


Index: lldb/trunk/source/Core/SourceManager.cpp
===
--- lldb/trunk/source/Core/SourceManager.cpp
+++ lldb/trunk/source/Core/SourceManager.cpp
@@ -158,7 +158,9 @@
 const SymbolContextList *bp_locs) {
   if (count == 0)
 return 0;
-  size_t return_value = 0;
+
+  Stream::ByteDelta delta(*s);
+
   if (start_line == 0) {
 if (m_last_line != 0 && m_last_line != UINT32_MAX)
   start_line = m_last_line + m_last_count;
@@ -193,9 +195,8 @@
   ::snprintf(prefix, sizeof(prefix), "");
   }
 
-  return_value +=
-  s->Printf("%s%2.2s %-4u\t", prefix,
-line == curr_line ? current_line_cstr : "", line);
+  s->Printf("%s%2.2s %-4u\t", prefix,
+line == curr_line ? current_line_cstr : "", line);
 
   // So far we treated column 0 as a special 'no column value', but
   // DisplaySourceLines starts counting columns from 0 (and no column is
@@ -211,21 +212,20 @@
 // Display caret cursor.
 std::string src_line;
 m_last_file_sp->GetLine(line, src_line);
-return_value += s->Printf("\t");
+s->Printf("\t");
 // Insert a space for every non-tab character in the source line.
 for (size_t i = 0; i + 1 < column && i < src_line.length(); ++i)
-  return_value += s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
+  s->PutChar(src_line[i] == '\t' ? '\t' : ' ');
 // Now add the caret.
-return_value += s->Printf("^\n");
+s->Printf("^\n");
   }
   if (this_line_size == 0) {
 m_last_line = UINT32_MAX;
 break;
-  } else
-return_value += this_line_size;
+  }
 }
   }
-  return return_value;
+  return *delta;
 }
 
 size_t SourceManager::DisplaySourceLinesWithLineNumbers(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51730: [DWARFExpression] Read literars as unsigned values.

2018-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

ping

(I'd like to land this so I can un-revert the `DW_OP_constu` normalization for 
Swift)


https://reviews.llvm.org/D51730



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51967: [PDB] Use the raw PDB symbol interface more accurately

2018-09-13 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov updated this revision to Diff 165231.
aleksandr.urakov added a comment.

Apply recommended fixes.


https://reviews.llvm.org/D51967

Files:
  source/Plugins/SymbolFile/PDB/PDBASTParser.cpp


Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===
--- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -269,23 +269,49 @@
 GetClassOrFunctionParent(const llvm::pdb::PDBSymbol &symbol) {
   const IPDBSession &session = symbol.getSession();
   const IPDBRawSymbol &raw = symbol.getRawSymbol();
+  auto tag = symbol.getSymTag();
 
-  auto class_parent_id = raw.getClassParentId();
-  if (auto class_parent = session.getSymbolById(class_parent_id))
-return class_parent;
+  // For items that are nested inside of a class, return the class that it is
+  // nested inside of.
+  // Note that only certain items can be nested inside of classes.
+  switch (tag) {
+  case PDB_SymType::Function:
+  case PDB_SymType::Data:
+  case PDB_SymType::UDT:
+  case PDB_SymType::Enum:
+  case PDB_SymType::FunctionSig:
+  case PDB_SymType::Typedef:
+  case PDB_SymType::BaseClass:
+  case PDB_SymType::VTable: {
+auto class_parent_id = raw.getClassParentId();
+if (auto class_parent = session.getSymbolById(class_parent_id))
+  return class_parent;
+  }
+  default:
+break;
+  }
 
-  auto lexical_parent_id = raw.getLexicalParentId();
-  auto lexical_parent = session.getSymbolById(lexical_parent_id);
-  if (!lexical_parent)
-return nullptr;
+  // Otherwise, if it is nested inside of a function, return the function.
+  // Note that only certain items can be nested inside of functions.
+  switch (tag) {
+  case PDB_SymType::Block:
+  case PDB_SymType::Data: {
+auto lexical_parent_id = raw.getLexicalParentId();
+auto lexical_parent = session.getSymbolById(lexical_parent_id);
+if (!lexical_parent)
+  return nullptr;
 
-  auto lexical_parent_tag = lexical_parent->getSymTag();
-  if (lexical_parent_tag == PDB_SymType::Function)
-return lexical_parent;
-  if (lexical_parent_tag == PDB_SymType::Exe)
-return nullptr;
+auto lexical_parent_tag = lexical_parent->getSymTag();
+if (lexical_parent_tag == PDB_SymType::Function)
+  return lexical_parent;
+if (lexical_parent_tag == PDB_SymType::Exe)
+  return nullptr;
 
-  return GetClassOrFunctionParent(*lexical_parent);
+return GetClassOrFunctionParent(*lexical_parent);
+  }
+  default:
+return nullptr;
+  }
 }
 
 static clang::NamedDecl *


Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===
--- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -269,23 +269,49 @@
 GetClassOrFunctionParent(const llvm::pdb::PDBSymbol &symbol) {
   const IPDBSession &session = symbol.getSession();
   const IPDBRawSymbol &raw = symbol.getRawSymbol();
+  auto tag = symbol.getSymTag();
 
-  auto class_parent_id = raw.getClassParentId();
-  if (auto class_parent = session.getSymbolById(class_parent_id))
-return class_parent;
+  // For items that are nested inside of a class, return the class that it is
+  // nested inside of.
+  // Note that only certain items can be nested inside of classes.
+  switch (tag) {
+  case PDB_SymType::Function:
+  case PDB_SymType::Data:
+  case PDB_SymType::UDT:
+  case PDB_SymType::Enum:
+  case PDB_SymType::FunctionSig:
+  case PDB_SymType::Typedef:
+  case PDB_SymType::BaseClass:
+  case PDB_SymType::VTable: {
+auto class_parent_id = raw.getClassParentId();
+if (auto class_parent = session.getSymbolById(class_parent_id))
+  return class_parent;
+  }
+  default:
+break;
+  }
 
-  auto lexical_parent_id = raw.getLexicalParentId();
-  auto lexical_parent = session.getSymbolById(lexical_parent_id);
-  if (!lexical_parent)
-return nullptr;
+  // Otherwise, if it is nested inside of a function, return the function.
+  // Note that only certain items can be nested inside of functions.
+  switch (tag) {
+  case PDB_SymType::Block:
+  case PDB_SymType::Data: {
+auto lexical_parent_id = raw.getLexicalParentId();
+auto lexical_parent = session.getSymbolById(lexical_parent_id);
+if (!lexical_parent)
+  return nullptr;
 
-  auto lexical_parent_tag = lexical_parent->getSymTag();
-  if (lexical_parent_tag == PDB_SymType::Function)
-return lexical_parent;
-  if (lexical_parent_tag == PDB_SymType::Exe)
-return nullptr;
+auto lexical_parent_tag = lexical_parent->getSymTag();
+if (lexical_parent_tag == PDB_SymType::Function)
+  return lexical_parent;
+if (lexical_parent_tag == PDB_SymType::Exe)
+  return nullptr;
 
-  return GetClassOrFunctionParent(*lexical_parent);
+return GetClassOrFunctionParent(*lexical_parent);
+  }
+  default:
+return nullptr;
+  }
 }
 
 static clang::NamedDecl *
___

[Lldb-commits] [PATCH] D51935: [LLDB] - Improve reporting source lines and variables (improved DWARF5 support).

2018-09-13 Thread Paul Robinson via Phabricator via lldb-commits
probinson added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp:442
+ReadDescriptors(debug_line_data, offset_ptr);
+uint8_t dirCount = debug_line_data.GetU8(offset_ptr);
+for (int i = 0; i < dirCount; ++i) {

clayborg wrote:
> We might verify that this is indeed correct by looking at compiler sources. 
> Seems weird to limit dirs to 255
The directory count is a ULEB not a ubyte.


https://reviews.llvm.org/D51935



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51935: [LLDB] - Improve reporting source lines and variables (improved DWARF5 support).

2018-09-13 Thread George Rimar via Phabricator via lldb-commits
grimar added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp:442
+ReadDescriptors(debug_line_data, offset_ptr);
+uint8_t dirCount = debug_line_data.GetU8(offset_ptr);
+for (int i = 0; i < dirCount; ++i) {

probinson wrote:
> clayborg wrote:
> > We might verify that this is indeed correct by looking at compiler sources. 
> > Seems weird to limit dirs to 255
> The directory count is a ULEB not a ubyte.
Oops. My mistake here, my initial version which used uleb128 was correct, but I 
looked at the wrong place too in the dwarf5 spec after that.


https://reviews.llvm.org/D51935



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51967: [PDB] Use the raw PDB symbol interface more accurately

2018-09-13 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

In https://reviews.llvm.org/D51967#1232534, @zturner wrote:

> I've been experimenting with DIA locally and after some investigation I'm not 
> sure this is going to be reliable.  Let's say we have a class, we want the 
> decl context containing the class.  For example, on line 366.  So we call 
> `GetDeclContextContainingSymbol`.  Despite what the MSDN documentation 
> states, I'm pretty sure this is going to return a `PDBSymbolExe`.


But it returns the parent UDT symbol for me, when it is called for inner 
classes... I've added the next assert before return at the line 288:

  assert(tag != PDB_SymType::UDT);

and have run the AST test:

  llvm-lit.py -v ..\..\tools\lldb\lit\SymbolFile\PDB\ast-restore.test

and have retrieved the crash dump:

  Assertion failed: tag != PDB_SymType::UDT, file 
..\tools\lldb\source\Plugins\SymbolFile\PDB\PDBASTParser.cpp, line 288
  LLVMSymbolizer: error reading file: 'ucrtbased.pdb': no such file or directory
  LLVMSymbolizer: error reading file: 'wkernel32.pdb': no such file or directory
  LLVMSymbolizer: error reading file: 'wntdll.pdb': no such file or directory
  #0 0x0107f359 HandleAbort c:\work\llvm\lib\support\windows\signals.inc:409:0
  #1 0x77dbf82b (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0x9f82b)
  #2 0x77dc0d72 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa0d72)
  #3 0x77dc5124 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa5124)
  #4 0x77dc371a (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa371a)
  #5 0x77dc568a (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa568a)
  #6 0x01e1c575 GetClassOrFunctionParent 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:288:0
  #7 0x01e19c19 PDBASTParser::GetDeclContextContainingSymbol(class 
llvm::pdb::PDBSymbol const &) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:907:0
  #8 0x01e16ee4 PDBASTParser::CreateLLDBTypeFromPDBType(class 
llvm::pdb::PDBSymbol const &) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:373:0
  #9 0x01df71ae SymbolFilePDB::ResolveTypeUID(unsigned __int64) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\symbolfilepdb.cpp:563:0
  #10 0x01e1aa2d PDBASTParser::CompleteTypeFromUDT(class 
lldb_private::SymbolFile &,class lldb_private::CompilerType &,class 
llvm::pdb::PDBSymbolTypeUDT &) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:1088:0
  #11 0x01e19345 PDBASTParser::CompleteTypeFromPDB(class 
lldb_private::CompilerType &) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:768:0
  #12 0x01df73ab SymbolFilePDB::CompleteType(class lldb_private::CompilerType 
&) c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\symbolfilepdb.cpp:585:0
  #13 0x014fa4ea lldb_private::Type::ResolveClangType(enum 
lldb_private::Type::ResolveStateTag) 
c:\work\llvm\tools\lldb\source\symbol\type.cpp:552:0
  #14 0x014f9a08 lldb_private::Type::GetFullCompilerType(void) 
c:\work\llvm\tools\lldb\source\symbol\type.cpp:593:0
  #15 0x01e19566 PDBASTParser::GetDeclForSymbol(class llvm::pdb::PDBSymbol 
const &) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:798:0
  #16 0x01e1a2c3 PDBASTParser::ParseDeclsForDeclContext(class 
clang::DeclContext const *) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\pdbastparser.cpp:992:0
  #17 0x01df78d2 SymbolFilePDB::ParseDeclsForContext(class 
lldb_private::CompilerDeclContext) 
c:\work\llvm\tools\lldb\source\plugins\symbolfile\pdb\symbolfilepdb.cpp:665:0
  #18 0x00fde8d3 opts::symbols::dumpAST 
c:\work\llvm\tools\lldb\tools\lldb-test\lldb-test.cpp:537:0
  #19 0x00fdf6a5 opts::symbols::dumpSymbols 
c:\work\llvm\tools\lldb\tools\lldb-test\lldb-test.cpp:710:0
  #20 0x00fe0f9d main 
c:\work\llvm\tools\lldb\tools\lldb-test\lldb-test.cpp:952:0
  #21 0x078e219e invoke_main 
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
  #22 0x078e2037 _scrt_common_main_seh 
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
  #23 0x078e1ecd _scrt_common_main 
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:331:0
  #24 0x078e2218 mainCRTStartup 
f:\dd\vctools\crt\vcstartup\src\startup\exe_main.cpp:17:0
  #25 0x76558484 (C:\WINDOWS\System32\KERNEL32.DLL+0x18484)
  #26 0x770a2fea (C:\WINDOWS\SYSTEM32\ntdll.dll+0x62fea)
  #27 0x770a2fba (C:\WINDOWS\SYSTEM32\ntdll.dll+0x62fba)

During debugging I have figured out that it was `N0::N1::Class::Inner` 
resolving, and it had retrieved `N0::N1::Class` as a class parent here (which 
was completing at the time, and that completion had invoked 
`N0::N1::Class::Inner` resolving). So it seems that it works in this case.

> Worse, there is no guarantee that `getLexicalParent()` or `getClassParent()` 
> will return the same thing twice.  It all depends on how you obtained the 
> object in the first place.

Yes, I understand, that sometimes this function does not return a valid parent 
and returns nullptr. That's why I additionally check the symbol name at lines 
913-943. It may fire, for example, for class

[Lldb-commits] [PATCH] D51999: build: add libedit to include paths

2018-09-13 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

TBC, I pass libedit_INCLUDE_DIRS and libedit_LIBRARIES manually to CMake.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51999



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51730: [DWARFExpression] Read literars as unsigned values.

2018-09-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

The test really should encode actual DWARF that contains a DW_OP_litXXX opcode 
(using obj2yaml/yaml2obj or llvm-mc) as compiling the code for the test won't 
always produce the needed DWARF opcode,, but the change is simple and correct.


https://reviews.llvm.org/D51730



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51935: [LLDB] - Improve reporting source lines and variables (improved DWARF5 support).

2018-09-13 Thread George Rimar via Phabricator via lldb-commits
grimar updated this revision to Diff 165289.
grimar marked 2 inline comments as done.
grimar added a comment.

- Addressed comments.
- Changed test case to use yaml2obj.


https://reviews.llvm.org/D51935

Files:
  include/lldb/lldb-enumerations.h
  
packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py
  packages/Python/lldbsuite/test/functionalities/show_location/a.yaml
  source/Core/Section.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/ObjectFile.cpp

Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -350,6 +350,7 @@
   case eSectionTypeDWARFDebugFrame:
   case eSectionTypeDWARFDebugInfo:
   case eSectionTypeDWARFDebugLine:
+  case eSectionTypeDWARFDebugLineStr:
   case eSectionTypeDWARFDebugLoc:
   case eSectionTypeDWARFDebugMacInfo:
   case eSectionTypeDWARFDebugMacro:
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -240,6 +240,7 @@
   const lldb_private::DWARFDataExtractor &get_debug_frame_data();
   const lldb_private::DWARFDataExtractor &get_debug_info_data();
   const lldb_private::DWARFDataExtractor &get_debug_line_data();
+  const lldb_private::DWARFDataExtractor &get_debug_line_str_data();
   const lldb_private::DWARFDataExtractor &get_debug_macro_data();
   const lldb_private::DWARFDataExtractor &get_debug_loc_data();
   const lldb_private::DWARFDataExtractor &get_debug_ranges_data();
@@ -466,6 +467,7 @@
   DWARFDataSegment m_data_debug_frame;
   DWARFDataSegment m_data_debug_info;
   DWARFDataSegment m_data_debug_line;
+  DWARFDataSegment m_data_debug_line_str;
   DWARFDataSegment m_data_debug_macro;
   DWARFDataSegment m_data_debug_loc;
   DWARFDataSegment m_data_debug_ranges;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -494,7 +494,7 @@
 }
 
 bool SymbolFileDWARF::SupportedVersion(uint16_t version) {
-  return version == 2 || version == 3 || version == 4;
+  return version >= 2 && version <= 5;
 }
 
 uint32_t SymbolFileDWARF::CalculateAbilities() {
@@ -645,6 +645,10 @@
   return GetCachedSectionData(eSectionTypeDWARFDebugLine, m_data_debug_line);
 }
 
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_line_str_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugLineStr, m_data_debug_line_str);
+}
+
 const DWARFDataExtractor &SymbolFileDWARF::get_debug_macro_data() {
   return GetCachedSectionData(eSectionTypeDWARFDebugMacro, m_data_debug_macro);
 }
@@ -933,7 +937,7 @@
 support_files.Append(*sc.comp_unit);
 return DWARFDebugLine::ParseSupportFiles(
 sc.comp_unit->GetModule(), get_debug_line_data(), cu_comp_dir,
-stmt_list, support_files);
+stmt_list, support_files, dwarf_cu);
   }
 }
   }
@@ -1070,7 +1074,7 @@
   lldb::offset_t offset = cu_line_offset;
   DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset,
   ParseDWARFLineTableCallback,
-  &info);
+  &info, dwarf_cu);
   SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
   if (debug_map_symfile) {
 // We have an object file that has a line table with addresses that
Index: source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -225,7 +225,8 @@
 const CompilerDeclContext &parent_decl_ctx, uint32_t name_type_mask,
 std::vector &dies) {
 
-  m_fallback.GetFunctions(name, info, parent_decl_ctx, name_type_mask, dies);
+  std::vector v;
+  m_fallback.GetFunctions(name, info, parent_decl_ctx, name_type_mask, v);
 
   for (const DebugNames

[Lldb-commits] [PATCH] D32167: Add support for type units (.debug_types) to LLDB in a way that is compatible with DWARF 5

2018-09-13 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

BTW I would welcome some direction forward (for our internal yearly team 
meeting) how to unblock this patch (and assuming DWZ 
https://reviews.llvm.org/D40474). I can code some other of the solutions 
described above by Pavel Labath  or to 
performance-improve more https://reviews.llvm.org/D51578 (although then I can 
come with more DWARF performance improvements, at least re-introduce atomics to 
aid my mutexes from https://reviews.llvm.org/D40470).


https://reviews.llvm.org/D32167



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r342142 - [DWARFExpression] Read literars as unsigned values.

2018-09-13 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Sep 13 08:18:39 2018
New Revision: 342142

URL: http://llvm.org/viewvc/llvm-project?rev=342142&view=rev
Log:
[DWARFExpression] Read literars as unsigned values.

After landing r341457, we started seeing a failure on the swift-lldb
bots. The change was correct and pretty straightforward, a DW_OP_constu
was replaced with DW_OP_lit23, the value remaining identical.

  0x00f4: DW_TAG_variable
DW_AT_location(0x
  [0x00010a51,  0x00010d47): DW_OP_lit23, 
DW_OP_stack_value)
DW_AT_name("number")

However, this broke LLDB.

  (Int) number = 

The value was read correctly, but apparently the value's type was different.
When reading a constu it was reading a uint64 (m_type = e_ulonglong) while for
the literal, it got a signed int (m_type = e_sint). This change makes sure we
read the value as an unsigned.

Differential revision: https://reviews.llvm.org/D51730

Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c
Modified:
lldb/trunk/source/Expression/DWARFExpression.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile?rev=342142&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile 
Thu Sep 13 08:18:39 2018
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+CFLAGS_EXTRAS += -O1
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py?rev=342142&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
 Thu Sep 13 08:18:39 2018
@@ -0,0 +1,55 @@
+"""Show local variables and check that they can be inspected.
+
+This test was added after we made a change in clang to normalize
+DW_OP_constu(X < 32) to DW_OP_litX which broke the debugger because
+it didn't read the value as an unsigned.
+"""
+
+from __future__ import print_function
+
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LocalVariablesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break inside main().
+self.source = 'main.c'
+self.line = line_number(
+self.source, '// Set break point at this line.')
+
+def test_c_local_variables(self):
+"""Test local variable value."""
+self.build()
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.assertTrue(target, VALID_TARGET)
+
+# Break inside the main.
+lldbutil.run_break_set_by_file_and_line(
+self, self.source, self.line, num_expected_locations=1, 
loc_exact=True)
+
+# Now launch the process, and do not stop at entry point.
+process = target.LaunchSimple(
+None, None, self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+# The breakpoint should have a hit count of 1.
+self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+substrs=[' resolved, hit count = 1'])
+
+self.expect("frame variable i", VARIABLES_DISPLAYED_CORRECTLY,
+substrs=['(unsigned int) i = 10'])

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c?rev=342142&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c Thu 
Sep 13 08:18:39 2018
@@

[Lldb-commits] [PATCH] D51730: [DWARFExpression] Read literars as unsigned values.

2018-09-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342142: [DWARFExpression] Read literars as unsigned values. 
(authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51730?vs=164650&id=165301#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51730

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
  lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c
  lldb/trunk/source/Expression/DWARFExpression.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+C_SOURCES := main.c
+
+CFLAGS_EXTRAS += -O1
+
+include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/TestLocalVariables.py
@@ -0,0 +1,55 @@
+"""Show local variables and check that they can be inspected.
+
+This test was added after we made a change in clang to normalize
+DW_OP_constu(X < 32) to DW_OP_litX which broke the debugger because
+it didn't read the value as an unsigned.
+"""
+
+from __future__ import print_function
+
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class LocalVariablesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break inside main().
+self.source = 'main.c'
+self.line = line_number(
+self.source, '// Set break point at this line.')
+
+def test_c_local_variables(self):
+"""Test local variable value."""
+self.build()
+
+# Create a target by the debugger.
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.assertTrue(target, VALID_TARGET)
+
+# Break inside the main.
+lldbutil.run_break_set_by_file_and_line(
+self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+
+# Now launch the process, and do not stop at entry point.
+process = target.LaunchSimple(
+None, None, self.get_process_working_directory())
+self.assertTrue(process, PROCESS_IS_VALID)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+# The breakpoint should have a hit count of 1.
+self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+substrs=[' resolved, hit count = 1'])
+
+self.expect("frame variable i", VARIABLES_DISPLAYED_CORRECTLY,
+substrs=['(unsigned int) i = 10'])
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_variables/main.c
@@ -0,0 +1,19 @@
+#include 
+
+void bar(unsigned i)
+{
+  printf("%d\n", i);
+}
+
+void foo(unsigned j)
+{
+  unsigned i = j;
+  bar(i);
+  i = 10;
+  bar(i); // Set break point at this line.
+}
+
+int main(int argc, char** argv)
+{
+  foo(argc);
+}
Index: lldb/trunk/source/Expression/DWARFExpression.cpp
===
--- lldb/trunk/source/Expression/DWARFExpression.cpp
+++ lldb/trunk/source/Expression/DWARFExpression.cpp
@@ -2382,7 +2382,7 @@
 case DW_OP_lit29:
 case DW_OP_lit30:
 case DW_OP_lit31:
-  stack.push_back(Scalar(op - DW_OP_lit0));
+  stack.push_back(Scalar((uint64_t)(op - DW_OP_lit0)));
   break;
 
 //--
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51578: DWARFConcatenatingDataExtractor for D32167

2018-09-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Overall I am ok with minimal regression in speed if a few percent is all that 
it is costing us. I am generally ok with this patch. A few questions below.

Is there a reason we need DWARFConcatenatingDataExtractor? Can we just put all 
functionality into DWARFDataExtractor? Then the only place we need to modify if 
the place that parses the old CU and the type units from .debug_types.

Also is there a reason we need to pass the block data in code such as:

  const DWARFDataExtractor &debug_info_data = 
die.GetData().GetDWARFDataExtractor(form_value.BlockData());




Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51578



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51935: [LLDB] - Improve reporting source lines and variables (improved DWARF5 support).

2018-09-13 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Thanks for doing all requested changes! Looks great.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp:442
+ReadDescriptors(debug_line_data, offset_ptr);
+uint8_t dirCount = debug_line_data.GetU8(offset_ptr);
+for (int i = 0; i < dirCount; ++i) {

grimar wrote:
> probinson wrote:
> > clayborg wrote:
> > > We might verify that this is indeed correct by looking at compiler 
> > > sources. Seems weird to limit dirs to 255
> > The directory count is a ULEB not a ubyte.
> Oops. My mistake here, my initial version which used uleb128 was correct, but 
> I looked at the wrong place too in the dwarf5 spec after that.
I incorrectly skimmed the DWARF 5 spec and looked at 
"directory_entry_format_count (ubyte)" and missed that this was for the 
directory entry format count... directories_count is indeed ULEB128.


https://reviews.llvm.org/D51935



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51578: DWARFConcatenatingDataExtractor for D32167

2018-09-13 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In https://reviews.llvm.org/D51578#1233518, @clayborg wrote:

> Is there a reason we need DWARFConcatenatingDataExtractor? Can we just put 
> all functionality into DWARFDataExtractor?


OK, I will try it that way.

> Also is there a reason we need to pass the block data in code such as:
> 
>   const DWARFDataExtractor &debug_info_data = 
> die.GetData().GetDWARFDataExtractor(form_value.BlockData());

Otherwise I would have to refactor more functions (using that 
`debug_info_data`) to use `DWARFConcatenatingDataExtractor` instead of current 
`DWARFDataExtractor`. But given you propose to radically merge both together I 
agree that `GetDWARFDataExtractor` may no longer be needed.

I am sorry I will be now for 2 weeks away.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51578



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51967: [PDB] Use the raw PDB symbol interface more accurately

2018-09-13 Thread Zachary Turner via Phabricator via lldb-commits
zturner accepted this revision.
zturner added a comment.

Maybe I can improve this in the native implementation of our PDB reader which 
I'm currently working on, so that the results can be more consistent.


https://reviews.llvm.org/D51967



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51935: [LLDB] - Improved DWARF5 support.

2018-09-13 Thread George Rimar via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342153: [LLDB] - Improved DWARF5 support. (authored by 
grimar, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51935?vs=165289&id=165322#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51935

Files:
  lldb/trunk/include/lldb/lldb-enumerations.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/show_location/TestShowLocationDwarf5.py
  lldb/trunk/packages/Python/lldbsuite/test/functionalities/show_location/a.yaml
  lldb/trunk/source/Core/Section.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Symbol/ObjectFile.cpp

Index: lldb/trunk/source/Core/Section.cpp
===
--- lldb/trunk/source/Core/Section.cpp
+++ lldb/trunk/source/Core/Section.cpp
@@ -73,6 +73,8 @@
 return "dwarf-info";
   case eSectionTypeDWARFDebugLine:
 return "dwarf-line";
+  case eSectionTypeDWARFDebugLineStr:
+return "dwarf-line-str";
   case eSectionTypeDWARFDebugLoc:
 return "dwarf-loc";
   case eSectionTypeDWARFDebugMacInfo:
Index: lldb/trunk/source/Symbol/ObjectFile.cpp
===
--- lldb/trunk/source/Symbol/ObjectFile.cpp
+++ lldb/trunk/source/Symbol/ObjectFile.cpp
@@ -350,6 +350,7 @@
   case eSectionTypeDWARFDebugFrame:
   case eSectionTypeDWARFDebugInfo:
   case eSectionTypeDWARFDebugLine:
+  case eSectionTypeDWARFDebugLineStr:
   case eSectionTypeDWARFDebugLoc:
   case eSectionTypeDWARFDebugMacInfo:
   case eSectionTypeDWARFDebugMacro:
Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1788,6 +1788,7 @@
   static ConstString g_sect_name_dwarf_debug_frame(".debug_frame");
   static ConstString g_sect_name_dwarf_debug_info(".debug_info");
   static ConstString g_sect_name_dwarf_debug_line(".debug_line");
+  static ConstString g_sect_name_dwarf_debug_line_str(".debug_line_str");
   static ConstString g_sect_name_dwarf_debug_loc(".debug_loc");
   static ConstString g_sect_name_dwarf_debug_macinfo(".debug_macinfo");
   static ConstString g_sect_name_dwarf_debug_macro(".debug_macro");
@@ -1802,6 +1803,7 @@
   ".debug_abbrev.dwo");
   static ConstString g_sect_name_dwarf_debug_info_dwo(".debug_info.dwo");
   static ConstString g_sect_name_dwarf_debug_line_dwo(".debug_line.dwo");
+  static ConstString g_sect_name_dwarf_debug_line_str_dwo(".debug_line_str.dwo");
   static ConstString g_sect_name_dwarf_debug_macro_dwo(".debug_macro.dwo");
   static ConstString g_sect_name_dwarf_debug_loc_dwo(".debug_loc.dwo");
   static ConstString g_sect_name_dwarf_debug_str_dwo(".debug_str.dwo");
@@ -1861,6 +1863,8 @@
 sect_type = eSectionTypeDWARFDebugInfo;
   else if (name == g_sect_name_dwarf_debug_line)
 sect_type = eSectionTypeDWARFDebugLine;
+  else if (name == g_sect_name_dwarf_debug_line_str)
+sect_type = eSectionTypeDWARFDebugLineStr;
   else if (name == g_sect_name_dwarf_debug_loc)
 sect_type = eSectionTypeDWARFDebugLoc;
   else if (name == g_sect_name_dwarf_debug_macinfo)
@@ -1887,6 +1891,8 @@
 sect_type = eSectionTypeDWARFDebugInfo;
   else if (name == g_sect_name_dwarf_debug_line_dwo)
 sect_type = eSectionTypeDWARFDebugLine;
+  else if (name == g_sect_name_dwarf_debug_line_str_dwo)
+sect_type = eSectionTypeDWARFDebugLineStr;
   else if (name == g_sect_name_dwarf_debug_macro_dwo)
 sect_type = eSectionTypeDWARFDebugMacro;
   else if (name == g_sect_name_dwarf_debug_loc_dwo)
Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileM

[Lldb-commits] [PATCH] D51175: Add support for descriptions with command completions.

2018-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added inline comments.
This revision is now accepted and ready to land.



Comment at: source/Utility/CompletionRequest.cpp:79
+  // Add the completion if we haven't seen the same value before.
+  if (m_added_values.insert(r.GetUniqueKey()).second)
+m_results.push_back(r);

teemperor wrote:
> jingham wrote:
> > JDevlieghere wrote:
> > > Do you think there's any value in in checking the description? For 
> > > example, if the description was empty for the existing value but a 
> > > description is provided for the duplicate?
> > This seems reasonable.  For instance, for process attach we might want to 
> > do something like:
> > 
> > (lldb) process attach -n Foo
> > Foo - pid 123
> > Foo - pid 234
> > FooBar - pid 345
> > 
> > But then the two Foo's would have the same unique key and you would only 
> > print one.
> Also, when providing for example completions for the expression command, we 
> would have the same function name with different argument lists. E.g.
> ```
>   foo( -- int foo(int, int)
>   foo( -- int foo(double, double)
> ```
I just missed that after adding the number of the completion, you then append 
the description to make the key.  My bad.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51175



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51520: Add libc++ data formatter for std::variant

2018-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Yes, that's a good way to do it.


https://reviews.llvm.org/D51520



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51520: Add libc++ data formatter for std::variant

2018-09-13 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

Please clang-format your diffs.


https://reviews.llvm.org/D51520



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51520: Add libc++ data formatter for std::variant

2018-09-13 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

@vsk Interesting I ran git clang-format before generating the diff and it made 
changes, so I am not sure what happened


https://reviews.llvm.org/D51520



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D40474: DWZ 03/06: Main functionality

2018-09-13 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 165347.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D40474

Files:
  include/lldb/Utility/ConstString.h
  include/lldb/Utility/FileSpec.h
  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Utility/DataEncoder.cpp
  source/Utility/DataExtractor.cpp

Index: source/Utility/DataExtractor.cpp
===
--- source/Utility/DataExtractor.cpp
+++ source/Utility/DataExtractor.cpp
@@ -230,7 +230,8 @@
 if (data != nullptr) {
   const uint8_t *data_bytes = data->GetBytes();
   if (data_bytes != nullptr) {
-assert(m_start >= data_bytes);
+// For DWARFDataExtractor::OffsetData we need to return negative value.
+// assert(m_start >= data_bytes);
 return m_start - data_bytes;
   }
 }
Index: source/Utility/DataEncoder.cpp
===
--- source/Utility/DataEncoder.cpp
+++ source/Utility/DataEncoder.cpp
@@ -79,7 +79,8 @@
 if (data != nullptr) {
   const uint8_t *data_bytes = data->GetBytes();
   if (data_bytes != nullptr) {
-assert(m_start >= data_bytes);
+// For DWARFDataExtractor::OffsetData we need to return negative value.
+// assert(m_start >= data_bytes);
 return m_start - data_bytes;
   }
 }
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -18,10 +18,12 @@
 #include 
 #include 
 #include 
+#include 
 
 // Other libraries and framework includes
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Threading.h"
+#include "llvm/Support/RWMutex.h"
 
 #include "lldb/Utility/Flags.h"
 
@@ -319,6 +321,13 @@
 
   void Dump(lldb_private::Stream &s) override;
 
+  SymbolFileDWARF *GetDWZSymbolFile() const {
+if (!m_dwz_common_file)
+  return nullptr;
+return m_dwz_common_file->SymbolFile();
+  }
+  bool GetIsDWZ() const { return m_is_dwz; }
+
 protected:
   typedef llvm::DenseMap
   DIEToTypePtr;
@@ -453,6 +462,45 @@
 
   SymbolFileDWARFDwp *GetDwpSymbolFile();
 
+  void InitializeDWZ();
+
+  class DWZCommonFile {
+  public:
+// C++14: Use heterogenous lookup.
+DWZCommonFile(const lldb_private::FileSpec &filespec_ref);
+DWZCommonFile(std::unique_ptr symbol_file,
+lldb::ObjectFileSP obj_file, lldb::ModuleSP module);
+SymbolFileDWARF *SymbolFile() const { return m_symbol_file.get(); }
+
+bool operator==(const DWZCommonFile &rhs) const {
+  return m_filespec_ref == rhs.m_filespec_ref;
+}
+bool operator!=(const DWZCommonFile &rhs) const { return !(*this == rhs); }
+class Hasher {
+public:
+  size_t operator()(const DWZCommonFile &key) const {
+return lldb_private::FileSpec::Hasher()(key.m_filespec_ref);
+  }
+};
+
+size_t m_use_count = 0;
+
+  private:
+std::unique_ptr m_symbol_file;
+lldb::ObjectFileSP m_obj_file;
+lldb::ModuleSP m_module;
+const lldb_private::FileSpec &m_filespec_ref;
+
+DISALLOW_COPY_AND_ASSIGN(DWZCommonFile);
+  };
+  DWZCommonFile *m_dwz_common_file = nullptr;
+  void DWZCommonFileSet(DWZCommonFile *dwz_common_file);
+  void DWZCommonFileClear();
+  static std::unordered_set
+  m_filespec_to_dwzcommonfile;
+  static llvm::sys::RWMutex m_filespec_to_dwzcommonfile_mutex;
+  bool m_is_dwz = false;
+
   lldb::ModuleWP m_debug_map_module_wp;
   SymbolFileDWARFDebugMap *m_debug_map_symfile;
 
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -419,7 +419,9 @@
   m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate), m_ranges(),
   m_unique_ast_type_map() {}
 
-SymbolFileDWARF::~SymbolFileDWARF() {}
+SymbolFileDWARF::~SymbolFileDWARF() {
+  DWZCommonFileClear();
+}
 
 static const ConstString &GetDWARFMachOSegmentName() {
   static ConstString g_dwarf_section_name("__DWARF");
@@ -435,6 +437,7 @@
 }
 
 TypeSystem *SymbolFileDWARF::GetTypeSystemForLanguage(LanguageType language) {
+  lldbassert(!GetIsDWZ());
   SymbolFileD

[Lldb-commits] [lldb] r342167 - NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base class

2018-09-13 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Sep 13 13:17:40 2018
New Revision: 342167

URL: http://llvm.org/viewvc/llvm-project?rev=342167&view=rev
Log:
NativeProcessProtocol: Sink ReadMemoryWithoutTrap into base class

The two existing implementations have the function implemented
identically, and there's no reason to believe that this would be
different for other implementations.

Modified:
lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h

Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=342167&r1=342166&r2=342167&view=diff
==
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Thu Sep 13 
13:17:40 2018
@@ -84,8 +84,8 @@ public:
   virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size,
 size_t &bytes_read) = 0;
 
-  virtual Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf,
-   size_t size, size_t &bytes_read) = 0;
+  Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
+   size_t &bytes_read);
 
   virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
  size_t &bytes_written) = 0;

Modified: lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeProcessProtocol.cpp?rev=342167&r1=342166&r2=342167&view=diff
==
--- lldb/trunk/source/Host/common/NativeProcessProtocol.cpp (original)
+++ lldb/trunk/source/Host/common/NativeProcessProtocol.cpp Thu Sep 13 13:17:40 
2018
@@ -430,6 +430,15 @@ lldb::StateType NativeProcessProtocol::G
   return m_state;
 }
 
+Status NativeProcessProtocol::ReadMemoryWithoutTrap(lldb::addr_t addr,
+void *buf, size_t size,
+size_t &bytes_read) {
+  Status error = ReadMemory(addr, buf, size, bytes_read);
+  if (error.Fail())
+return error;
+  return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size);
+}
+
 void NativeProcessProtocol::SetState(lldb::StateType state,
  bool notify_delegates) {
   std::lock_guard guard(m_state_mutex);

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=342167&r1=342166&r2=342167&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Thu Sep 13 
13:17:40 2018
@@ -1629,15 +1629,6 @@ Status NativeProcessLinux::ReadMemory(ll
   return Status();
 }
 
-Status NativeProcessLinux::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf,
- size_t size,
- size_t &bytes_read) {
-  Status error = ReadMemory(addr, buf, size, bytes_read);
-  if (error.Fail())
-return error;
-  return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size);
-}
-
 Status NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf,
size_t size, size_t &bytes_written) {
   const unsigned char *src = static_cast(buf);

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h?rev=342167&r1=342166&r2=342167&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Thu Sep 13 
13:17:40 2018
@@ -71,9 +71,6 @@ public:
   Status ReadMemory(lldb::addr_t addr, void *buf, size_t size,
 size_t &bytes_read) override;
 
-  Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
-   size_t &bytes_read) override;
-
   Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
  size_t &bytes_written) override;
 

Modified: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
URL: 
http://llvm.

[Lldb-commits] [PATCH] D51175: Add support for descriptions with command completions.

2018-09-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 165379.
teemperor added a comment.

- Rebasing before merging.


https://reviews.llvm.org/D51175

Files:
  include/lldb/API/SBCommandInterpreter.h
  include/lldb/Core/IOHandler.h
  include/lldb/Expression/REPL.h
  include/lldb/Host/Editline.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/Interpreter/CommandObject.h
  include/lldb/Utility/CompletionRequest.h
  packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  packages/Python/lldbsuite/test/lldbtest.py
  scripts/interface/SBCommandInterpreter.i
  source/API/SBCommandInterpreter.cpp
  source/Commands/CommandObjectMultiword.cpp
  source/Core/IOHandler.cpp
  source/Expression/REPL.cpp
  source/Host/common/Editline.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Utility/CompletionRequest.cpp
  unittests/Utility/CompletionRequestTest.cpp

Index: unittests/Utility/CompletionRequestTest.cpp
===
--- unittests/Utility/CompletionRequestTest.cpp
+++ unittests/Utility/CompletionRequestTest.cpp
@@ -20,9 +20,11 @@
   const int match_start = 2345;
   const int match_max_return = 12345;
   StringList matches;
+  CompletionResult result;
 
   CompletionRequest request(command, cursor_pos, match_start, match_max_return,
-matches);
+result);
+  result.GetMatches(matches);
 
   EXPECT_STREQ(request.GetRawLine().str().c_str(), command.c_str());
   EXPECT_EQ(request.GetRawCursorPos(), cursor_pos);
@@ -41,63 +43,155 @@
   const unsigned cursor_pos = 3;
   StringList matches;
 
-  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+  CompletionResult result;
+  CompletionRequest request(command, cursor_pos, 0, 0, result);
+  result.GetMatches(matches);
 
   EXPECT_EQ(0U, request.GetNumberOfMatches());
 
   // Add foo twice
   request.AddCompletion("foo");
+  result.GetMatches(matches);
+
   EXPECT_EQ(1U, request.GetNumberOfMatches());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
 
   request.AddCompletion("foo");
+  result.GetMatches(matches);
+
   EXPECT_EQ(1U, request.GetNumberOfMatches());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
 
   // Add bar twice
   request.AddCompletion("bar");
+  result.GetMatches(matches);
+
   EXPECT_EQ(2U, request.GetNumberOfMatches());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
 
   request.AddCompletion("bar");
+  result.GetMatches(matches);
+
   EXPECT_EQ(2U, request.GetNumberOfMatches());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
 
   // Add foo again.
   request.AddCompletion("foo");
+  result.GetMatches(matches);
+
   EXPECT_EQ(2U, request.GetNumberOfMatches());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
 
   // Add something with an existing prefix
   request.AddCompletion("foobar");
+  result.GetMatches(matches);
+
   EXPECT_EQ(3U, request.GetNumberOfMatches());
   EXPECT_EQ(3U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
   EXPECT_STREQ("foobar", matches.GetStringAtIndex(2));
 }
 
+TEST(CompletionRequest, DuplicateFilteringWithComments) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches, descriptions;
+
+  CompletionResult result;
+  CompletionRequest request(command, cursor_pos, 0, 0, result);
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(0U, request.GetNumberOfMatches());
+
+  // Add foo twice with same comment
+  request.AddCompletion("foo", "comment");
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_EQ(1U, descriptions.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("comment", descriptions.GetStringAtIndex(0));
+
+  request.AddCompletion("foo", "comment");
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_EQ(1U, descriptions.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("comment", descriptions.GetStringAtIndex(0));
+
+  // Add bar twice with different comments
+  request.AddCompletion("bar", "comment");
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(2U, request.GetNumberOfMatches());
+  EXPECT_EQ(2U, matches.GetSize());
+  EXPECT_EQ(2U, descriptions.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STR

[Lldb-commits] [PATCH] D51175: Add support for descriptions with command completions.

2018-09-13 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342181: Add support for descriptions with command 
completions. (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51175?vs=165379&id=165380#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51175

Files:
  lldb/trunk/include/lldb/API/SBCommandInterpreter.h
  lldb/trunk/include/lldb/Core/IOHandler.h
  lldb/trunk/include/lldb/Expression/REPL.h
  lldb/trunk/include/lldb/Host/Editline.h
  lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
  lldb/trunk/include/lldb/Interpreter/CommandObject.h
  lldb/trunk/include/lldb/Utility/CompletionRequest.h
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
  lldb/trunk/scripts/interface/SBCommandInterpreter.i
  lldb/trunk/source/API/SBCommandInterpreter.cpp
  lldb/trunk/source/Commands/CommandObjectMultiword.cpp
  lldb/trunk/source/Core/IOHandler.cpp
  lldb/trunk/source/Expression/REPL.cpp
  lldb/trunk/source/Host/common/Editline.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  lldb/trunk/source/Utility/CompletionRequest.cpp
  lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Index: lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
===
--- lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
+++ lldb/trunk/unittests/Utility/CompletionRequestTest.cpp
@@ -20,9 +20,11 @@
   const int match_start = 2345;
   const int match_max_return = 12345;
   StringList matches;
+  CompletionResult result;
 
   CompletionRequest request(command, cursor_pos, match_start, match_max_return,
-matches);
+result);
+  result.GetMatches(matches);
 
   EXPECT_STREQ(request.GetRawLine().str().c_str(), command.c_str());
   EXPECT_EQ(request.GetRawCursorPos(), cursor_pos);
@@ -41,63 +43,155 @@
   const unsigned cursor_pos = 3;
   StringList matches;
 
-  CompletionRequest request(command, cursor_pos, 0, 0, matches);
+  CompletionResult result;
+  CompletionRequest request(command, cursor_pos, 0, 0, result);
+  result.GetMatches(matches);
 
   EXPECT_EQ(0U, request.GetNumberOfMatches());
 
   // Add foo twice
   request.AddCompletion("foo");
+  result.GetMatches(matches);
+
   EXPECT_EQ(1U, request.GetNumberOfMatches());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
 
   request.AddCompletion("foo");
+  result.GetMatches(matches);
+
   EXPECT_EQ(1U, request.GetNumberOfMatches());
   EXPECT_EQ(1U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
 
   // Add bar twice
   request.AddCompletion("bar");
+  result.GetMatches(matches);
+
   EXPECT_EQ(2U, request.GetNumberOfMatches());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
 
   request.AddCompletion("bar");
+  result.GetMatches(matches);
+
   EXPECT_EQ(2U, request.GetNumberOfMatches());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
 
   // Add foo again.
   request.AddCompletion("foo");
+  result.GetMatches(matches);
+
   EXPECT_EQ(2U, request.GetNumberOfMatches());
   EXPECT_EQ(2U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
 
   // Add something with an existing prefix
   request.AddCompletion("foobar");
+  result.GetMatches(matches);
+
   EXPECT_EQ(3U, request.GetNumberOfMatches());
   EXPECT_EQ(3U, matches.GetSize());
   EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
   EXPECT_STREQ("bar", matches.GetStringAtIndex(1));
   EXPECT_STREQ("foobar", matches.GetStringAtIndex(2));
 }
 
+TEST(CompletionRequest, DuplicateFilteringWithComments) {
+  std::string command = "a bad c";
+  const unsigned cursor_pos = 3;
+  StringList matches, descriptions;
+
+  CompletionResult result;
+  CompletionRequest request(command, cursor_pos, 0, 0, result);
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(0U, request.GetNumberOfMatches());
+
+  // Add foo twice with same comment
+  request.AddCompletion("foo", "comment");
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_EQ(1U, descriptions.GetSize());
+  EXPECT_STREQ("foo", matches.GetStringAtIndex(0));
+  EXPECT_STREQ("comment", descriptions.GetStringAtIndex(0));
+
+  request.AddCompletion("foo", "comment");
+  result.GetMatches(matches);
+  result.GetDescriptions(descriptions);
+
+  EXPECT_EQ(1U, request.GetNumberOfMatches());
+  EXPECT_EQ(1U, matches.GetSize());
+  EXPECT_EQ(1U, descriptions.GetSize());

[Lldb-commits] [lldb] r342181 - Add support for descriptions with command completions.

2018-09-13 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Sep 13 14:26:00 2018
New Revision: 342181

URL: http://llvm.org/viewvc/llvm-project?rev=342181&view=rev
Log:
Add support for descriptions with command completions.

Summary:
This patch adds a framework for adding descriptions to the command completions 
we provide.
It also adds descriptions for completed top-level commands so that we can test 
this code.

Completions are in general supposed to be displayed alongside the completion 
itself. The descriptions
can be used to provide additional information about the completion to the user. 
Examples for descriptions
are function signatures when completing function calls in the expression 
command or the binary name
when providing completion for a symbol.

There is still some boilerplate code from the old completion API left in LLDB 
(mostly because the respective
APIs are reused for non-completion related purposes, so the CompletionRequest 
doesn't make sense to be
used), so that's why I still had to change some function signatures. Also, as 
the old API only passes around a
list of matches, and the descriptions are for these functions just another 
list, I had to add some code that
essentially just ensures that both lists are always the same side (e.g. all the 
manual calls to
`descriptions->AddString(X)` below a `matches->AddString(Y)` call).

The initial command descriptions that come with this patch are just reusing the 
existing
short help that is already added in LLDB.

An example completion with descriptions looks like this:
```
(lldb) pl
Available completions:
platform -- Commands to manage and create platforms.
plugin   -- Commands for managing LLDB plugins.
```

Reviewers: #lldb, jingham

Reviewed By: #lldb, jingham

Subscribers: jingham, JDevlieghere, lldb-commits

Differential Revision: https://reviews.llvm.org/D51175

Modified:
lldb/trunk/include/lldb/API/SBCommandInterpreter.h
lldb/trunk/include/lldb/Core/IOHandler.h
lldb/trunk/include/lldb/Expression/REPL.h
lldb/trunk/include/lldb/Host/Editline.h
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/include/lldb/Utility/CompletionRequest.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/scripts/interface/SBCommandInterpreter.i
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Expression/REPL.cpp
lldb/trunk/source/Host/common/Editline.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Utility/CompletionRequest.cpp
lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=342181&r1=342180&r2=342181&view=diff
==
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Thu Sep 13 14:26:00 2018
@@ -162,6 +162,20 @@ public:
int match_start_point, int max_return_elements,
lldb::SBStringList &matches);
 
+  // Same as HandleCompletion, but also fills out `descriptions` with
+  // descriptions for each match.
+  int HandleCompletionWithDescriptions(
+  const char *current_line, const char *cursor, const char *last_char,
+  int match_start_point, int max_return_elements,
+  lldb::SBStringList &matches, lldb::SBStringList &descriptions);
+
+  int HandleCompletionWithDescriptions(const char *current_line,
+   uint32_t cursor_pos,
+   int match_start_point,
+   int max_return_elements,
+   lldb::SBStringList &matches,
+   lldb::SBStringList &descriptions);
+
   bool WasInterrupted() const;
 
   // Catch commands before they execute by registering a callback that will get

Modified: lldb/trunk/include/lldb/Core/IOHandler.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/IOHandler.h?rev=342181&r1=342180&r2=342181&view=diff
==
--- lldb/trunk/include/lldb/Core/IOHandler.h (original)
+++ lldb/trunk/include/lldb/Core/IOHandler.h Thu Sep 13 14:26:00 2018
@@ -205,7 +205,7 @@ public:
   virtual int IOHandlerComplete(IOHandler &io_handler, const char 
*current_line,
 const char *cursor, const char *last_char,
 int skip_first_n_matches, int max_matches,
-StringList &matches);
+ 

[Lldb-commits] [lldb] r342185 - Add a "scripted" breakpoint type to lldb.

2018-09-13 Thread Jim Ingham via lldb-commits
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=342185&r1=342184&r2=342185&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Thu Sep 13 14:35:32 
2018
@@ -330,6 +330,20 @@ def sort_stopped_threads(process,
 # Utility functions for setting breakpoints
 # ==
 
+def run_break_set_by_script(
+test,
+class_name,
+extra_options=None,
+num_expected_locations=1):
+"""Set a scripted breakpoint.  Check that it got the right number of 
locations."""
+test.assertTrue(class_name is not None, "Must pass in a class name.")
+command = "breakpoint set -P " + class_name
+if extra_options is not None:
+command += " " + extra_options
+
+break_results = run_break_set_command(test, command)
+check_breakpoint_result(test, break_results, 
num_locations=num_expected_locations)
+return get_bpno_from_match(break_results)
 
 def run_break_set_by_file_and_line(
 test,
@@ -737,7 +751,7 @@ def get_crashed_threads(test, process):
 
 # Helper functions for run_to_{source,name}_breakpoint:
 
-def run_to_breakpoint_make_target(test, exe_name, in_cwd):
+def run_to_breakpoint_make_target(test, exe_name = "a.out", in_cwd = True):
 if in_cwd:
 exe = test.getBuildArtifact(exe_name)
 
@@ -746,7 +760,7 @@ def run_to_breakpoint_make_target(test,
 test.assertTrue(target, "Target: %s is not valid."%(exe_name))
 return target
 
-def run_to_breakpoint_do_run(test, target, bkpt, launch_info):
+def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None):
 
 # Launch the process, and do not stop at the entry point.
 if not launch_info:

Modified: lldb/trunk/scripts/Python/python-swigsafecast.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-swigsafecast.swig?rev=342185&r1=342184&r2=342185&view=diff
==
--- lldb/trunk/scripts/Python/python-swigsafecast.swig (original)
+++ lldb/trunk/scripts/Python/python-swigsafecast.swig Thu Sep 13 14:35:32 2018
@@ -147,3 +147,17 @@ SBTypeToSWIGWrapper (lldb::SBTypeSummary
 {
 return SWIG_NewPointerObj((void *) summary_options_sb, 
SWIGTYPE_p_lldb__SBTypeSummaryOptions, 0);
 }
+
+template <>
+PyObject*
+SBTypeToSWIGWrapper (lldb::SBStructuredData* structured_data_sb)
+{
+return SWIG_NewPointerObj((void *) structured_data_sb, 
SWIGTYPE_p_lldb__SBStructuredData, 0);
+}
+
+template <>
+PyObject*
+SBTypeToSWIGWrapper (lldb::SBSymbolContext* sym_ctx_sb)
+{
+return SWIG_NewPointerObj((void *) sym_ctx_sb, 
SWIGTYPE_p_lldb__SBSymbolContext, 0);
+}

Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=342185&r1=342184&r2=342185&view=diff
==
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Thu Sep 13 14:35:32 2018
@@ -333,6 +333,101 @@ LLDBSWIGPythonCallThreadPlan
 return false;
 }
 
+SWIGEXPORT void *
+LLDBSwigPythonCreateScriptedBreakpointResolver
+(
+const char *python_class_name,
+const char *session_dictionary_name,
+lldb_private::StructuredDataImpl *args_impl,
+lldb::BreakpointSP &breakpoint_sp
+)
+{
+using namespace lldb_private;
+
+if (python_class_name == NULL || python_class_name[0] == '\0' || 
!session_dictionary_name)
+Py_RETURN_NONE;
+
+PyErr_Cleaner py_err_cleaner(true);
+
+auto dict = 
PythonModule::MainModule().ResolveName(session_dictionary_name);
+auto pfunc = 
PythonObject::ResolveNameWithDictionary(python_class_name, 
dict);
+
+if (!pfunc.IsAllocated())
+return nullptr;
+
+lldb::SBBreakpoint *bkpt_value = new lldb::SBBreakpoint(breakpoint_sp);
+
+PythonObject bkpt_arg(PyRefType::Owned, SBTypeToSWIGWrapper(bkpt_value));
+
+lldb::SBStructuredData *args_value = new lldb::SBStructuredData(args_impl);
+PythonObject args_arg(PyRefType::Owned, SBTypeToSWIGWrapper(args_value));
+
+PythonObject result = pfunc(bkpt_arg, args_arg, dict);
+// FIXME: At this point we should check that the class we found supports 
all the methods
+// that we need.
+
+if (result.IsAllocated())
+{
+// Check that __callback__ is defined:
+auto callback_func = 
result.ResolveName("__callback__");
+if (callback_func.IsAllocated())
+return result.release();
+else
+result.release();
+}
+Py_RETURN_NONE;
+}
+
+SWIGEXPORT unsigned int
+LLDBSwigPythonCallBreakpointResolver
+(
+void *implementor,
+const char *me

[Lldb-commits] [lldb] r342185 - Add a "scripted" breakpoint type to lldb.

2018-09-13 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Sep 13 14:35:32 2018
New Revision: 342185

URL: http://llvm.org/viewvc/llvm-project?rev=342185&view=rev
Log:
Add a "scripted" breakpoint type to lldb.

This change allows you to write a new breakpoint type where the
logic for setting breakpoints is determined by a Python callback
written using the SB API's.

Differential Revision: https://reviews.llvm.org/D51830

Modified:
lldb/trunk/include/lldb/API/SBAddress.h
lldb/trunk/include/lldb/API/SBBreakpoint.h
lldb/trunk/include/lldb/API/SBStructuredData.h
lldb/trunk/include/lldb/API/SBSymbolContext.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/lldb-defines.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
lldb/trunk/scripts/Python/python-swigsafecast.swig
lldb/trunk/scripts/Python/python-wrapper.swig
lldb/trunk/scripts/interface/SBBreakpoint.i
lldb/trunk/scripts/interface/SBStructuredData.i
lldb/trunk/scripts/interface/SBTarget.i
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBStructuredData.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Core/SearchFilter.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=342185&r1=342184&r2=342185&view=diff
==
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Thu Sep 13 14:35:32 2018
@@ -82,6 +82,7 @@ public:
 
 protected:
   friend class SBBlock;
+  friend class SBBreakpoint;
   friend class SBBreakpointLocation;
   friend class SBFrame;
   friend class SBFunction;

Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=342185&r1=342184&r2=342185&view=diff
==
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Thu Sep 13 14:35:32 2018
@@ -23,6 +23,8 @@ public:
 
   SBBreakpoint(const lldb::SBBreakpoint &rhs);
 
+  SBBreakpoint(const lldb::BreakpointSP &bp_sp);
+
   ~SBBreakpoint();
 
   const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
@@ -127,14 +129,16 @@ public:
   static uint32_t
   GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
 
+  // Can only be called from a ScriptedBreakpointResolver...
+  SBError
+  AddLocation(SBAddress &address);
+  
 private:
   friend class SBBreakpointList;
   friend class SBBreakpointLocation;
   friend class SBBreakpointName;
   friend class SBTarget;
 
-  SBBreakpoint(const lldb::BreakpointSP &bp_sp);
-
   lldb::BreakpointSP GetSP() const;
 
   lldb::BreakpointWP m_opaque_wp;

Modified: lldb/trunk/include/lldb/API/SBStructuredData.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStructuredData.h?rev=342185&r1=342184&r2=342185&view=diff
==
--- lldb/trunk/include/lldb/API/SBStructuredData.h (original)
+++ lldb/trunk/include/lldb/API/SBStructuredData.h Thu Sep 13 14:35:32 2018
@@ -22,6 +22,8 @@ public:
   SBStructuredData(const lldb::SBStructuredData &rhs);
 
   SBStructuredData(const lldb::EventSP &event_sp);
+  
+  SBStructuredData(lldb_private::StructuredDataImpl *impl);
 
   ~SBStructuredData();
 
@@ -41,7 +43,7 @@ public:
   /// Return the type of data in this data structure
   //--
   lldb::StructuredDataType GetType() const;
-
+  
   //--
   /// Return the size (i.e. number of elements) in this data structure
   /// if it is an array or dictionary type. For other types, 0 will be
@@ -50,6 +52,12 @@ public:
   size_t GetSize() const;
 
   //--
+  /// Fill keys with the keys in this object and return true if this data
+  /// structure is a dictionary.  Returns false otherwise.
+  //--
+   bool GetKeys(lldb::SBStringList &keys) const;
+  
+  //--
   /// Return th

[Lldb-commits] [PATCH] D51830: Add a way to make scripted breakpoints

2018-09-13 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342185: Add a "scripted" breakpoint type to lldb. 
(authored by jingham, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51830?vs=165184&id=165385#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D51830

Files:
  lldb/trunk/include/lldb/API/SBAddress.h
  lldb/trunk/include/lldb/API/SBBreakpoint.h
  lldb/trunk/include/lldb/API/SBStructuredData.h
  lldb/trunk/include/lldb/API/SBSymbolContext.h
  lldb/trunk/include/lldb/API/SBTarget.h
  lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
  lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/trunk/include/lldb/Target/Target.h
  lldb/trunk/include/lldb/lldb-defines.h
  lldb/trunk/include/lldb/lldb-enumerations.h
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
  lldb/trunk/scripts/Python/python-swigsafecast.swig
  lldb/trunk/scripts/Python/python-wrapper.swig
  lldb/trunk/scripts/interface/SBBreakpoint.i
  lldb/trunk/scripts/interface/SBStructuredData.i
  lldb/trunk/scripts/interface/SBTarget.i
  lldb/trunk/source/API/SBBreakpoint.cpp
  lldb/trunk/source/API/SBStructuredData.cpp
  lldb/trunk/source/API/SBTarget.cpp
  lldb/trunk/source/API/SystemInitializerFull.cpp
  lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
  lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
  lldb/trunk/source/Core/SearchFilter.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
  lldb/trunk/source/Target/Target.cpp



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D51830: Add a way to make scripted breakpoints

2018-09-13 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB342185: Add a "scripted" breakpoint type to 
lldb. (authored by jingham, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51830?vs=165184&id=165386#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D51830

Files:
  include/lldb/API/SBAddress.h
  include/lldb/API/SBBreakpoint.h
  include/lldb/API/SBStructuredData.h
  include/lldb/API/SBSymbolContext.h
  include/lldb/API/SBTarget.h
  include/lldb/Breakpoint/BreakpointResolver.h
  include/lldb/Interpreter/ScriptInterpreter.h
  include/lldb/Target/Target.h
  include/lldb/lldb-defines.h
  include/lldb/lldb-enumerations.h
  lldb.xcodeproj/project.pbxproj
  packages/Python/lldbsuite/test/lldbutil.py
  scripts/Python/python-swigsafecast.swig
  scripts/Python/python-wrapper.swig
  scripts/interface/SBBreakpoint.i
  scripts/interface/SBStructuredData.i
  scripts/interface/SBTarget.i
  source/API/SBBreakpoint.cpp
  source/API/SBStructuredData.cpp
  source/API/SBTarget.cpp
  source/API/SystemInitializerFull.cpp
  source/Breakpoint/BreakpointResolver.cpp
  source/Commands/CommandObjectBreakpoint.cpp
  source/Core/SearchFilter.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
  source/Target/Target.cpp



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r342185 - Add a "scripted" breakpoint type to lldb.

2018-09-13 Thread Davide Italiano via lldb-commits
This last commit broke the build:


[56/997] : && 
/Users/buildslave/jenkins/workspace/lldb-cmake/host-compiler/bin/clang++
 -fPIC -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -fmodules
-fmodules-cache-path=/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/module.cache
-fcxx-modules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings
-Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
-fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3
-Wl,-search_paths_first -Wl,-headerpad_max_install_names
-Wl,-dead_strip
tools/clang/tools/clang-format/CMakeFiles/clang-format.dir/ClangFormat.cpp.o
 -o bin/clang-format  -Wl,-rpath,@loader_path/../lib
lib/libLLVMSupport.a lib/libclangBasic.a lib/libclangFormat.a
lib/libclangRewrite.a lib/libclangToolingCore.a
lib/libclangToolingInclusions.a lib/libclangToolingCore.a
lib/libclangRewrite.a lib/libclangAST.a lib/libclangLex.a
lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMMC.a
lib/libLLVMBinaryFormat.a lib/libLLVMDebugInfoCodeView.a
lib/libLLVMDebugInfoMSF.a lib/libLLVMSupport.a -lz -lcurses -lm
lib/libLLVMDemangle.a && :

[57/997] 
/Users/buildslave/jenkins/workspace/lldb-cmake/host-compiler/bin/clang++
 -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLIBXML2_DEFINED
-DLLDB_CONFIGURATION_RELEASE -DLLDB_USE_OS_LOG -D_DEBUG
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Itools/lldb/source/Breakpoint
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/Breakpoint
-Itools/lldb/include
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/include
-I/usr/include/libxml2 -Iinclude
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/include
-I/usr/include/python2.7
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/clang/include
-Itools/lldb/../clang/include
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/.
-fPIC -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -fmodules
-fmodules-cache-path=/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/module.cache
-fcxx-modules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings
-Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing
-Wno-deprecated-register -Wno-vla-extension -O3-UNDEBUG
-fno-exceptions -fno-rtti -MD -MT
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o
-MF 
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o.d
-o 
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o
-c 
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/Breakpoint/BreakpointResolver.cpp

FAILED: 
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o

/Users/buildslave/jenkins/workspace/lldb-cmake/host-compiler/bin/clang++
 -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLIBXML2_DEFINED
-DLLDB_CONFIGURATION_RELEASE -DLLDB_USE_OS_LOG -D_DEBUG
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Itools/lldb/source/Breakpoint
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/Breakpoint
-Itools/lldb/include
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/include
-I/usr/include/libxml2 -Iinclude
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/include
-I/usr/include/python2.7
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/clang/include
-Itools/lldb/../clang/include
-I/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/.
-fPIC -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -fmodules
-fmodules-cache-path=/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/module.cache
-fcxx-modules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings
-Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
-Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing
-Wno-deprecated-register -Wno-vla-extension -O3-UNDEBUG
-fno-exceptions -fno-rtti -MD -MT
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o
-MF 
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o.d
-o 
tools/lldb/source/Breakpoint/CMakeFiles/lldbBreakpoint.dir/BreakpointResolver.cpp.o
-c 
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/Breakpoint/BreakpointResolver.cpp

/Users/buildslave/jenkins/workspace/lldb-cmake/llvm/tools/lldb/source/Breakpoint/BreakpointResolver.cpp:24:10

[Lldb-commits] [lldb] r342188 - Remember to sort the Xcode project file. NFC.

2018-09-13 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Sep 13 14:55:00 2018
New Revision: 342188

URL: http://llvm.org/viewvc/llvm-project?rev=342188&view=rev
Log:
Remember to sort the Xcode project file.  NFC.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r342190 - svn add the new files...

2018-09-13 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Sep 13 14:59:16 2018
New Revision: 342190

URL: http://llvm.org/viewvc/llvm-project?rev=342190&view=rev
Log:
svn add the new files...

I started from a clean slate to do the checkin, but forgot to svn add the new 
files.
Do that now.

Also add the one new source file to CMakeLists.txt


Added:
lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c

lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py
lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp
Modified:
lldb/trunk/source/Breakpoint/CMakeLists.txt

Added: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h?rev=342190&view=auto
==
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h (added)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h Thu Sep 13 
14:59:16 2018
@@ -0,0 +1,85 @@
+//===-- BreakpointResolverScripted.h -*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_BreakpointResolverScripted_h_
+#define liblldb_BreakpointResolverScripted_h_
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+#include "lldb/lldb-forward.h"
+#include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Core/ModuleSpec.h"
+
+
+namespace lldb_private {
+
+//--
+/// @class BreakpointResolverScripted BreakpointResolverScripted.h
+/// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints
+/// on a given Address.  This breakpoint only takes once, and then it won't
+/// attempt to reset itself.
+//--
+
+class BreakpointResolverScripted : public BreakpointResolver {
+public:
+  BreakpointResolverScripted(Breakpoint *bkpt,
+ const llvm::StringRef class_name,
+ lldb::SearchDepth depth,
+ StructuredDataImpl *args_data,
+ ScriptInterpreter &script_interp);
+
+  ~BreakpointResolverScripted() override;
+
+  static BreakpointResolver *
+  CreateFromStructuredData(Breakpoint *bkpt,
+   const StructuredData::Dictionary &options_dict,
+   Status &error);
+
+  StructuredData::ObjectSP SerializeToStructuredData() override;
+
+  Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
+  SymbolContext &context, Address 
*addr,
+  bool containing) override;
+
+  lldb::SearchDepth GetDepth() override;
+
+  void GetDescription(Stream *s) override;
+
+  void Dump(Stream *s) const override;
+
+  /// Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const BreakpointResolverScripted *) { return 
true; }
+  static inline bool classof(const BreakpointResolver *V) {
+return V->getResolverID() == BreakpointResolver::PythonResolver;
+  }
+
+  lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) 
override;
+
+protected:
+  void NotifyBreakpointSet() override;
+private:
+  void CreateImplementationIfNeeded();
+  ScriptInterpreter *GetScriptInterpreter();
+  
+  std::string m_class_name;
+  lldb::SearchDepth m_depth;
+  StructuredDataImpl *m_args_ptr; // We own this, but the implementation
+  // has to manage the UP (since that is
+  // how it gets stored in the
+  // SBStructuredData).
+  StructuredData::GenericSP m_implementation_sp;
+
+  DISALLOW_COPY_AND_ASSIGN(BreakpointResolverScripted);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_BreakpointResolverScripted_h_

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile?rev=342190&view=auto
==
--- 
lldb/

Re: [Lldb-commits] [lldb] r342190 - svn add the new files...

2018-09-13 Thread Davide Italiano via lldb-commits
Thank you!
On Thu, Sep 13, 2018 at 3:00 PM Jim Ingham via lldb-commits
 wrote:
>
> Author: jingham
> Date: Thu Sep 13 14:59:16 2018
> New Revision: 342190
>
> URL: http://llvm.org/viewvc/llvm-project?rev=342190&view=rev
> Log:
> svn add the new files...
>
> I started from a clean slate to do the checkin, but forgot to svn add the new 
> files.
> Do that now.
>
> Also add the one new source file to CMakeLists.txt
>
>
> Added:
> lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/Makefile
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/main.c
> 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/scripted_bkpt/resolver.py
> lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp
> Modified:
> lldb/trunk/source/Breakpoint/CMakeLists.txt
>
> Added: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h?rev=342190&view=auto
> ==
> --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h (added)
> +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverScripted.h Thu Sep 
> 13 14:59:16 2018
> @@ -0,0 +1,85 @@
> +//===-- BreakpointResolverScripted.h -*- C++ 
> -*-===//
> +//
> +// The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
> +//===--===//
> +
> +#ifndef liblldb_BreakpointResolverScripted_h_
> +#define liblldb_BreakpointResolverScripted_h_
> +
> +// C Includes
> +// C++ Includes
> +// Other libraries and framework includes
> +// Project includes
> +#include "lldb/lldb-forward.h"
> +#include "lldb/Breakpoint/BreakpointResolver.h"
> +#include "lldb/Core/ModuleSpec.h"
> +
> +
> +namespace lldb_private {
> +
> +//--
> +/// @class BreakpointResolverScripted BreakpointResolverScripted.h
> +/// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets 
> breakpoints
> +/// on a given Address.  This breakpoint only takes once, and then it won't
> +/// attempt to reset itself.
> +//--
> +
> +class BreakpointResolverScripted : public BreakpointResolver {
> +public:
> +  BreakpointResolverScripted(Breakpoint *bkpt,
> + const llvm::StringRef class_name,
> + lldb::SearchDepth depth,
> + StructuredDataImpl *args_data,
> + ScriptInterpreter &script_interp);
> +
> +  ~BreakpointResolverScripted() override;
> +
> +  static BreakpointResolver *
> +  CreateFromStructuredData(Breakpoint *bkpt,
> +   const StructuredData::Dictionary &options_dict,
> +   Status &error);
> +
> +  StructuredData::ObjectSP SerializeToStructuredData() override;
> +
> +  Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
> +  SymbolContext &context, Address 
> *addr,
> +  bool containing) override;
> +
> +  lldb::SearchDepth GetDepth() override;
> +
> +  void GetDescription(Stream *s) override;
> +
> +  void Dump(Stream *s) const override;
> +
> +  /// Methods for support type inquiry through isa, cast, and dyn_cast:
> +  static inline bool classof(const BreakpointResolverScripted *) { return 
> true; }
> +  static inline bool classof(const BreakpointResolver *V) {
> +return V->getResolverID() == BreakpointResolver::PythonResolver;
> +  }
> +
> +  lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) 
> override;
> +
> +protected:
> +  void NotifyBreakpointSet() override;
> +private:
> +  void CreateImplementationIfNeeded();
> +  ScriptInterpreter *GetScriptInterpreter();
> +
> +  std::string m_class_name;
> +  lldb::SearchDepth m_depth;
> +  StructuredDataImpl *m_args_ptr; // We own this, but the implementation
> +  // has to manage the UP (since that is
> +  // how it gets stored in the
> +  // SBStructuredData).
> +  StructuredData::GenericSP m_implementation_sp;
> +
> +  DISALLOW_COPY_AND_ASSIGN(BreakpointResolverScripted);
> +};
> +
> +} // namespace lldb_private
> +
> +#endif // liblldb_BreakpointResolverScripted_h_
>
> Added: 
>

[Lldb-commits] [PATCH] D51387: Allow Template argument accessors to automatically unwrap parameter packs

2018-09-13 Thread Frederic Riss via Phabricator via lldb-commits
friss added a comment.

@jingham ping


https://reviews.llvm.org/D51387



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D52065: WWW docs for scripted breakpoint resolvers

2018-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
jingham added a reviewer: clayborg.
Herald added subscribers: lldb-commits, abidh.

These are the promised docs for https://reviews.llvm.org/D51830.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52065

Files:
  www/python-reference.html

Index: www/python-reference.html
===
--- www/python-reference.html
+++ www/python-reference.html
@@ -316,6 +316,167 @@
 
 
   	
+  	
+		
+			Using the Python API's to create custom breakpoints
+			
+
+Another use of the Python API's in lldb is to create a custom breakpoint resolver.  This 
+  allows you to implement your own logic to search the space of the code in a given Target
+  and set breakpoint locations wherever you think it appropriate.  To understand how this works
+  you need to know a little about how lldb views breakpoints.  
+
+
+  In lldb, a breakpoint is composed of two parts, the Searcher, and the Resolver:
+
+
+  The Searcher's job is to traverse in a structured way the code in the current target.  It 
+  proceeds from the Target, to search all the Modules in the Target, in each Module it can recurse
+  into the Compile Units in that module, and within each Compile Unit it can recurse over the Functions
+  it contains.
+
+
+  The Searcher can be provided with a SearchFilter that it will use to restrict this search.  For instance, if the
+  SearchFilter specifies a list of good Modules, the Searcher will not recurse into Modules that aren't on the list.
+
+
+  The Searcher will also visit any new modules as they are added to the target.  This happens, for instance, when
+  a new shared library gets added to the target in the course of running, or on rerunning if any of the currently
+  loaded modules have been changed.  Note, in the latter case, all the locations set in the old module will get 
+  deleted and you will be asked to recreate them in the new version of the module when your callback gets called
+  with that module.  For this reason, you shouldn't
+  try to manage the locations you add to the breakpoint yourself.  Note that the Breakpoint takes care of 
+  deduplicating equal addresses in AddLocation, so you shouldn't need to worry about that anyway.
+
+
+  The Resolver has two functions.  The most important one is the callback it provides.  This will get called at the appropriate time 
+  in the course of the search.  The callback is where the job of adding locations to the breakpoint gets done.
+  The other function is specifying to the Searcher at what depth in the above described recursion it wants to be
+  called.  Setting a search depth also provides a stop for the recursion.  For instance, if you request a Module depth
+  search, then the callback will be called for each Module as it gets added to the Target, but the searcher will not recurse into the
+  Compile Units in the module.
+
+
+  One other slight sublety is that the depth at which you get called back is not necessarily the depth at which the
+  the SearchFilter is specified.  For instance, if you are doing symbol searches, it is convenient to use the Module
+  depth for the search, since symbols are stored in the module.  
+  But the SearchFilter might specify some subset of CompileUnits, so not all the symbols you might find in each module
+  will pass the search.  However, you don't need to 
+  handle this yourself.  SBBreakpoint::AddLocation will only add locations that pass the Search Filter.
+
+
+  At present, when defining a new Breakpoint type, you can only provide a custom Resolver.  Although you can't provide a custom
+  SearchFilter, the API's that allow the definition of new scripted breakpoint types do allow you to create Search Filters
+  specified by a list of Modules, CompileUnits, or both.
+
+
+  The custom Resolver is provided as a Python class with the following methods:
+
+
+
+
+Name
+Arguments
+Description
+
+
+
+
+
+__init__
+   

[Lldb-commits] [PATCH] D51387: Allow Template argument accessors to automatically unwrap parameter packs

2018-09-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham requested changes to this revision.
jingham added a comment.
This revision now requires changes to proceed.

I'm a little worried that we have asserts with no backstops here.  We ship in 
general with asserts off, so if some type is not copasetic we will probably 
crash shortly afterwards (in one case we assert num_args but then do an array 
access of num_args - 1)...

Seems like in the places where you've added asserts, we could return 0 (no 
template arguments) and though we wouldn't print the type correctly lldb 
wouldn't crash.  We should always assume that debug info might a little crappy 
and not crash.  Maybe these Decl's have been vetted earlier?  If that's the 
case I withdraw the objection.




Comment at: source/Symbol/ClangASTContext.cpp:7568-7570
+  assert(
+  num_args &&
+  "We shouldn't have a template specialization without any args");

IIUC, we would get into this state because debug information is messed up.  
lldb should never crash because of mal-formed debug information.  It's fine to 
assert here so that if this happens say in a new compiler we can catch it in 
the test suite.  But you should also return 0, since that's a straightforward 
workaround for bad debug information.


https://reviews.llvm.org/D51387



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits