[Lldb-commits] [PATCH] D73191: Ignore methods in full-name function lookup (with accelerators)

2020-01-27 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin marked an inline comment as done.
jarin added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp:45
   if (name_type_mask & eFunctionNameTypeFull) {
-dies.push_back(die);
-return;
+if (!die.IsMethod() || die.GetMangledName(false) == name) {
+  dies.push_back(die);

jarin wrote:
> labath wrote:
> > I don't believe the `IsMethod` check is really needed here -- the mangled 
> > name check should handle everything.
> > 
> > In fact, looking at the implementation of 
> > `DWARFDebugInfoEntry::GetMangledName`, I don't think you even need the 
> > extra `substitute_name_allowed=false` part. The default value should do 
> > exactly what we need. If the DIE has a linkage (mangled) name it will 
> > return it and we will use that for comparison. For an `extern "C"` function 
> > it will return the regular name, and we will compare that instead (this 
> > check is somewhat redundant because if the name doesn't match, the function 
> > should not be in the index in the first place, but I don't think it hurts 
> > to check either).
> > 
> > Am I missing something?
> I want to avoid returning methods to [[ 
> https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1258
>  | ClangExpressionDeclMap::LookupFunction ]], so that 
> ClangExpressionDeclMap::LookupFunction does not do the expensive [[ 
> https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1298
>  | DeclContext parsing ]] just to find out the function [[ 
> https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1304
>  | is a method ]] and must be thrown away.
> 
> The motivation is pretty much the same as for  
> https://reviews.llvm.org/D70846.
> 
> Does it make sense?
I think I see what you are saying - in the test case below, FULL should be 
consistent with FULL-INDEXED. Let me remove the IsMethod check and merge the 
FULL and FULL-INDEXED test cases below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D73191: Only match mangled name in full-name function lookup (with accelerators)

2020-01-27 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin updated this revision to Diff 240480.
jarin retitled this revision from "Ignore methods in full-name function lookup 
(with accelerators)" to "Only match mangled name in full-name function lookup 
(with accelerators)".
jarin edited the summary of this revision.
jarin added a comment.

Only matching the mangled name now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp


Index: lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
===
--- lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
+++ lldb/test/Shell/SymbolFile/DWARF/find-basic-function.cpp
@@ -10,6 +10,10 @@
 // RUN:   FileCheck --check-prefix=FULL %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full 
%t | \
 // RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function 
--function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
+// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function 
--function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-METHOD %s
 // RUN: lldb-test symbols --name=foo --context=context --find=function 
--function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -21,9 +25,13 @@
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method 
%t | \
 // RUN:   FileCheck --check-prefix=METHOD %s
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t 
| \
-// RUN:   FileCheck --check-prefix=FULL-INDEXED %s
+// RUN:   FileCheck --check-prefix=FULL %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full 
%t | \
 // RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function 
--function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
+// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function 
--function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-METHOD %s
 // RUN: lldb-test symbols --name=foo --context=context --find=function 
--function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -37,9 +45,13 @@
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=method 
%t | \
 // RUN:   FileCheck --check-prefix=METHOD %s
 // RUN: lldb-test symbols --name=foo --find=function --function-flags=full %t 
| \
-// RUN:   FileCheck --check-prefix=FULL-INDEXED %s
+// RUN:   FileCheck --check-prefix=FULL %s
 // RUN: lldb-test symbols --name=_Z3fooi --find=function --function-flags=full 
%t | \
 // RUN:   FileCheck --check-prefix=FULL-MANGLED %s
+// RUN: lldb-test symbols --name=_ZN3bar3baz3fooEv --find=function 
--function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-NAMESPACE %s
+// RUN: lldb-test symbols --name=_ZN4sbar3fooEi --find=function 
--function-flags=full %t | \
+// RUN:   FileCheck --check-prefix=FULL-MANGLED-METHOD %s
 // RUN: lldb-test symbols --name=foo --context=context --find=function 
--function-flags=base %t | \
 // RUN:   FileCheck --check-prefix=CONTEXT %s
 // RUN: lldb-test symbols --name=not_there --find=function %t | \
@@ -58,20 +70,17 @@
 // METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
 // METHOD-DAG: name = "ffbar()::sbaz::foo()", mangled = 
"_ZZ5ffbarvEN4sbaz3fooEv"
 
-// FULL-INDEXED: Found 7 functions:
-// FULL-INDEXED-DAG: name = "foo()", mangled = "_Z3foov"
-// FULL-INDEXED-DAG: name = "foo(int)", mangled = "_Z3fooi"
-// FULL-INDEXED-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
-// FULL-INDEXED-DAG: name = "bar::baz::foo()", mangled = "_ZN3bar3baz3fooEv"
-// FULL-INDEXED-DAG: name = "sbar::foo()", mangled = "_ZN4sbar3fooEv"
-// FULL-INDEXED-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
-// FULL-INDEXED-DAG: name = "ffbar()::sbaz::foo()", mangled = 
"_ZZ5ffbarvEN4sbaz3fooEv"
-
 // FULL: Found 0 functions:
 
 // FULL-MANGLED: Found 1 functions:
 // FULL-MANGLED-DAG: name = "foo(int)", mangled = "_Z3fooi"
 
+// FULL-MANGLED-NAMESPACE: Found 1 functions:
+// FULL-MANGLED-NAMESPACE-DAG: name = "bar::baz::foo()", mangled = 
"_ZN3bar3baz3fooEv"
+
+// FULL-MANGLED-METHOD: Found 1 functions:
+// FULL-MANGLED-METHOD-DAG: name = "sbar::foo(int)", mangled = "_ZN4sbar3fooEi"
+
 // CONTEXT: Found 1 functions:
 // CONTEXT-DAG: name = "bar::foo()", mangled = "_ZN3bar3fooEv"
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
@@ -39,8 +39

[Lldb-commits] [PATCH] D73191: Only match mangled name in full-name function lookup (with accelerators)

2020-01-27 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added a comment.

Pavel, could you take another look, please?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D73191: Only match mangled name in full-name function lookup (with accelerators)

2020-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp:45
   if (name_type_mask & eFunctionNameTypeFull) {
-dies.push_back(die);
-return;
+if (!die.IsMethod() || die.GetMangledName(false) == name) {
+  dies.push_back(die);

jarin wrote:
> jarin wrote:
> > labath wrote:
> > > I don't believe the `IsMethod` check is really needed here -- the mangled 
> > > name check should handle everything.
> > > 
> > > In fact, looking at the implementation of 
> > > `DWARFDebugInfoEntry::GetMangledName`, I don't think you even need the 
> > > extra `substitute_name_allowed=false` part. The default value should do 
> > > exactly what we need. If the DIE has a linkage (mangled) name it will 
> > > return it and we will use that for comparison. For an `extern "C"` 
> > > function it will return the regular name, and we will compare that 
> > > instead (this check is somewhat redundant because if the name doesn't 
> > > match, the function should not be in the index in the first place, but I 
> > > don't think it hurts to check either).
> > > 
> > > Am I missing something?
> > I want to avoid returning methods to [[ 
> > https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1258
> >  | ClangExpressionDeclMap::LookupFunction ]], so that 
> > ClangExpressionDeclMap::LookupFunction does not do the expensive [[ 
> > https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1298
> >  | DeclContext parsing ]] just to find out the function [[ 
> > https://github.com/llvm/llvm-project/blob/808142876c10b52e7ee57cdc6dcf0acc5c97c1b7/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp#L1304
> >  | is a method ]] and must be thrown away.
> > 
> > The motivation is pretty much the same as for  
> > https://reviews.llvm.org/D70846.
> > 
> > Does it make sense?
> I think I see what you are saying - in the test case below, FULL should be 
> consistent with FULL-INDEXED. Let me remove the IsMethod check and merge the 
> FULL and FULL-INDEXED test cases below.
Yes, that's exactly what I meant. :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D73191: Only match mangled name in full-name function lookup (with accelerators)

2020-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

(I mean, if there is a real benefit to having some queries return only 
non-methods, then we can certainly do something like that as well, but that 
should be handled differently -- either we can create a new query mode, or 
change the behavior (and name?) of eFunctionNameTypeFull across the board).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [lldb] 785c6b2 - [lldb][NFC] Improve documentation for CompletionRequest

2020-01-27 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-27T10:48:41+01:00
New Revision: 785c6b22914fa10455ef1bf349447b874bc1f37a

URL: 
https://github.com/llvm/llvm-project/commit/785c6b22914fa10455ef1bf349447b874bc1f37a
DIFF: 
https://github.com/llvm/llvm-project/commit/785c6b22914fa10455ef1bf349447b874bc1f37a.diff

LOG: [lldb][NFC] Improve documentation for CompletionRequest

Added: 


Modified: 
lldb/include/lldb/Utility/CompletionRequest.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/CompletionRequest.h 
b/lldb/include/lldb/Utility/CompletionRequest.h
index 570f626ac54e..5418efe180bf 100644
--- a/lldb/include/lldb/Utility/CompletionRequest.h
+++ b/lldb/include/lldb/Utility/CompletionRequest.h
@@ -17,16 +17,21 @@
 
 namespace lldb_private {
 enum class CompletionMode {
-  // The current token has been completed.
+  /// The current token has been completed. The client should indicate this
+  /// to the user (usually this is done by adding a trailing space behind the
+  /// token).
+  /// Example: "command sub" -> "command subcommand " (note the trailing 
space).
   Normal,
-  // The current token has been partially completed. This means that we found
-  // a completion, but that the completed token is still incomplete. Examples
-  // for this are file paths, where we want to complete "/bi" to "/bin/", but
-  // the file path token is still incomplete after the completion. Clients
-  // should not indicate to the user that this is a full completion (e.g. by
-  // not inserting the usual trailing space after a successful completion).
+  /// The current token has been partially completed. This means that we found
+  /// a completion, but that the token is still incomplete. Examples
+  /// for this are file paths, where we want to complete "/bi" to "/bin/", but
+  /// the file path token is still incomplete after the completion. Clients
+  /// should not indicate to the user that this is a full completion (e.g. by
+  /// not inserting the usual trailing space after a successful completion).
+  /// Example: "file /us" -> "file /usr/" (note the missing trailing space).
   Partial,
-  // The full line has been rewritten by the completion.
+  /// The full line has been rewritten by the completion.
+  /// Example: "alias name" -> "other_command full_name".
   RewriteLine,
 };
 
@@ -35,7 +40,12 @@ class CompletionResult {
   /// A single completion and all associated data.
   class Completion {
 
+/// The actual text that should be completed. The meaning of this text
+/// is defined by the CompletionMode.
+/// \see m_mode
 std::string m_completion;
+/// The description that should be displayed to the user alongside the
+/// completion text.
 std::string m_descripton;
 CompletionMode m_mode;
 
@@ -53,9 +63,12 @@ class CompletionResult {
   };
 
 private:
+  /// List of found completions.
   std::vector m_results;
 
-  /// List of added completions so far. Used to filter out duplicates.
+  /// A set of the unique keys of all found completions so far. Used to filter
+  /// out duplicates.
+  /// \see CompletionResult::Completion::GetUniqueKey
   llvm::StringSet<> m_added_values;
 
 public:



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


[Lldb-commits] [lldb] a311beb - [lldb][NFC] Give import-std-module tests a more unique file names

2020-01-27 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-01-27T10:55:57+01:00
New Revision: a311bebb53d405597f7c66c86a8df7085ca2695c

URL: 
https://github.com/llvm/llvm-project/commit/a311bebb53d405597f7c66c86a8df7085ca2695c
DIFF: 
https://github.com/llvm/llvm-project/commit/a311bebb53d405597f7c66c86a8df7085ca2695c.diff

LOG: [lldb][NFC] Give import-std-module tests a more unique file names

We want that the *.py names for the tests have unique names but
the current ones are sometimes very simple (e.g., "TestUniquePtr.py")
and could collide with unrelated tests. This just gives all these
tests a "FromStdModule" suffix to make these collisions less likely.

Added: 

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDequeFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardListFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list/TestForwardListFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list/main.cpp

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentListFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list/TestListFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list/main.cpp

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/queue/TestQueueFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContentFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr/TestSharedPtrFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/stack/TestStackFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/unique_ptr/TestUniquePtrFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-bool/TestVectorBoolFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVectorFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-of-vectors/TestVectorOfVectorsFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector/TestVectorFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/vector/main.cpp

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/weak_ptr-dbg-info-content/TestDbgInfoContentWeakPtrFromStdModule.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/weak_ptr/TestWeakPtrFromStdModule.py

Modified: 


Removed: 

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-basic/TestBasicDeque.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/deque-dbg-info-content/TestDbgInfoContentDeque.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/TestBasicForwardList.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-basic/main.cpp

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/forward_list-dbg-info-content/TestDbgInfoContentForwardList.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/TestBasicList.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-basic/main.cpp

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/list-dbg-info-content/TestDbgInfoContentList.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/queue/TestQueue.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr-dbg-info-content/TestSharedPtrDbgInfoContent.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/shared_ptr/TestSharedPtr.py

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-mod

[Lldb-commits] [PATCH] D73191: Only match mangled name in full-name function lookup (with accelerators)

2020-01-27 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added a comment.

In D73191#1841372 , @labath wrote:

> (I mean, if there is a real benefit to having some queries return only 
> non-methods, then we can certainly do something like that as well, but that 
> should be handled differently -- either we can create a new query mode, or 
> change the behavior (and name?) of eFunctionNameTypeFull across the board).


No, I was confused; this simpler solution works for us just fine. I agree with 
you and I like that the indexed case is the same as the manual-index one now.

If you are happy with the patch, could you land it for me?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73191/new/

https://reviews.llvm.org/D73191



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


[Lldb-commits] [PATCH] D69273: ValueObject: Fix a crash related to children address type computation

2020-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thanks for the update Jim. I'm putting some of my thoughts inline.

In D69273#1840029 , @jingham wrote:

> Sorry, I've been busy with other things.
>
> In answer to Pavel's direct question "What did we do about the swift crashes" 
> the current answer is "we backed out the patch from the swift-lldb sources".  
> But that's clearly not the good answer...
>
> The thing that's surprising about the crash in the swift testsuite is that it 
> happens because, in the process of building the dynamic ValueObject of the 
> synthetic child for the expression result ValueObject for a simple swift 
> expression, with this code in place one of the Values we are using that is in 
> fact a load address type gets mislabeled as a host address, and then we crash 
> accessing it in our address space.  IIUC, that's of the opposite of what this 
> patch was trying to do...


Yes, that is the opposite of what this is trying to do, though I can see how 
this could trigger something like that when synthetic children come into the 
game. The logic `children_type = am_i_pointer ? load : host` is only correct 
for real children, and if this somehow fires on synthetic children of a 
non-pointer ValueObject, but the children are actually obtained via 
dereferencing some pointers, then they might get mislabelled as host pointers.

However, I don't think things could be this simple, as otherwise this would 
also reproduce on the synthetic children of std::map for instance. So there 
must be something more here...

> BTW, I also think this patch is formally wrong for const result objects, 
> because once the stop ID has moved on, const result object values should 
> never be converted back to load address types.  They are supposed to 
> represent the state at the time of the capture, so checking the state of the 
> process after that time can't be right.  But that wasn't the failure we were 
> seeing in the Swift testsuite.

I get the "state at the time of the capture" argument, but it's not clear to me 
what would be the behavior without this patch(?) IIUC, we currently don't have 
any logic which would "freeze-dry" the pointed-to values (and it's tricky to do 
so, because those values can contain other pointers, etc.). So, this seems 
correct at least in the sense that those pointer values will get the correct 
address class (assuming the synthetic children issue above is sorted out) and 
we won't crash while trying to dereference them.

I also think the "state at the time of capture" thing needs to be more nuanced. 
For instance, if I had a variable like `int *ptr = &some_int;`, I wouldn't 
expect that `p ptr` followed by a `p *$1` would show me the old/stale value of 
`some_int`. That would certainly be the case if the pointer is part of an 
"implementation detail" of something (like the `const char *` inside 
`std::string`), but it seems like there are at least some cases where it would 
be reasonable to follow the pointer values into live memory.

> ConstResult objects are still implicated in this crash, because "expr var" 
> crashes but "frame var" for this swift variable works.  The difference 
> between the two cases is that in the succeeding case the root ValueObject is 
> a ValueObjectVariable, and in the crashing case a ValueObjectConstResult.   
> But it doesn't have to do with the const result getting into an inconsistent 
> state because it updates itself when it shouldn't.  It seems like there's 
> just something in the logic of UpdateChildrenAddressType that is wrong for 
> ValueObjectConstResult.  But it seems to take a fairly complex chain of 
> values - ConstResult->ConstResultChild->SyntheticValue->DynamicValue to 
> trigger the crash, and the crash is actually in getting the backing data for 
> a ValueObjectDynamicValue...
> 
> It will take me some more head scratching to figure out why this is going 
> wrong but I'm currently in the process of hastening my eventual balding.

Lets hope it doesn't come to that. :) Let me know if there's anything I can do 
to help.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69273/new/

https://reviews.llvm.org/D69273



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Thanks. I am glad that we were able to sort that out.

Now that there's nothing wasm-specific in 
`DynamicLoaderWasmDYLD::LoadModuleAtAddress`, I have another question. :)

The code in that function is a subset of the base 
`DynamicLoader::LoadModuleAtAddress` method you are overriding.  Is there a 
reason for that?
It doesn't seem like the additional stuff in the base method should hurt here. 
What the additional code does is that it tries to search for the object file on 
the local filesystem, and if it finds it, it will use that instead of copying 
the file over from the remote. In fact, that sounds like it could be useful 
here too, as copying that much data over gdb-remote isn't particularly fast..

What do you think about that?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72751/new/

https://reviews.llvm.org/D72751



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


[Lldb-commits] [lldb] 9a952fd - [LLDB] Fix build failures after removing Version from DWARFExpression.

2020-01-27 Thread Igor Kudrin via lldb-commits

Author: Igor Kudrin
Date: 2020-01-27T19:33:34+07:00
New Revision: 9a952fd462774e79d8dc514d71bf43ea0ca7f429

URL: 
https://github.com/llvm/llvm-project/commit/9a952fd462774e79d8dc514d71bf43ea0ca7f429
DIFF: 
https://github.com/llvm/llvm-project/commit/9a952fd462774e79d8dc514d71bf43ea0ca7f429.diff

LOG: [LLDB] Fix build failures after removing Version from DWARFExpression.

Added: 


Modified: 
lldb/source/Expression/DWARFExpression.cpp

Removed: 




diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 9b927085ca2e..849c96d9b455 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -88,8 +88,7 @@ void DWARFExpression::UpdateValue(uint64_t const_value,
 void DWARFExpression::DumpLocation(Stream *s, const DataExtractor &data,
lldb::DescriptionLevel level,
ABI *abi) const {
-  llvm::DWARFExpression(data.GetAsLLVM(), llvm::dwarf::DWARF_VERSION,
-data.GetAddressByteSize())
+  llvm::DWARFExpression(data.GetAsLLVM(), data.GetAddressByteSize())
   .print(s->AsRawOstream(), abi ? &abi->GetMCRegisterInfo() : nullptr,
  nullptr);
 }



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


[Lldb-commits] [PATCH] D73279: testsuite: generalize `DWARFASTParserClangTests` based on `DWARFExpressionTest`'s YAML

2020-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a reviewer: aprantl.
labath added a comment.

Thanks for splitting this off.

This looks good except that I wouldn't want to put this under the base 
`TestingSupport` folder -- the idea there was that this would contain only the 
basic stuff with no fancy dependencies (so that e.g. UtilityTests don't depend 
on everything). Here, you've put everything inline, which kind of hides this, 
but now that this is a separate file, it would make sense to put some of this 
stuff into a .cpp file (e.g. YamlObjectFile, YamlModule classes, and the 
YAMLModuleTester constructor).

The exact layout of the folders under TestingSupport is still evolving, and 
although one could argue that this should go under 
TestingSupport/SymbolFile/DWARF, that is quite a mouthful, and so I think we 
can just shove this under the existing TestingSupport/Symbol folder (with the 
rationale that SymbolFile, base class of SymbolFileDWARF, lives in the Symbol 
folder).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73279/new/

https://reviews.llvm.org/D73279



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


[Lldb-commits] [PATCH] D70847: [lldb] Set executable module when adding modules to the Target

2020-01-27 Thread Anton Kolesov via Phabricator via lldb-commits
anton.kolesov updated this revision to Diff 240533.
anton.kolesov added a comment.

Added a testcase. Because target's architecture is not directly exposed through 
an API, test looks at the target triplet - it is empty for targets created 
without an exe file. Without the patch, triplet remains unchanged after adding 
an executable, but with the patch, it changes to the architecture of the 
executable file, whichever it is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70847/new/

https://reviews.llvm.org/D70847

Files:
  lldb/packages/Python/lldbsuite/test/commands/target/set-exec/Makefile
  
lldb/packages/Python/lldbsuite/test/commands/target/set-exec/TestSetExecutable.py
  lldb/packages/Python/lldbsuite/test/commands/target/set-exec/main.c
  lldb/source/Target/Target.cpp


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2016,12 +2016,15 @@
 // there wasn't an equivalent module in the list already, and if there was,
 // let's remove it.
 if (module_sp) {
+  bool isExecutable = false;
   ObjectFile *objfile = module_sp->GetObjectFile();
   if (objfile) {
 switch (objfile->GetType()) {
+case ObjectFile::eTypeExecutable: /// A normal executable
+  isExecutable = true;
+  LLVM_FALLTHROUGH;
 case ObjectFile::eTypeCoreFile: /// A core file that has a checkpoint 
of
 /// a program's execution state
-case ObjectFile::eTypeExecutable:/// A normal executable
 case ObjectFile::eTypeDynamicLinker: /// The platform's dynamic linker
  /// executable
 case ObjectFile::eTypeObjectFile:/// An intermediate object file
@@ -2084,6 +2087,16 @@
 } else {
   m_images.Append(module_sp, notify);
 }
+
+// Ensure that architecture of the Target matches that of the
+// executable file. Otherwise Target might use a "default" platform
+// that can't actually debug the executable. For example, if the Target
+// is created and by default assumes that it should use "gdb-remote"
+// process, however executable has an architecture that requires a
+// different Process class - without explicitly set executable module
+// Target would attempt to use "gdb-remote" created initially.
+if (isExecutable)
+  SetExecutableModule(module_sp, eLoadDependentsNo);
   } else
 module_sp.reset();
 }
Index: lldb/packages/Python/lldbsuite/test/commands/target/set-exec/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/commands/target/set-exec/main.c
@@ -0,0 +1,3 @@
+int main() {
+  return 0;
+}
Index: 
lldb/packages/Python/lldbsuite/test/commands/target/set-exec/TestSetExecutable.py
===
--- /dev/null
+++ 
lldb/packages/Python/lldbsuite/test/commands/target/set-exec/TestSetExecutable.py
@@ -0,0 +1,26 @@
+"""
+Test that the first module of the target is set as an executable.
+"""
+
+from __future__ import print_function
+
+from lldbsuite.test.lldbtest import *
+
+
+class SetExecutableTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+"""Test adding images to the target."""
+self.build()
+
+# Create an empty target - it will have an empty triplet.
+target = self.dbg.CreateTarget(None)
+self.assertTrue(target, VALID_TARGET)
+self.assertEqual(len(target.GetTriple()), 0)
+
+# Add a first module, which is treated as an executuble, so it's
+# architecture will change the architecture of the target.
+target.AddModule(self.getBuildArtifact("a.out"), None, None)
+self.assertNotEqual(len(target.GetTriple()), 0)
Index: lldb/packages/Python/lldbsuite/test/commands/target/set-exec/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/commands/target/set-exec/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules


Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -2016,12 +2016,15 @@
 // there wasn't an equivalent module in the list already, and if there was,
 // let's remove it.
 if (module_sp) {
+  bool isExecutable = false;
   ObjectFile *objfile = module_sp->GetObjectFile();
   if (objfile) {
 switch (objfile->GetType()) {
+case ObjectFile::eTypeExecutable: /// A normal executable
+  isExecutable = true;
+  LLVM_FALLTHROUGH;
 case ObjectFile::eTypeCoreFile: /// A core f

Re: [Lldb-commits] [lldb] fcaf5f6 - [LLDB] Fix the handling of unnamed bit-fields when parsing DWARF

2020-01-27 Thread Hans Wennborg via lldb-commits
Sure, b5cf892651812003e64c4a8f0dbf81f74a499016

On Mon, Jan 27, 2020 at 12:18 AM Raphael Isemann  wrote:
>
> This commit fixes a *very* frequent crash when debugging Clang with LLDB 10. 
> Could we get that cherry-picked into the 10.x branch?
>
> I’ve been running the patch since more than a week and I haven’t found any 
> issues with it and the bots are also happy.
>
> Thanks!
> - Raphael
>
> > On 23. Jan 2020, at 23:46, via lldb-commits  
> > wrote:
> >
> >
> > Author: shafik
> > Date: 2020-01-23T14:46:24-08:00
> > New Revision: fcaf5f6c01a09f23b948afb8c91c4dd951d4525e
> >
> > URL: 
> > https://github.com/llvm/llvm-project/commit/fcaf5f6c01a09f23b948afb8c91c4dd951d4525e
> > DIFF: 
> > https://github.com/llvm/llvm-project/commit/fcaf5f6c01a09f23b948afb8c91c4dd951d4525e.diff
> >
> > LOG: [LLDB] Fix the handling of unnamed bit-fields when parsing DWARF
> >
> > We ran into an assert when debugging clang and performing an expression on 
> > a class derived from DeclContext. The assert was indicating we were getting 
> > the offsets wrong for RecordDeclBitfields. We were getting both the size 
> > and offset of unnamed bit-field members wrong. We could fix this case with 
> > a quick change but as I extended the test suite to include more 
> > combinations we kept finding more cases that were being handled 
> > incorrectly. A fix that handled all the new cases as well as the cases 
> > already covered required a refactor of the existing technique.
> >
> > Differential Revision: https://reviews.llvm.org/D72953
> >
> > Added:
> >lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/Makefile
> >
> > lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
> >lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/main.cpp
> >
> > Modified:
> >lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
> >lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
> >
> > Removed:
> >
> >
> >
> > 
> > diff  --git 
> > a/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/Makefile 
> > b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/Makefile
> > new file mode 100644
> > index ..8b20bcb0
> > --- /dev/null
> > +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/Makefile
> > @@ -0,0 +1,3 @@
> > +CXX_SOURCES := main.cpp
> > +
> > +include Makefile.rules
> >
> > diff  --git 
> > a/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
> >  
> > b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
> > new file mode 100644
> > index ..696e5647f13f
> > --- /dev/null
> > +++ 
> > b/lldb/packages/Python/lldbsuite/test/lang/cpp/bitfields/TestCppBitfields.py
> > @@ -0,0 +1,105 @@
> > +"""Show bitfields and check that they display correctly."""
> > +
> > +import lldb
> > +from lldbsuite.test.decorators import *
> > +from lldbsuite.test.lldbtest import *
> > +from lldbsuite.test import lldbutil
> > +
> > +
> > +class CppBitfieldsTestCase(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.line = line_number('main.cpp', '// Set break point at this 
> > line.')
> > +
> > +# BitFields exhibit crashes in record layout on Windows
> > +# (http://llvm.org/pr21800)
> > +@skipIfWindows
> > +def test_and_run_command(self):
> > +"""Test 'frame variable ...' on a variable with bitfields."""
> > +self.build()
> > +
> > +lldbutil.run_to_source_breakpoint(self, '// Set break point at 
> > this line.',
> > +  lldb.SBFileSpec("main.cpp", False))
> > +
> > +# 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("expr (lba.a)", VARIABLES_DISPLAYED_CORRECTLY,
> > +substrs=['unsigned int', '2'])
> > +self.expect("expr (lbb.b)", VARIABLES_DISPLAYED_CORRECTLY,
> > +substrs=['unsigned int', '3'])
> > +self.expect("expr (lbc.c)", VARIABLES_DISPLAYED_CORRECTLY,
> > +substrs=['unsigned int', '4'])
> > +self.expect("expr (lbd.a)", VARIABLES_DISPLAYED_CORRECTLY,
> > +substrs=['unsigned int', '5'])
> > +self.expect("expr (clang_example.f.a)", 
> > VARIABLES_DISPLAYED_CORRECTLY,
> > +substrs=['uint64_t', '1'])
> > +
> > +self.expect(
> > +"frame variable --show-

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-27 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 240543.
mib marked 12 inline comments as done.
mib added a comment.

Changed the RecognizedStackFrame and AbortRecognizedStackFrame to add a 
StopReasonDescription method instead of a StopInfo instance.

This way, lldb can show a special stop reason description, for recognized 
frames that override the StopReasonDescription method, while keeping track of 
the underlying StopInfo. To display the underlying StopInfo, the thread-format 
token `stop-reason-raw` can be used.

The stop description can also be retrieved through the SBAPI using 
SBThread::GetStopDescription. It's either returning the "cooked" or the "raw" 
stop reason depending if  the thread a has recognized frame.

This patch also changes the ObjC exception recognizer to have a special 
StopReasonDescription and updates its tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303

Files:
  lldb/docs/use/formatting.rst
  lldb/include/lldb/Core/FormatEntity.h
  lldb/include/lldb/Target/AbortRecognizer.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/Thread.h
  
lldb/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
  lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  lldb/source/API/SBThread.cpp
  lldb/source/Core/FormatEntity.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Target/AbortRecognizer.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/Shell/Recognizer/Inputs/abort.c
  lldb/test/Shell/Recognizer/abort.test

Index: lldb/test/Shell/Recognizer/abort.test
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/abort.test
@@ -0,0 +1,13 @@
+# UNSUPPORTED: system-windows
+# RUN: %clang_host -g -O0 %S/Inputs/abort.c -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+run
+# CHECK: thread #{{.*}}stop reason = hit program assert
+frame info
+# CHECK: frame #{{.*}}`main at abort.c
+frame recognizer info 0
+# CHECK: frame 0 is recognized by Abort StackFrame Recognizer
+set set thread-format "{${thread.stop-reason-raw}}\n"
+thread info
+# CHECK: signal SIGABRT
+q
Index: lldb/test/Shell/Recognizer/Inputs/abort.c
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/Inputs/abort.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  int a = 42;
+  assert(a == 42);
+  a--;
+  assert(a == 42);
+  return 0;
+}
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -573,9 +573,64 @@
   m_state = state;
 }
 
+llvm::StringRef Thread::GetStopDescription() {
+  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
+
+  if (!frame_sp)
+return GetStopDescriptionRaw();
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp)
+return GetStopDescriptionRaw();
+
+  llvm::StringRef recognized_stop_description =
+  recognized_frame_sp->GetStopDescription();
+
+  if (!recognized_stop_description.empty())
+return recognized_stop_description;
+
+  return GetStopDescriptionRaw();
+}
+
+llvm::StringRef Thread::GetStopDescriptionRaw() {
+  StopInfoSP stop_info_sp = GetStopInfo();
+  llvm::StringRef raw_stop_description;
+  if (stop_info_sp && stop_info_sp->IsValid())
+raw_stop_description = stop_info_sp->GetDescription();
+  return raw_stop_description;
+}
+
+void Thread::SelectMostRelevantFrame() {
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD);
+
+  auto frames_list_sp = GetStackFrameList();
+
+  // Only the top frame should be recognized.
+  auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp) {
+LLDB_LOG(log, "Frame #0 not recognized");
+return;
+  }
+
+  if (StackFrameSP most_relevant_frame_sp =
+  recognized_frame_sp->GetMostRelevantFrame()) {
+LLDB_LOG(log, "Found most relevant frame at index {0}",
+ most_relevant_frame_sp->GetFrameIndex());
+SetSelectedFrame(most_relevant_frame_sp.get());
+  } else {
+LLDB_LOG(log, "No relevant frame!");
+  }
+}
+
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
+  SelectMostRelevantFrame();
+
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
 
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -92,7 +92,7 @@
 
   StackFrameRecognizerSP GetRecognizerForFrame(StackFr

[Lldb-commits] [PATCH] D70847: [lldb] Set executable module when adding modules to the Target

2020-01-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

So it might be better to create a ELF file for a remote platform, then run 
"obj2yaml" on it. Then the test will run "yaml2obj" on it, there are many test 
cases that do this, so look for "*.yaml" in the test directories. Then the test 
can check for a hard coded target triple, and also verify that the platform was 
changed. I will add inline comments for clarification in the test python file.




Comment at: 
lldb/packages/Python/lldbsuite/test/commands/target/set-exec/TestSetExecutable.py:16
+"""Test adding images to the target."""
+self.build()
+

Create a yaml file and put it in the same directory as this file. Change this 
line to be:
```
src_dir = self.getSourceDir()
yaml_path = os.path.join(src_dir, "a.yaml")
obj_path = self.getBuildArtifact("a.out")
self.yaml2obj(yaml_path, obj_path)
```
Make an ELF file that that is for a remote platform where the triple and 
platform won't match typical hosts.



Comment at: 
lldb/packages/Python/lldbsuite/test/commands/target/set-exec/TestSetExecutable.py:21
+self.assertTrue(target, VALID_TARGET)
+self.assertEqual(len(target.GetTriple()), 0)
+

Don't know if I would run this assert here. I could see a target that is 
created with nothing possibly using the host architecture and host platform by 
default. So maybe remote this assert where the target triple is not set.



Comment at: 
lldb/packages/Python/lldbsuite/test/commands/target/set-exec/TestSetExecutable.py:26
+target.AddModule(self.getBuildArtifact("a.out"), None, None)
+self.assertNotEqual(len(target.GetTriple()), 0)

Check the exact triple of the remote executable you end up adding.

Also add a check that the platform gets updated. Platforms must be compatible 
with the architecture of the target's main executable, so it is good to verify 
that the platform gets updated as well. Something like:

```
platform = target.GetPlatform()
set.assertEqual(platform.GetName(), "remote-linux")
```

This will make this test complete. If the platform isn't right we will need to 
fix this as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70847/new/

https://reviews.llvm.org/D70847



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D72751#1835656 , @labath wrote:

> [ looping in @aadsm for the svr4 stuff ]
>
> Thanks for adding the test, and for the detailed writeup. Please find my 
> comments inline.
>
> In D72751#1835502 , @paolosev wrote:
>
> > The first is that we need to call `Target::SetSectionLoadAddress()` twice, 
> > from two different places. First we need to call 
> > `Target::SetSectionLoadAddress()` in `ObjectFileWasm::SetLoadAddress()`, 
> > and then again in `DynamicLoaderWasmDYLD::DidAttach()`. The reason for this 
> > seems to originate in the sequence of function calls:
> >
> > In `DynamicLoaderWasmDYLD::DidAttach()` we call 
> > `ProcessGDBRemote::LoadModules()` to get list of loaded modules from the 
> > remote (Wasm engine).
> >  `ProcessGDBRemote::LoadModules()` calls, first:
> >
> > - `DynamicLoaderWasmDYLD::LoadModuleAtAddress()` and from there: ...
> >
> >   then:
> > - `Target::SetExecutableModule() -> Target::ClearModules() -> 
> > SectionLoadList::Clear()`
> >
> >   So, at the end of `LoadModules()` in `DynamicLoaderWasmDYLD::DidAttach()` 
> > the SectionLoadList is empty, and we need to set it again by calling 
> > `Target::.SetSectionLoadAddress()` again. This works but the duplication is 
> > ugly; is there a way to improve this?
>
>
> I hope so. :) This seems like a bug in `ProcessGDBRemote::LoadModules`. It 
> seems wrong/wasteful/etc to do all this work to compute the section load 
> addresses only to have them be thrown away by `SetExecutableModule`. Maybe 
> all it would take is to reverse the order of these two actions, so that the 
> load addresses persist? Can you try something like that?


I would be interested to see if this helps as well.

> On a side note, `ProcessGDBRemote::LoadModules` seems a bit internally 
> inconsistent. At one place it claims that "The main executable will never be 
> included in libraries-svr4", but then it goes on to set an executable module 
> anyway. This could in fact be a clue as to why this problem hasn't showed up 
> on other platforms -- if the remote does not send the executable, then 
> SetExecutableModule is not called.

The logic in ProcessGDBRemote::LoadModules is bad, the executable should be set 
before any sections are loaded.

> On a side-side note, this may mean that you sending the main wasm file 
> through `qXfer:libraries-svr4` may not be correct. However, fixing that would 
> mean finding another way to communicate the main executable name/address. I 
> don't think we currently have an easy way to do that so it may be better to 
> fix `ProcessGDBRemote::LoadModules`, given that it "almost" supports 
> executables.

Is there a "qXfer:executable"? Seems from the code in 
ProcessGDBRemote::LoadModules() that people were seeing the main executable in 
the list somewhere. Be a shame to not allow it.

> I am also worried about the fact that `SymbolFileDWARF::CalculateAbilities` 
> requires the module to be "loaded". That shouldn't be normally required. That 
> function does a very basic check on some sections, and this should work fine 
> without those sections having a "load address", even if they are actually 
> being loaded from target memory. I think this means there are some additional 
> places where ObjectFileWasm should use `m_memory_addr` instead of something 
> else...

So a lot of these problems might go away if the modify the ObjectFileWASM to 
"do the right thing" when the ObjectFile is from a live process. Object file 
instances know if there are from a live process because the ObjectFile members:

  lldb::ProcessWP m_process_wp;
  const lldb::addr_t m_memory_addr;

Will be filled in. So the object file doesn't need to have its sections loaded 
in a target in order to read section contents right? The object file can be 
asked to read its section data via ObjectFile::ReadSectionData(...) (2 
variants).

So Pavel is correct, the sections don't need to be loaded for anything in 
SymbolFileDWARF::CalculateAbilities(...). The section list does need to be 
created and available during SymbolFileDWARF::CalculateAbilities(...). We just 
need to be able to get the section contents and poke around at the DWARF bits.

> 
> 
>> The second problem is that the Code Section needs to be initialized (in 
>> `ObjectFileWasm::CreateSections()`) with `m_file_addr = m_file_offset = 0`, 
>> and not with the actual file offset of the Code section in the Wasm file. If 
>> we set `Section::m_file_addr` and `Section::m_file_offset` to the actual 
>> code offset, the DWARF info does not work correctly.
>> 
>> I have some doubts regarding the DWARF data generated by Clang for a Wasm 
>> target. Looking at an example, for a Wasm module that has the Code section 
>> at offset 0x57, I see this DWARF data:
>> 
>>   0x000b: DW_TAG_compile_unit
>> […]
>> DW_AT_low_pc (0x)
>> DW_AT_ranges (0x000

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/docs/use/formatting.rst:137
 
+---+-+
-| ``thread.stop-reason``| A textual reason each 
thread stopped  


  |
+| ``thread.stop-reason``| A textual reason why the 
thread stopped. If the thread have a recognized frame, this displays its 
recognized stop reason. Otherwise, gets the stop info description.  

  |
++---+-+

This change seems somewhat orthogonal to this patch. Is the abort recognizer 
the only one where these two will be different? If not I would suggest 
splitting this off into a separate patch.  



Comment at: lldb/include/lldb/Target/AbortRecognizer.h:33
+llvm::Optional>
+GetAbortLocation(Process *process_sp);
+

Why is this in the header? If this is only used by the implementation, you 
should make these static function in the `cpp` file. 



Comment at: lldb/include/lldb/Target/AbortRecognizer.h:48
+
+class AbortRecognizedStackFrame : public RecognizedStackFrame {
+public:

Doxygen comment?



Comment at: lldb/source/Core/FormatEntity.cpp:1279
   Thread *thread = exe_ctx->GetThreadPtr();
   if (thread) {
+llvm::StringRef stop_description = thread->GetStopDescription();

I know you didn't touch this line but since you copied it below...
```
if(Thread *thread = exe_ctx->GetThreadPtr()) 
```



Comment at: lldb/source/Target/AbortRecognizer.cpp:42
+
+  /* We go a frame beyond the assert location because the most relevant
+   * frame for the user is the one in which the assert function was called.

(nit) We usually just use `//` for block comments.



Comment at: lldb/source/Target/AbortRecognizer.cpp:67
+  StringRef function_name;
+  std::tie(module_spec, function_name) = *assert_location;
+

I like `std::tie` but I wonder if a struct with named fields wouldn't make this 
more readable with less code. Saves you six lines in this function and the next 
one in exchange for a 4-line struct definition. Anyway I'll leave this up to 
you to decide. 

```
return lldb::RecognizedStackFrameSP(
  new AbortRecognizedStackFrame(thread_sp, assert_location->module_spec, 
assert_location->function_name));
```




Comment at: lldb/source/Target/AbortRecognizer.cpp:107
+
+  std::string module_name;
+  StringRef symbol_name;

Why is this a `std::string` and not a `StringRef`? I'm pretty sure `FileSpec` 
has ctor that takes a StringRef. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73314: [lldb/Commands] Make column available through _regexp-break

2020-01-27 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.

lgtm


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73314/new/

https://reviews.llvm.org/D73314



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/include/lldb/Expression/DWARFExpression.h:142
 
+  std::pair GetLocationListAddresses() const;
+

Might be better as two functions? One to get the CU address and func address:

```
lldb_private::Address GetCUAddress();
lldb_private::Address GetFuncAddress();
```

The DWARFExpression has a Module when the location comes from DWARF and this 
can be used to get the arch and sanitize the address by calling 
GetOpcodeLoadAddress on the address before returning it. 



Comment at: lldb/include/lldb/Utility/RangeMap.h:247-250
+  Entry *GetMutableEntryAtIndex(size_t i) {
+return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
+  }
+

Remove if we make DWARFRangeList handle this as mentioned in inline comment



Comment at: lldb/source/Expression/DWARFExpression.cpp:102-106
+std::pair DWARFExpression::GetLocationListAddresses() const {
+  return std::make_pair(m_loclist_addresses->cu_file_addr,
+m_loclist_addresses->func_file_addr);
+}
+

Convert to:

```
lldb_private::Address DWARFExpression::GetCUAddress();
lldb_private::Address DWARFExpression::GetFuncAddress();
```




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:397-400
+  for (size_t i = 0; i < ranges.GetSize(); i++) {
+DWARFRangeList::Entry *entry = ranges.GetMutableEntryAtIndex(i);
+entry->base = arch.GetOpcodeLoadAddress(entry->base);
+  }

What about asking the DWARFRangeList to fix all code addresses? This code would 
become:

```
ranges.GetOpcodeAddresses(arch);
```





Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:401-405
+  if (frame_base && frame_base->IsLocationList()) {
+std::pair loclist = 
frame_base->GetLocationListAddresses();
+loclist.second = arch.GetOpcodeLoadAddress(loclist.second);
+frame_base->SetLocationListAddresses(loclist.first, loclist.second);
+  }

Remove if we add:
```
lldb_private::Address DWARFExpression::GetCUAddress();
lldb_private::Address DWARFExpression::GetFuncAddress();
```




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:776-779
+for (size_t i = 0; i < ranges.GetSize(); i++) {
+  DWARFRangeList::Entry *entry = ranges.GetMutableEntryAtIndex(i);
+  entry->base = arch.GetOpcodeLoadAddress(entry->base);
+}

Call new DWARFRangeList::GetOpcodeAddresses?

```
ranges.GetOpcodeAddresses(arch);
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D70840: [LLDB] [DWARF] Strip out the thumb bit from addresses on ARM

2020-01-27 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo marked 2 inline comments as done.
mstorsjo added inline comments.



Comment at: lldb/include/lldb/Expression/DWARFExpression.h:142
 
+  std::pair GetLocationListAddresses() const;
+

clayborg wrote:
> Might be better as two functions? One to get the CU address and func address:
> 
> ```
> lldb_private::Address GetCUAddress();
> lldb_private::Address GetFuncAddress();
> ```
> 
> The DWARFExpression has a Module when the location comes from DWARF and this 
> can be used to get the arch and sanitize the address by calling 
> GetOpcodeLoadAddress on the address before returning it. 
Oh, if we'd make DWARFExpression::SetLocationListAddresses do the sanitization, 
then we don't need to add the getters at all - that'd save a lot of extra 
changes as well.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:397-400
+  for (size_t i = 0; i < ranges.GetSize(); i++) {
+DWARFRangeList::Entry *entry = ranges.GetMutableEntryAtIndex(i);
+entry->base = arch.GetOpcodeLoadAddress(entry->base);
+  }

clayborg wrote:
> What about asking the DWARFRangeList to fix all code addresses? This code 
> would become:
> 
> ```
> ranges.GetOpcodeAddresses(arch);
> ```
> 
> 
Yeah, I was thinking of some refactoring like that. I would have gone for a 
method that mutates the current range, e.g. `ranges.FixOpcodeAddresses(arch)`, 
but would you prefer it to be something that returns a new sanitized range 
instead?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70840/new/

https://reviews.llvm.org/D70840



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


[Lldb-commits] [PATCH] D73345: [lldb] Don't create duplicate declarations when completing a forward declaration with a definition from another source

2020-01-27 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73345/new/

https://reviews.llvm.org/D73345



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


[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 created this revision.
diazhector98 added a reviewer: wallace.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
diazhector98 planned changes to this revision.
diazhector98 marked 5 inline comments as done.
diazhector98 added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py:122
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[

also test this

foo.var1 + var2

foo.var1 + va
  var2
  var1



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:956
+
+std::vector breakpoints = {".", "->"};
+int max_breakpoint_position = -1;

commit_points



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:958
+int max_breakpoint_position = -1;
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints){

int breakpoint_index = -1



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:959
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints){
+  int breakpoint_position = match.rfind(breakpoint);

space before {



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:966
+}
+if (max_breakpoint_position != -1){
+  std::string cut_match = match.substr(max_breakpoint_position + 
breakpoint_string.length(), match.length() - max_breakpoint_position);

space before {




TODO


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,25 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector breakpoints = {".", "->"};
+int max_breakpoint_position = -1;
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints){
+  int breakpoint_position = match.rfind(breakpoint);
+  if (max_breakpoint_position < breakpoint_position){
+breakpoint_string = breakpoint;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+if (max_breakpoint_position != -1){
+  std::string cut_match = match.substr(max_breakpoint_position + breakpoint_string.length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -350,6 +350,8 @@
 
 def get_completions(self, text):
 response = self.request_completions(text)
+print(response['body']['targets'])
+print("==")
 return response['body']['targets']
 
 def get_scope_variables(self, scope_name, frameIndex=0, threadId=None):
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -16,6 +16,10 @@
 mydir = TestBase.compute_mydir(__file__)
 
 def verify_completions(self, actual_list, expected_list,

[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 planned changes to this revision.
diazhector98 marked 5 inline comments as done.
diazhector98 added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py:122
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[

also test this

foo.var1 + var2

foo.var1 + va
  var2
  var1



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:956
+
+std::vector breakpoints = {".", "->"};
+int max_breakpoint_position = -1;

commit_points



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:958
+int max_breakpoint_position = -1;
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints){

int breakpoint_index = -1



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:959
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints){
+  int breakpoint_position = match.rfind(breakpoint);

space before {



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:966
+}
+if (max_breakpoint_position != -1){
+  std::string cut_match = match.substr(max_breakpoint_position + 
breakpoint_string.length(), match.length() - max_breakpoint_position);

space before {




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506



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


[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240683.
diazhector98 added a comment.



1. Updating D73506 : Bug fix #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

Removed print statements

As title


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,25 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector breakpoints = {".", "->"};
+int max_breakpoint_position = -1;
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints){
+  int breakpoint_position = match.rfind(breakpoint);
+  if (max_breakpoint_position < breakpoint_position){
+breakpoint_string = breakpoint;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+if (max_breakpoint_position != -1){
+  std::string cut_match = match.substr(max_breakpoint_position + breakpoint_string.length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -350,6 +350,8 @@
 
 def get_completions(self, text):
 response = self.request_completions(text)
+print(response['body']['targets'])
+print("==")
 return response['body']['targets']
 
 def get_scope_variables(self, scope_name, frameIndex=0, threadId=None):
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -23,7 +23,7 @@
 self.assertFalse(not_expected_item in actual_list)
 
 @skipIfWindows
-@skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots
+#@skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots
 def test_completions(self):
 """
 Tests the completion request at different breakpoints
@@ -113,3 +113,23 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object->v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73024: [lldb] Complete return types of CXXMethodDecls to prevent crashing due to covariant return types

2020-01-27 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: lldb/source/Symbol/ClangASTImporter.cpp:1006
+/// Takes a CXXMethodDecl and completes the return type if necessary. This
+/// is currently only necessary for virtual functions with covariant return
+/// types where Clang's CodeGen expects that the underlying records are already

I am curious if we foresee the need to do this for other cases.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73024/new/

https://reviews.llvm.org/D73024



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


[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240687.
diazhector98 added a comment.



1. Updating D73506 : Bug fix #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

Syntax fixes and uncommenting @darwin

As title


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,26 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int breakpoint_index = -1;
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints) {
+  int breakpoint_position = match.rfind(breakpoint);
+  if (max_breakpoint_position < breakpoint_position){
+breakpoint_string = breakpoint;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + 
breakpoint_string.length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -113,3 +113,23 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object->v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,26 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int breakpoint_index = -1;
+std::string breakpoint_string = "";
+for (std::string breakpoint : breakpoints) {
+  int breakpoint_position = match.rfind(breakpoint);
+  if (max_breakpoint_position < breakpoint_position){
+breakpoint_string = breakpoint;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + breakpoint_string.length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packag

[Lldb-commits] [lldb] 94ec56b - [lldb/Test] Use lit.local.cfg to mark whole directory as (un)supported.

2020-01-27 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-27T15:11:00-08:00
New Revision: 94ec56b6d5e239a76345afeffe1cc3079235a9f6

URL: 
https://github.com/llvm/llvm-project/commit/94ec56b6d5e239a76345afeffe1cc3079235a9f6
DIFF: 
https://github.com/llvm/llvm-project/commit/94ec56b6d5e239a76345afeffe1cc3079235a9f6.diff

LOG: [lldb/Test] Use lit.local.cfg to mark whole directory as (un)supported.

Mark the whole Python or Lua test directory as unsupported when the
corresponding language is not available.

Added: 
lldb/test/Shell/ScriptInterpreter/Lua/lit.local.cfg
lldb/test/Shell/ScriptInterpreter/Python/lit.local.cfg

Modified: 


Removed: 




diff  --git a/lldb/test/Shell/ScriptInterpreter/Lua/lit.local.cfg 
b/lldb/test/Shell/ScriptInterpreter/Lua/lit.local.cfg
new file mode 100644
index ..ed0f0b5b8a7e
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Lua/lit.local.cfg
@@ -0,0 +1,2 @@
+if 'lua' not in config.available_features:
+  config.unsupported = True

diff  --git a/lldb/test/Shell/ScriptInterpreter/Python/lit.local.cfg 
b/lldb/test/Shell/ScriptInterpreter/Python/lit.local.cfg
new file mode 100644
index ..945a5615c421
--- /dev/null
+++ b/lldb/test/Shell/ScriptInterpreter/Python/lit.local.cfg
@@ -0,0 +1,2 @@
+if 'python' not in config.available_features:
+  config.unsupported = True



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


[Lldb-commits] [lldb] 223a209 - [lldb/Commands] Make column available through _regexp-break

2020-01-27 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-01-27T15:11:00-08:00
New Revision: 223a209027b44daeac53508bea154bc29314bddb

URL: 
https://github.com/llvm/llvm-project/commit/223a209027b44daeac53508bea154bc29314bddb
DIFF: 
https://github.com/llvm/llvm-project/commit/223a209027b44daeac53508bea154bc29314bddb.diff

LOG: [lldb/Commands] Make column available through _regexp-break

Update _regexp-break to interpret main.c:8:21 as:

  breakpoint set --line 8 --column 21

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

Added: 


Modified: 
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/test/Shell/Commands/command-breakpoint-col.test

Removed: 




diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index fc482e6bd33a..aedd71b8df09 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -500,7 +500,10 @@ void CommandInterpreter::LoadCommandDictionary() {
   m_command_dict["language"] =
   CommandObjectSP(new CommandObjectLanguage(*this));
 
+  // clang-format off
   const char *break_regexes[][2] = {
+  
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
+   "breakpoint set --file '%1' --line %2 --column %3"},
   {"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
"breakpoint set --file '%1' --line %2"},
   {"^/([^/]+)/$", "breakpoint set --source-pattern-regexp '%1'"},
@@ -515,6 +518,7 @@ void CommandInterpreter::LoadCommandDictionary() {
"breakpoint set --name '%1' --skip-prologue=0"},
   {"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
"breakpoint set --name '%1'"}};
+  // clang-format on
 
   size_t num_regexes = llvm::array_lengthof(break_regexes);
 
@@ -523,6 +527,9 @@ void CommandInterpreter::LoadCommandDictionary() {
   *this, "_regexp-break",
   "Set a breakpoint using one of several shorthand formats.",
   "\n"
+  "_regexp-break ::\n"
+  "  main.c:12:21  // Break at line 12 and column "
+  "21 of main.c\n\n"
   "_regexp-break :\n"
   "  main.c:12 // Break at line 12 of "
   "main.c\n\n"
@@ -546,7 +553,7 @@ void CommandInterpreter::LoadCommandDictionary() {
   "current file\n"
   "// containing text 'break "
   "here'.\n",
-  2,
+  3,
   CommandCompletions::eSymbolCompletion |
   CommandCompletions::eSourceFileCompletion,
   false));
@@ -573,6 +580,9 @@ void CommandInterpreter::LoadCommandDictionary() {
   *this, "_regexp-tbreak",
   "Set a one-shot breakpoint using one of several shorthand formats.",
   "\n"
+  "_regexp-break ::\n"
+  "  main.c:12:21  // Break at line 12 and column "
+  "21 of main.c\n\n"
   "_regexp-break :\n"
   "  main.c:12 // Break at line 12 of "
   "main.c\n\n"

diff  --git a/lldb/test/Shell/Commands/command-breakpoint-col.test 
b/lldb/test/Shell/Commands/command-breakpoint-col.test
index 65e66a362a59..65c1e2207943 100644
--- a/lldb/test/Shell/Commands/command-breakpoint-col.test
+++ b/lldb/test/Shell/Commands/command-breakpoint-col.test
@@ -1,7 +1,10 @@
 # UNSUPPORTED: system-windows
 #
 # RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
-# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 
21' %t.out | FileCheck %s
-# CHECK: -u  ( --column  )
-# CHECK: Specifies the column number on which to set this breakpoint.
+# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 
21' %t.out | FileCheck %s --check-prefix HELP --check-prefix CHECK
+# RUN: %lldb -b -o 'help _regexp-break' -o 'b main.c:2:21' %t.out | FileCheck 
%s --check-prefix HELP-REGEX --check-prefix CHECK
+# HELP: -u  ( --column  )
+# HELP: Specifies the column number on which to set this breakpoint.
+# HELP-REGEX: _regexp-break ::
+# HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c
 # CHECK: at main.c:2:21



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


[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240693.
diazhector98 added a comment.



1. Updating D73506 : Bug fix #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

Replaced storing breakpoint string with its index
.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < 
commit_points.size(); breakpoint_index++){
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + 
commit_points[commit_points_index].length(), match.length() - 
max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -113,3 +113,23 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object.v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++){
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + commit_points[commit_points_index].length(), match.length() - max_breakpoint_position);
+  EmplaceSafe

[Lldb-commits] [PATCH] D73314: [lldb/Commands] Make column available through _regexp-break

2020-01-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG223a209027b4: [lldb/Commands] Make column available through 
_regexp-break (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73314/new/

https://reviews.llvm.org/D73314

Files:
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/test/Shell/Commands/command-breakpoint-col.test


Index: lldb/test/Shell/Commands/command-breakpoint-col.test
===
--- lldb/test/Shell/Commands/command-breakpoint-col.test
+++ lldb/test/Shell/Commands/command-breakpoint-col.test
@@ -1,7 +1,10 @@
 # UNSUPPORTED: system-windows
 #
 # RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
-# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 
21' %t.out | FileCheck %s
-# CHECK: -u  ( --column  )
-# CHECK: Specifies the column number on which to set this breakpoint.
+# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 
21' %t.out | FileCheck %s --check-prefix HELP --check-prefix CHECK
+# RUN: %lldb -b -o 'help _regexp-break' -o 'b main.c:2:21' %t.out | FileCheck 
%s --check-prefix HELP-REGEX --check-prefix CHECK
+# HELP: -u  ( --column  )
+# HELP: Specifies the column number on which to set this breakpoint.
+# HELP-REGEX: _regexp-break ::
+# HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c
 # CHECK: at main.c:2:21
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -500,7 +500,10 @@
   m_command_dict["language"] =
   CommandObjectSP(new CommandObjectLanguage(*this));
 
+  // clang-format off
   const char *break_regexes[][2] = {
+  
{"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
+   "breakpoint set --file '%1' --line %2 --column %3"},
   {"^(.*[^[:space:]])[[:space:]]*:[[:space:]]*([[:digit:]]+)[[:space:]]*$",
"breakpoint set --file '%1' --line %2"},
   {"^/([^/]+)/$", "breakpoint set --source-pattern-regexp '%1'"},
@@ -515,6 +518,7 @@
"breakpoint set --name '%1' --skip-prologue=0"},
   {"^[\"']?(.*[^[:space:]\"'])[\"']?[[:space:]]*$",
"breakpoint set --name '%1'"}};
+  // clang-format on
 
   size_t num_regexes = llvm::array_lengthof(break_regexes);
 
@@ -523,6 +527,9 @@
   *this, "_regexp-break",
   "Set a breakpoint using one of several shorthand formats.",
   "\n"
+  "_regexp-break ::\n"
+  "  main.c:12:21  // Break at line 12 and column "
+  "21 of main.c\n\n"
   "_regexp-break :\n"
   "  main.c:12 // Break at line 12 of "
   "main.c\n\n"
@@ -546,7 +553,7 @@
   "current file\n"
   "// containing text 'break "
   "here'.\n",
-  2,
+  3,
   CommandCompletions::eSymbolCompletion |
   CommandCompletions::eSourceFileCompletion,
   false));
@@ -573,6 +580,9 @@
   *this, "_regexp-tbreak",
   "Set a one-shot breakpoint using one of several shorthand formats.",
   "\n"
+  "_regexp-break ::\n"
+  "  main.c:12:21  // Break at line 12 and column "
+  "21 of main.c\n\n"
   "_regexp-break :\n"
   "  main.c:12 // Break at line 12 of "
   "main.c\n\n"


Index: lldb/test/Shell/Commands/command-breakpoint-col.test
===
--- lldb/test/Shell/Commands/command-breakpoint-col.test
+++ lldb/test/Shell/Commands/command-breakpoint-col.test
@@ -1,7 +1,10 @@
 # UNSUPPORTED: system-windows
 #
 # RUN: %clang_host -g -O0 %S/Inputs/main.c -o %t.out
-# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s
-# CHECK: -u  ( --column  )
-# CHECK: Specifies the column number on which to set this breakpoint.
+# RUN: %lldb -b -o 'help breakpoint set' -o 'breakpoint set -f main.c -l 2 -u 21' %t.out | FileCheck %s --check-prefix HELP --check-prefix CHECK
+# RUN: %lldb -b -o 'help _regexp-break' -o 'b main.c:2:21' %t.out | FileCheck %s --check-prefix HELP-REGEX --check-prefix CHECK
+# HELP: -u  ( --column  )
+# HELP: Specifies the column number on which to set this breakpoint.
+# HELP-REGEX: _regexp-break ::
+# HELP-REGEX: main.c:12:21{{.*}}Break at line 12 and column 21 of main.c
 # CHECK: at main.c:2:21
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -500,7 +500,10 @@
   m_comman

[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240694.
diazhector98 added a comment.



1. Updating D73506 : Bug fix #
2. Enter a brief description of the changes included in this update.
3. The first line is used as subject, next lines as comment. #
4. If you intended to create a new revision, use:
5. $ arc diff --create

Brackets syntax


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < 
commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + 
commit_points[commit_points_index].length(), match.length() - 
max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -113,3 +113,23 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object.v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + commit_points[commit_points_index].length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+

[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240700.
diazhector98 added a comment.

Added more tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + commit_points[commit_points_index].length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -23,7 +23,7 @@
 self.assertFalse(not_expected_item in actual_list)
 
 @skipIfWindows
-@skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots
+#@skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots
 def test_completions(self):
 """
 Tests the completion request at different breakpoints
@@ -113,3 +113,43 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object.v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + v"),
+[
+{
+"text": "var1",
+"label": "var1 -- int &"
+}
+]
+)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240701.
diazhector98 added a comment.

Uncomment @skipIfDarwin


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + commit_points[commit_points_index].length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -113,3 +113,43 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object.v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + v"),
+[
+{
+"text": "var1",
+"label": "var1 -- int &"
+}
+]
+)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73506: Bug fix

2020-01-27 Thread walter erquinigo via Phabricator via lldb-commits
wallace added inline comments.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:960
+int commit_points_index = -1;
+for (uint32_t breakpoint_index = 0; breakpoint_index < 
commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);

int or size_t is fine


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506



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


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-27 Thread Paolo Severini via Phabricator via lldb-commits
paolosev updated this revision to Diff 240711.
paolosev added a comment.

In D72751#1841498 , @labath wrote:

> Thanks. I am glad that we were able to sort that out.
>
> Now that there's nothing wasm-specific in 
> `DynamicLoaderWasmDYLD::LoadModuleAtAddress`, I have another question. :)
>
> The code in that function is a subset of the base 
> `DynamicLoader::LoadModuleAtAddress` method you are overriding.  Is there a 
> reason for that?
>  It doesn't seem like the additional stuff in the base method should hurt 
> here. What the additional code does is that it tries to search for the object 
> file on the local filesystem, and if it finds it, it will use that instead of 
> copying the file over from the remote. In fact, that sounds like it could be 
> useful here too, as copying that much data over gdb-remote isn't particularly 
> fast..
>
> What do you think about that?


You are right! At this point `DynamicLoaderWasmDYLD::LoadModuleAtAddress` does 
not do anything specific to Wasm and there is no reason to override 
`DynamicLoader::LoadModuleAtAddress`. We can just call that base function, 
which should also work when the Wasm module is in the local filesystem.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72751/new/

https://reviews.llvm.org/D72751

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWasm.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/test_wasm.yaml
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/DynamicLoader/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
  lldb/tools/lldb-test/SystemInitializerTest.cpp

Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -37,6 +37,7 @@
 #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
 #include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
 #include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h"
+#include "Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h"
 #include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
 #include "Plugins/Instruction/PPC64/EmulateInstructionPPC64.h"
 #include "Plugins/InstrumentationRuntime/ASan/ASanRuntime.h"
@@ -246,6 +247,7 @@
   DynamicLoaderMacOSXDYLD::Initialize();
   DynamicLoaderMacOS::Initialize();
   DynamicLoaderPOSIXDYLD::Initialize();
+  wasm::DynamicLoaderWasmDYLD::Initialize();
   DynamicLoaderStatic::Initialize();
   DynamicLoaderWindowsDYLD::Initialize();
 
@@ -329,6 +331,7 @@
   DynamicLoaderMacOSXDYLD::Terminate();
   DynamicLoaderMacOS::Terminate();
   DynamicLoaderPOSIXDYLD::Terminate();
+  wasm::DynamicLoaderWasmDYLD::Terminate();
   DynamicLoaderStatic::Terminate();
   DynamicLoaderWindowsDYLD::Terminate();
 
Index: lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
===
--- lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
+++ lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
@@ -1,153 +1,151 @@
-//===-- ObjectFileWasm.h *- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_PLUGINS_OBJECTFILE_WASM_OBJECTFILEWASM_H
-#define LLDB_PLUGINS_OBJECTFILE_WASM_OBJECTFILEWASM_H
-
-#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Utility/ArchSpec.h"
-
-namespace lldb_private {
-namespace wasm {
-
-/// Generic Wasm object file reader.
-///
-/// This class provides a generic wasm32 reader plugin implementing the
-/// ObjectFile protocol.
-class ObjectFileWasm : public ObjectFile {
-public:
-  static void Initialize();
-  static void Terminate();
-
-  static ConstString GetPluginNameStatic();
-  static const char *GetPluginDescriptionStatic() {
-return "WebAssembly object file reader.";
-  }
-
-  static ObjectFile *
-  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
- lldb::offset_t data_offset, const FileSpec *file,
- lldb::offset_t file_offset, lldb::offset_t length);
-
-  static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,
-  lldb::DataBufferSP &data_sp,
-  const lldb::ProcessSP &process_sp,
-  

[Lldb-commits] [PATCH] D73506: Auto-completion bug fix for dot operator

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240715.
diazhector98 edited the summary of this revision.
diazhector98 added a comment.

int32 to int


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (int breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + commit_points[commit_points_index].length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -113,3 +113,43 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object.v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + v"),
+[
+{
+"text": "var1",
+"label": "var1 -- int &"
+}
+]
+)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73506: Auto-completion bug fix for dot operator

2020-01-27 Thread Héctor Luis Díaz Aceves via Phabricator via lldb-commits
diazhector98 updated this revision to Diff 240717.
diazhector98 marked an inline comment as done.
diazhector98 added a comment.

changed int to size_t to avoid warning


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73506/new/

https://reviews.llvm.org/D73506

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -951,9 +951,27 @@
   for (size_t i = 0; i < count; i++) {
 std::string match = matches.GetStringAtIndex(i);
 std::string description = descriptions.GetStringAtIndex(i);
-
+
 llvm::json::Object item;
-EmplaceSafeString(item, "text", match);
+
+std::vector commit_points = {".", "->"};
+int max_breakpoint_position = -1;
+int commit_points_index = -1;
+for (size_t breakpoint_index = 0; breakpoint_index < commit_points.size(); breakpoint_index++) {
+  int breakpoint_position = match.rfind(commit_points[breakpoint_index]);
+  if (max_breakpoint_position < breakpoint_position){
+commit_points_index = breakpoint_index;
+max_breakpoint_position = breakpoint_position;
+  }
+}
+
+if (max_breakpoint_position != -1) {
+  std::string cut_match = match.substr(max_breakpoint_position + commit_points[commit_points_index].length(), match.length() - max_breakpoint_position);
+  EmplaceSafeString(item, "text", cut_match);
+} else {
+  EmplaceSafeString(item, "text", match);
+}
+
 if (description.empty())
   EmplaceSafeString(item, "label", match);
 else
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
@@ -1,6 +1,17 @@
 #include 
 #include 
 
+struct bar {
+  int var1;
+};
+
+struct foo {
+  int var1;
+  bar* my_bar_pointer;
+  bar my_bar_object;
+  foo* next_foo;
+};
+
 int fun(std::vector var) {
   return var.size(); // breakpoint 1
 }
@@ -12,5 +23,8 @@
   std::string str2 = "b";
   std::vector vec;
   fun(vec);
+  bar bar1 = {2};
+  bar* bar2 = &bar1; 
+  foo foo1 = {3,&bar1, bar1, NULL};
   return 0; // breakpoint 2
 }
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -113,3 +113,43 @@
 }
 ],
 )
+
+self.verify_completions(
+self.vscode.get_completions("foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.my_bar_object.v"),
+[
+{
+"text": "var1",
+"label": "foo1.my_bar_object.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + foo1.v"),
+[
+{
+"text": "var1",
+"label": "foo1.var1 -- int"
+}
+]
+)
+
+self.verify_completions(
+self.vscode.get_completions("foo1.var1 + v"),
+[
+{
+"text": "var1",
+"label": "var1 -- int &"
+}
+]
+)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D72751: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-01-27 Thread Paolo Severini via Phabricator via lldb-commits
paolosev added a comment.

Comments inline...

>> In D72751#1835502 , @paolosev wrote:
>> 
>>> The first is that we need to call `Target::SetSectionLoadAddress()` twice, 
>>> from two different places. First we need to call 
>>> `Target::SetSectionLoadAddress()` in `ObjectFileWasm::SetLoadAddress()`, 
>>> and then again in `DynamicLoaderWasmDYLD::DidAttach()`. The reason for this 
>>> seems to originate in the sequence of function calls:
>>>
>>> In `DynamicLoaderWasmDYLD::DidAttach()` we call 
>>> `ProcessGDBRemote::LoadModules()` to get list of loaded modules from the 
>>> remote (Wasm engine).
>>>  `ProcessGDBRemote::LoadModules()` calls, first:
>>>
>>> - `DynamicLoaderWasmDYLD::LoadModuleAtAddress()` and from there: ...
>>>
>>>   then:
>>> - `Target::SetExecutableModule() -> Target::ClearModules() -> 
>>> SectionLoadList::Clear()`
>>>
>>>   So, at the end of `LoadModules()` in `DynamicLoaderWasmDYLD::DidAttach()` 
>>> the SectionLoadList is empty, and we need to set it again by calling 
>>> `Target::.SetSectionLoadAddress()` again. This works but the duplication is 
>>> ugly; is there a way to improve this?
>> 
>> 
>> I hope so. :) This seems like a bug in `ProcessGDBRemote::LoadModules`. It 
>> seems wrong/wasteful/etc to do all this work to compute the section load 
>> addresses only to have them be thrown away by `SetExecutableModule`. Maybe 
>> all it would take is to reverse the order of these two actions, so that the 
>> load addresses persist? Can you try something like that?
> 
> I would be interested to see if this helps as well.

The problem went away with the realization that `ObjectFileWasm` type should be 
`eTypeSharedLibrary`, not `eTypeExecutable`.
But more generically for `ProcessGDBRemote::LoadModules` I don't know if it 
would be easily possible to reverse the order of the calls to 
`DynamicLoader::LoadModuleAtAddress` and `Target::SetExecutableModule` given 
that the first creates the Module which is passed to the second. Maybe 
refactoring `DynamicLoader::LoadModuleAtAddress` so that it calls 
`Target::SetExecutableModule` just after `target.GetOrCreateModule` but before 
`UpdateLoadedSections`, but other DynamicLoader plugins could override this 
method...

>> I am also worried about the fact that `SymbolFileDWARF::CalculateAbilities` 
>> requires the module to be "loaded". That shouldn't be normally required. 
>> That function does a very basic check on some sections, and this should work 
>> fine without those sections having a "load address", even if they are 
>> actually being loaded from target memory. I think this means there are some 
>> additional places where ObjectFileWasm should use `m_memory_addr` instead of 
>> something else...
> 
> So a lot of these problems might go away if the modify the ObjectFileWASM to 
> "do the right thing" when the ObjectFile is from a live process. Object file 
> instances know if there are from a live process because the ObjectFile 
> members:
> 
>   lldb::ProcessWP m_process_wp;
>   const lldb::addr_t m_memory_addr;
>
> 
> Will be filled in. So the object file doesn't need to have its sections 
> loaded in a target in order to read section contents right? The object file 
> can be asked to read its section data via ObjectFile::ReadSectionData(...) (2 
> variants).
> 
> So Pavel is correct, the sections don't need to be loaded for anything in 
> SymbolFileDWARF::CalculateAbilities(...). The section list does need to be 
> created and available during SymbolFileDWARF::CalculateAbilities(...). We 
> just need to be able to get the section contents and poke around at the DWARF 
> bits.

Yes, this seems to be the case with the current implementation of 
ObjectFileWASM. It creates the section list in `ObjectFileWasm::SetLoadAddress` 
which calls `Target::SetSectionLoadAddress` but the sections don't need to be 
fully loaded, and during `SymbolFileDWARF::CalculateAbilities(...)` 
`ObjectFile::ReadSectionData` is called to load the necessary data.

>> 
>> 
>>> The second problem is that the Code Section needs to be initialized (in 
>>> `ObjectFileWasm::CreateSections()`) with `m_file_addr = m_file_offset = 0`, 
>>> and not with the actual file offset of the Code section in the Wasm file. 
>>> If we set `Section::m_file_addr` and `Section::m_file_offset` to the actual 
>>> code offset, the DWARF info does not work correctly.
>>> 
>>> I have some doubts regarding the DWARF data generated by Clang for a Wasm 
>>> target. Looking at an example, for a Wasm module that has the Code section 
>>> at offset 0x57, I see this DWARF data:
>>> 
>>>   0x000b: DW_TAG_compile_unit
>>> […]
>>> DW_AT_low_pc (0x)
>>> DW_AT_ranges (0x
>>>[0x0002, 0x000e)
>>>[0x000f, 0x001a)
>>>[0x001b, 0x0099)
>>>[0x009b, 0x011c))
>>> 
>>> 
>>> The documen

[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Abort StackFrame Recognizer

2020-01-27 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 9 inline comments as done.
mib added inline comments.



Comment at: lldb/docs/use/formatting.rst:137
 
+---+-+
-| ``thread.stop-reason``| A textual reason each 
thread stopped  


  |
+| ``thread.stop-reason``| A textual reason why the 
thread stopped. If the thread have a recognized frame, this displays its 
recognized stop reason. Otherwise, gets the stop info description.  

  |
++---+-+

JDevlieghere wrote:
> This change seems somewhat orthogonal to this patch. Is the abort recognizer 
> the only one where these two will be different? If not I would suggest 
> splitting this off into a separate patch.  
It wouldn't make sense to split this into different patches since I'm only 
changing the current `thread.stop-reason` in this one. And for users who still 
want the original behaviour, I added `thread.stop-reason-raw`.



Comment at: lldb/source/Target/AbortRecognizer.cpp:67
+  StringRef function_name;
+  std::tie(module_spec, function_name) = *assert_location;
+

JDevlieghere wrote:
> I like `std::tie` but I wonder if a struct with named fields wouldn't make 
> this more readable with less code. Saves you six lines in this function and 
> the next one in exchange for a 4-line struct definition. Anyway I'll leave 
> this up to you to decide. 
> 
> ```
> return lldb::RecognizedStackFrameSP(
>   new AbortRecognizedStackFrame(thread_sp, assert_location->module_spec, 
> assert_location->function_name));
> ```
> 
I changed the implementation so I'm only passing 1 parameter (the most relevant 
frame) to  the constructor.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303



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


[Lldb-commits] [PATCH] D73517: [lldb] Delete ValueObject::GetBaseClassPath

2020-01-27 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: teemperor, labath, clayborg, JDevlieghere.
Herald added a project: LLDB.

This method has exactly one call site, which is only actually executed
if `ValueObject::IsBaseClass` returns false. However, the first thing
that `ValueObject::GetBaseClassPath` does is check if `ValueObject::IsBaseClass`
is true. Because this can never be the case, this method always returns false
and is therefore effectively dead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73517

Files:
  lldb/include/lldb/Core/ValueObject.h
  lldb/source/Core/ValueObject.cpp


Index: lldb/source/Core/ValueObject.cpp
===
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -2013,23 +2013,6 @@
   return m_synthetic_value != nullptr;
 }
 
-bool ValueObject::GetBaseClassPath(Stream &s) {
-  if (IsBaseClass()) {
-bool parent_had_base_class =
-GetParent() && GetParent()->GetBaseClassPath(s);
-CompilerType compiler_type = GetCompilerType();
-llvm::Optional cxx_class_name =
-TypeSystemClang::GetCXXClassName(compiler_type);
-if (cxx_class_name) {
-  if (parent_had_base_class)
-s.PutCString("::");
-  s.PutCString(cxx_class_name.getValue());
-}
-return parent_had_base_class || cxx_class_name;
-  }
-  return false;
-}
-
 ValueObject *ValueObject::GetNonBaseClassParent() {
   if (GetParent()) {
 if (GetParent()->IsBaseClass())
@@ -2139,13 +2122,8 @@
   }
 
   const char *name = GetName().GetCString();
-  if (name) {
-if (qualify_cxx_base_classes) {
-  if (GetBaseClassPath(s))
-s.PutCString("::");
-}
+  if (name)
 s.PutCString(name);
-  }
 }
   }
 
Index: lldb/include/lldb/Core/ValueObject.h
===
--- lldb/include/lldb/Core/ValueObject.h
+++ lldb/include/lldb/Core/ValueObject.h
@@ -396,8 +396,6 @@
 
   bool IsIntegerType(bool &is_signed);
 
-  virtual bool GetBaseClassPath(Stream &s);
-
   virtual void GetExpressionPath(
   Stream &s, bool qualify_cxx_base_classes,
   GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers);


Index: lldb/source/Core/ValueObject.cpp
===
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -2013,23 +2013,6 @@
   return m_synthetic_value != nullptr;
 }
 
-bool ValueObject::GetBaseClassPath(Stream &s) {
-  if (IsBaseClass()) {
-bool parent_had_base_class =
-GetParent() && GetParent()->GetBaseClassPath(s);
-CompilerType compiler_type = GetCompilerType();
-llvm::Optional cxx_class_name =
-TypeSystemClang::GetCXXClassName(compiler_type);
-if (cxx_class_name) {
-  if (parent_had_base_class)
-s.PutCString("::");
-  s.PutCString(cxx_class_name.getValue());
-}
-return parent_had_base_class || cxx_class_name;
-  }
-  return false;
-}
-
 ValueObject *ValueObject::GetNonBaseClassParent() {
   if (GetParent()) {
 if (GetParent()->IsBaseClass())
@@ -2139,13 +2122,8 @@
   }
 
   const char *name = GetName().GetCString();
-  if (name) {
-if (qualify_cxx_base_classes) {
-  if (GetBaseClassPath(s))
-s.PutCString("::");
-}
+  if (name)
 s.PutCString(name);
-  }
 }
   }
 
Index: lldb/include/lldb/Core/ValueObject.h
===
--- lldb/include/lldb/Core/ValueObject.h
+++ lldb/include/lldb/Core/ValueObject.h
@@ -396,8 +396,6 @@
 
   bool IsIntegerType(bool &is_signed);
 
-  virtual bool GetBaseClassPath(Stream &s);
-
   virtual void GetExpressionPath(
   Stream &s, bool qualify_cxx_base_classes,
   GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73303: [lldb/Target] Add Assert StackFrame Recognizer

2020-01-27 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 240744.
mib marked 2 inline comments as done.
mib retitled this revision from "[lldb/Target] Add Abort StackFrame Recognizer" 
to "[lldb/Target] Add Assert StackFrame Recognizer".
mib edited the summary of this revision.
mib added a comment.

Renamed AbortRecognizer to AssertFrameRecognizer.

Moved the assert frame (aka most relevant frame) lookup from the 
AssertRecognizedStackFrame constructor to 
AssertFrameRecognizer::RecognizeFrame(), so if the assert frame is not found, 
only a base RecognizedStackFrame is returned.

Add doxygen comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73303/new/

https://reviews.llvm.org/D73303

Files:
  lldb/docs/use/formatting.rst
  lldb/include/lldb/Core/FormatEntity.h
  lldb/include/lldb/Target/AssertFrameRecognizer.h
  lldb/include/lldb/Target/StackFrameRecognizer.h
  lldb/include/lldb/Target/Thread.h
  
lldb/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
  lldb/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  lldb/source/API/SBThread.cpp
  lldb/source/Core/FormatEntity.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Target/AssertFrameRecognizer.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameRecognizer.cpp
  lldb/source/Target/Thread.cpp
  lldb/test/Shell/Recognizer/Inputs/assert.c
  lldb/test/Shell/Recognizer/assert.test

Index: lldb/test/Shell/Recognizer/assert.test
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/assert.test
@@ -0,0 +1,13 @@
+# UNSUPPORTED: system-windows
+# RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
+# RUN: %lldb -b -s %s %t.out | FileCheck %s
+run
+# CHECK: thread #{{.*}}stop reason = hit program assert
+frame info
+# CHECK: frame #{{.*}}`main at assert.c
+frame recognizer info 0
+# CHECK: frame 0 is recognized by Assert StackFrame Recognizer
+set set thread-format "{${thread.stop-reason-raw}}\n"
+thread info
+# CHECK: signal SIGABRT
+q
Index: lldb/test/Shell/Recognizer/Inputs/assert.c
===
--- /dev/null
+++ lldb/test/Shell/Recognizer/Inputs/assert.c
@@ -0,0 +1,9 @@
+#include 
+
+int main() {
+  int a = 42;
+  assert(a == 42);
+  a--;
+  assert(a == 42);
+  return 0;
+}
Index: lldb/source/Target/Thread.cpp
===
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -573,9 +573,64 @@
   m_state = state;
 }
 
+llvm::StringRef Thread::GetStopDescription() {
+  StackFrameSP frame_sp = GetStackFrameAtIndex(0);
+
+  if (!frame_sp)
+return GetStopDescriptionRaw();
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp)
+return GetStopDescriptionRaw();
+
+  llvm::StringRef recognized_stop_description =
+  recognized_frame_sp->GetStopDescription();
+
+  if (!recognized_stop_description.empty())
+return recognized_stop_description;
+
+  return GetStopDescriptionRaw();
+}
+
+llvm::StringRef Thread::GetStopDescriptionRaw() {
+  StopInfoSP stop_info_sp = GetStopInfo();
+  llvm::StringRef raw_stop_description;
+  if (stop_info_sp && stop_info_sp->IsValid())
+raw_stop_description = stop_info_sp->GetDescription();
+  return raw_stop_description;
+}
+
+void Thread::SelectMostRelevantFrame() {
+  Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD);
+
+  auto frames_list_sp = GetStackFrameList();
+
+  // Only the top frame should be recognized.
+  auto frame_sp = frames_list_sp->GetFrameAtIndex(0);
+
+  auto recognized_frame_sp = frame_sp->GetRecognizedFrame();
+
+  if (!recognized_frame_sp) {
+LLDB_LOG(log, "Frame #0 not recognized");
+return;
+  }
+
+  if (StackFrameSP most_relevant_frame_sp =
+  recognized_frame_sp->GetMostRelevantFrame()) {
+LLDB_LOG(log, "Found most relevant frame at index {0}",
+ most_relevant_frame_sp->GetFrameIndex());
+SetSelectedFrame(most_relevant_frame_sp.get());
+  } else {
+LLDB_LOG(log, "No relevant frame!");
+  }
+}
+
 void Thread::WillStop() {
   ThreadPlan *current_plan = GetCurrentPlan();
 
+  SelectMostRelevantFrame();
+
   // FIXME: I may decide to disallow threads with no plans.  In which
   // case this should go to an assert.
 
Index: lldb/source/Target/StackFrameRecognizer.cpp
===
--- lldb/source/Target/StackFrameRecognizer.cpp
+++ lldb/source/Target/StackFrameRecognizer.cpp
@@ -92,7 +92,7 @@
 
   StackFrameRecognizerSP GetRecognizerForFrame(StackFrameSP frame) {
 const SymbolContext &symctx =
-frame->GetSymbolContext(eSymbolContextModule | eSymbolContextFunction);
+frame->GetSymbolContext(eSymbolContextEverything);
 ConstString function_name = symctx.

[Lldb-commits] [PATCH] D73517: [lldb] Delete ValueObject::GetBaseClassPath

2020-01-27 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

Note: This makes D69820  unnecessary so I will 
close that if this goes through.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73517/new/

https://reviews.llvm.org/D73517



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


[Lldb-commits] [PATCH] D72946: [lldb] Remove ClangASTImporter reference from Target

2020-01-27 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 240762.
xiaobai added a comment.

Sort headers via clang-format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72946/new/

https://reviews.llvm.org/D72946

Files:
  lldb/include/lldb/Symbol/TypeSystemClang.h
  lldb/include/lldb/Target/Target.h
  lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
  lldb/source/Symbol/TypeSystemClang.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -37,7 +37,6 @@
 #include "lldb/Interpreter/OptionGroupWatchpoint.h"
 #include "lldb/Interpreter/OptionValues.h"
 #include "lldb/Interpreter/Property.h"
-#include "lldb/Symbol/ClangASTImporter.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
@@ -91,7 +90,7 @@
   m_mutex(), m_arch(target_arch), m_images(this), m_section_load_history(),
   m_breakpoint_list(false), m_internal_breakpoint_list(true),
   m_watchpoint_list(), m_process_sp(), m_search_filter_sp(),
-  m_image_search_paths(ImageSearchPathsChanged, this), m_ast_importer_sp(),
+  m_image_search_paths(ImageSearchPathsChanged, this),
   m_source_manager_up(), m_stop_hooks(), m_stop_hook_next_id(0),
   m_valid(true), m_suppress_stop_hooks(false),
   m_is_dummy_target(is_dummy_target),
@@ -1378,7 +1377,6 @@
   m_section_load_history.Clear();
   m_images.Clear();
   m_scratch_type_system_map.Clear();
-  m_ast_importer_sp.reset();
 }
 
 void Target::DidExec() {
@@ -2258,16 +2256,6 @@
   return utility_fn;
 }
 
-ClangASTImporterSP Target::GetClangASTImporter() {
-  if (m_valid) {
-if (!m_ast_importer_sp) {
-  m_ast_importer_sp = std::make_shared();
-}
-return m_ast_importer_sp;
-  }
-  return ClangASTImporterSP();
-}
-
 void Target::SettingsInitialize() { Process::SettingsInitialize(); }
 
 void Target::SettingsTerminate() { Process::SettingsTerminate(); }
Index: lldb/source/Symbol/TypeSystemClang.cpp
===
--- lldb/source/Symbol/TypeSystemClang.cpp
+++ lldb/source/Symbol/TypeSystemClang.cpp
@@ -9262,7 +9262,7 @@
   m_target_wp(target.shared_from_this()),
   m_persistent_variables(new ClangPersistentVariables) {
   m_scratch_ast_source_up.reset(new ClangASTSource(
-  target.shared_from_this(), target.GetClangASTImporter()));
+  target.shared_from_this(), m_persistent_variables->GetClangASTImporter()));
   m_scratch_ast_source_up->InstallASTContext(*this);
   llvm::IntrusiveRefCntPtr proxy_ast_source(
   m_scratch_ast_source_up->CreateProxy());
Index: lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -8,14 +8,14 @@
 
 #include "BlockPointer.h"
 
+#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/FormattersHelpers.h"
-#include "lldb/Symbol/TypeSystemClang.h"
 #include "lldb/Symbol/ClangASTImporter.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/TypeSystem.h"
+#include "lldb/Symbol/TypeSystemClang.h"
 #include "lldb/Target/Target.h"
-
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/Log.h"
 
@@ -56,7 +56,13 @@
   return;
 }
 
-ClangASTImporterSP clang_ast_importer = target_sp->GetClangASTImporter();
+lldb::ClangASTImporterSP clang_ast_importer;
+auto *state = target_sp->GetPersistentExpressionStateForLanguage(
+lldb::eLanguageTypeC_plus_plus);
+if (state) {
+  auto *persistent_vars = llvm::cast(state);
+  clang_ast_importer = persistent_vars->GetClangASTImporter();
+}
 
 if (!clang_ast_importer) {
   return;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -12,6 +12,7 @@
 #include "ClangExpressionDeclMap.h"
 #include "ClangExpressionParser.h"
 #include "ClangExpressionSourceCode.h"
+#include "ClangPersistentVariables.h"
 
 #include 
 #if HAVE_SYS_TYPES_H
@@ -159,7 +160,14 @@
 
 void ClangUtilityFunction::ClangUtilityFunctionHelper::ResetDeclMap(
 ExecutionContext &exe_ctx, bool keep_result_in_memory) {
-