[Lldb-commits] [PATCH] D70303: Fix TestFormatters.py stepping too far

2019-11-16 Thread Diana Picus via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5f0c3bad2f03: Fix TestFormatters.py stepping too far 
(authored by rovka).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70303

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
  lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp


Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
+++ lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
@@ -42,7 +42,7 @@
foo1.b.i = ;

int numbers[5] = {1,2,3,4,5};
-   
-   return 0;
-   
+
+   return 0; // Done initializing
+
 }
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
@@ -231,9 +231,8 @@
 0) == 122,
 '*a_ptr = 122')
 
-self.runCmd("n")
-self.runCmd("n")
-self.runCmd("n")
+ret = line_number("main.cpp", "Done initializing")
+self.runCmd("thread until " + str(ret))
 
 self.expect("frame variable numbers",
 substrs=['1', '2', '3', '4', '5'])


Index: lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
+++ lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
@@ -42,7 +42,7 @@
 	foo1.b.i = ;
 	
 	int numbers[5] = {1,2,3,4,5};
-	
-	return 0;
-	
+
+	return 0; // Done initializing
+
 }
Index: lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
+++ lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
@@ -231,9 +231,8 @@
 0) == 122,
 '*a_ptr = 122')
 
-self.runCmd("n")
-self.runCmd("n")
-self.runCmd("n")
+ret = line_number("main.cpp", "Done initializing")
+self.runCmd("thread until " + str(ret))
 
 self.expect("frame variable numbers",
 substrs=['1', '2', '3', '4', '5'])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70277: [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

As I said in the other discussion, though this is a (small) step in what I 
consider to be the right direction for this, it still seems like a workaround 
to me. But if everyone else is fine with that, then I won't stand in your way.

One thing I am not sure of is why you've chosen clang as the only recipient of 
the old SIGPIPE behavior. It seems like pretty much every non-interactive llvm 
utility would benefit from the previously-default SIGPIPE behavior. This is why 
I was talking about building this functionality into InitLLVM somehow -- one 
could make it so that InitLLVM installs the sigpipe handler by default, and 
lldb could pass some extra argument or something to disable that behavior.




Comment at: llvm/lib/Support/Unix/Signals.inc:328
 registerHandler(S, SignalKind::IsKill);
+  if (OneShotPipeSignalFunction)
+registerHandler(SIGPIPE, SignalKind::IsKill);

This bit is tricky. It means that `SetOneShotPipeSignalFunction` will take 
effect only if it is called before we install any signal handlers. Calling it 
later will not cause the handler to be installed. However, if one does set a 
handler function before signals are installed, then it is possible to change it 
with `SetOneShotPipeSignalFunction`. This makes its behavior a lot more complex 
than `SetInfoSignalFunction`, which it tries to emulate.


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

https://reviews.llvm.org/D70277



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


[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:37-38
+
+# Run help for different commands for escape variants to make sure each
+# one matches uniquely (the buffer isn't cleared in between matches).
+cases = [

rupprecht wrote:
> labath wrote:
> > The buffer isn't exactly "cleared", but each "expect" command should only 
> > match from the end of the previous match, so repeating the same command 
> > should not be a problem. What the other (few) pexpect tests do is put an 
> > `self.expect_prompt()` to ensure all output from the previous command is 
> > ignored, and lldb is ready to receive a new command. You could do that too. 
> > In fact, you could probably use the helper "expect" command which does all 
> > of this for you:
> > `self.expect("el ommand{L}c{L}{L}h{R}p".format(...), substrs=["Syntax: 
> > command"])`
> The expect helper is nice, thanks!
> 
> > but each "expect" command should only match from the end of the previous 
> > match
> I am not able to reproduce that. If I change the expect to the static string 
> `"Syntax: print"` (not `% cmd`), then the second case (which types `"help 
> step"`) passes. Which implies it's checking the entire buffer.
> 
> The third case (`"help exit"`) fails because the buffer does not contain the 
> `print` help text anymore. But that means this behavior is dependent on the 
> relation between help text length and buffer size. For now, I'll leave this 
> as separate help commands.
That's very odd. It's definitely not how things behave on my end (the second 
check fails straight away), and it's not clear to me why would that differ for 
you. Looking at the code, it's pretty obvious 

 that pexpect intends to reset the internal buffer to include only the text 
after the last match.

I'd like to get to the bottom of this. Can you dig around (maybe step through 
the pexpect code) to see what's happening in your case? One thing that's been 
causing confusion in the past was the leftover 
`third_party/Python/module/pexpect-2.X` folder from the time before we updated 
pexpect. However, I find it unlikely that this would be the case here, as this 
should have been the pexpect behavior since forever...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [lldb] 5f0c3ba - Fix TestFormatters.py stepping too far

2019-11-16 Thread Diana Picus via lldb-commits

Author: Diana Picus
Date: 2019-11-15T14:20:25+01:00
New Revision: 5f0c3bad2f03b9bba7f899d7b0ce667ca355f69d

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

LOG: Fix TestFormatters.py stepping too far

TestFormatters.py has a sequence of three 'next' commands to get past
all the initializations in the test function. On AArch64 (and
potentially other platforms), this was one 'next' too many and we ended
up outside our frame.

This patch replaces the sequence with a 'thread until ' the line of the
return from the function, so we should stop after all the
initializations but before actually returning.

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

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
index 011dabce6e9d..4d86ac5daa68 100644
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
@@ -231,9 +231,8 @@ def cleanup():
 0) == 122,
 '*a_ptr = 122')
 
-self.runCmd("n")
-self.runCmd("n")
-self.runCmd("n")
+ret = line_number("main.cpp", "Done initializing")
+self.runCmd("thread until " + str(ret))
 
 self.expect("frame variable numbers",
 substrs=['1', '2', '3', '4', '5'])

diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp 
b/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
index 1b8ce48041f9..4ca2504ff8cb 100644
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
@@ -42,7 +42,7 @@ int main(int argc, char** argv)
foo1.b.i = ;

int numbers[5] = {1,2,3,4,5};
-   
-   return 0;
-   
+
+   return 0; // Done initializing
+
 }



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


[Lldb-commits] [PATCH] D70303: Fix TestFormatters.py stepping too far

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Looks reasonable, but I'd suggest using something more unique for the 
breakpoint placement. Feel free to add some comment to the .cpp file and then 
search for that in python (that's what most of our other tests tend to do).


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

https://reviews.llvm.org/D70303



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


[Lldb-commits] [PATCH] D68179: [lldb] Fix JSON parser to allow empty arrays

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

I'm not sure whose approval are you waiting for, but this LGTM.


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

https://reviews.llvm.org/D68179



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


[Lldb-commits] [PATCH] D70303: Fix TestFormatters.py stepping too far

2019-11-16 Thread Diana Picus via Phabricator via lldb-commits
rovka updated this revision to Diff 229505.
rovka added a comment.

Addressed @labath's comment (test run in progress). Thanks for having a look!


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

https://reviews.llvm.org/D70303

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
  lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp


Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
+++ lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
@@ -42,7 +42,7 @@
foo1.b.i = ;

int numbers[5] = {1,2,3,4,5};
-   
-   return 0;
-   
+
+   return 0; // Done initializing
+
 }
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
@@ -231,9 +231,8 @@
 0) == 122,
 '*a_ptr = 122')
 
-self.runCmd("n")
-self.runCmd("n")
-self.runCmd("n")
+ret = line_number("main.cpp", "Done initializing")
+self.runCmd("thread until " + str(ret))
 
 self.expect("frame variable numbers",
 substrs=['1', '2', '3', '4', '5'])


Index: lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
+++ lldb/packages/Python/lldbsuite/test/commands/expression/formatters/main.cpp
@@ -42,7 +42,7 @@
 	foo1.b.i = ;
 	
 	int numbers[5] = {1,2,3,4,5};
-	
-	return 0;
-	
+
+	return 0; // Done initializing
+
 }
Index: lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
+++ lldb/packages/Python/lldbsuite/test/commands/expression/formatters/TestFormatters.py
@@ -231,9 +231,8 @@
 0) == 122,
 '*a_ptr = 122')
 
-self.runCmd("n")
-self.runCmd("n")
-self.runCmd("n")
+ret = line_number("main.cpp", "Done initializing")
+self.runCmd("thread until " + str(ret))
 
 self.expect("frame variable numbers",
 substrs=['1', '2', '3', '4', '5'])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70314: [lldb] Add better test commands for expression evaluation

2019-11-16 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: JDevlieghere, shafik, labath.
Herald added subscribers: lldb-commits, abidh, christof.
Herald added a project: LLDB.

This patch adds two new commands to lldbtest: `expect_expr` and 
`expect_simple_expr`. These commands
are supposed to replace the current approach of calling `expect`/`runCmd` with 
`frame var`, `expr`, `p`
(and `SBFrame.EvaluateExpression` in the future).

`expect_expr` allows evaluating expressions and matching their 
result/type/error message. It allows checking
the type/error message/result of both `frame var` and `expr` without having to 
parse the output of these
commands each time (or using hacks like `substrs=[" = 1\n"]` to match the 
value). It no longer allows unintended weak
type/value checks like we currently have with calling `self.expect` (e.g. this 
can semi-randomly pass when
the result variable was assigned `$1`: `self.expect("expr 3+4", 
substrs=["1"])`).

`expect_simple_expr` allows evaluating simple expressions like printing 
variables but is testing them more thoroughly
than we currently do (by for example running the expression multiple times and 
with both `frame var` and `expr`).
If we used this method we would have caught major regressions like the one 
fixed in D67803 .

Currently I just added the method to a few tests to demonstrate them. I'll 
migrate the rest of the test
suit over the next weeks because it's quite time intensive to rewrite all of 
this (and also because I already had some
tests that discovered bugs after I migrated them to `expect_simple_expr`).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70314

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/call-function/TestCallBuiltinFunction.py
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py

Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2366,6 +2366,121 @@
 self.assertTrue(matched if matching else not matched,
 msg if msg else EXP_MSG(str, output, exe))
 
+
+class ExpressionCommandType:
+EXPRESSION = object()
+FRAME_VAR = object()
+# FIXME: SBFRAME_EVALUATE
+
+def expect_expr(
+self,
+expr,
+result_value=None,
+result_type=None,
+error_msg=None,
+run_type=ExpressionCommandType.EXPRESSION
+):
+"""
+Evaluates the given expression with the expression command or optionally 'frame var'
+:param expr: The expression as a string.
+:param result_value: The value that the expression should have. None if the value should not be checked.
+:param result_type: The type that the expression result should have. None if the type should not be checked.
+:param error_msg: The error message the expression should return. None if the error output should not be checked.
+:param run_type: How the expression should be run.
+
+result_value, result_type and error_message can have the following types which influences how
+their values are compared to their respective output:
+  * A list of strings: expect_expr will search for the list of strings in the respective output.
+   The output is expected to contain these strings in the listed order.
+  * Any string type: expect_expr will assume that the respective output is equal to the given string.
+"""
+self.assertTrue(expr.strip() == expr, "Expression contains trailing/leading whitespace: '" + expr + "'")
+
+# Run the command and extract the output.
+if run_type in (self.ExpressionCommandType.FRAME_VAR,
+self.ExpressionCommandType.EXPRESSION):
+if run_type is self.ExpressionCommandType.EXPRESSION:
+run_cmd = "expr -- "
+elif run_type is self.ExpressionCommandType.FRAME_VAR:
+run_cmd = "frame var "
+else:
+self.assertTrue(False, "Shouldn't end up here: " + str(run_type))
+self.ci.HandleCommand(run_cmd + expr, self.res, False)
+err_out = self.res.GetError()
+out = self.res.GetOutput()
+success = self.res.Succeeded()
+# Both 'frame var' and 'expr' have results in the format:
+#   ()  = 
+# This extracts these parts out of these two commands.
+self.assertTrue(" = " in out, "No result in output: '" + out + "'")
+var, result = out.split(" = ", 1)
+var_name = var.split(" ")[-1]
+var_type = var[:-len(var_name)]
+
+# Turn '(type) 

[Lldb-commits] [PATCH] D70314: [lldb] Add better test commands for expression evaluation

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Semi-random idea: Instead of running the expression through the command line 
and then unpacking the result, should we just use the appropriate SBFrame api 
here (EvaluateExpression/GetValueForVariablePath)?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70314



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


[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-11-16 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

@omjavaid In the end I built a native `armv7l-unknown-linux-gnueabihf` lldb 
using:

  cmake ../llvm-monorepo/llvm/ -DCMAKE_BUILD_TYPE=Release  
-DLLVM_ENABLE_PROJECTS="lldb;clang;lld"  -DLLVM_ENABLE_ASSERTIONS=ON 
-DLLVM_BUILD_LLVM_DYLIB

Built it from trunk: `16bdcc809c72c639a2888b6b859dca88453e3c28`
But it does not stop even in a trivial breakpoint:

  $ echo 'int main(){}'|gcc -x c - -g;./bin/lldb -o 'b main' -o r ./a.out
  (lldb) target create "./a.out"
  Current executable set to 
'/home/fedora/jankratochvil/jkratoch/redhat/llvm-monorepo-clangassertdyn/a.out' 
(arm).
  (lldb) b main
  Breakpoint 1: where = a.out`main + 12 at :1:1, address = 0x000103dc
  (lldb) r
  Process 12146 exited with status = 0 (0x) 
  
  Process 12146 launched: 
'/home/fedora/jankratochvil/jkratoch/redhat/llvm-monorepo-clangassertdyn/a.out' 
(arm)
  (lldb) q

Are there some off-trunk patches needed?

  kernel-5.2.9-200.fc30.armv7hl


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63540



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


[Lldb-commits] [PATCH] D70272: [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

2019-11-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked 3 inline comments as done.
aprantl added inline comments.



Comment at: lldb/include/lldb/Symbol/SymbolFile.h:283-285
+  /// Return a hash for this symbol file, such as a dwo_id.
+  virtual llvm::Optional GetSymbolHash() { return {}; }
+  

labath wrote:
> Can we remove this and put a cast in 
> `SymbolFileDWARF::UpdateExternalModuleListIfNeeded` instead? It looks like 
> that function should check that it has really found a dwarf file (and not a 
> pdb for instance) anyway...
> Can we remove this and put a cast in 
> SymbolFileDWARF::UpdateExternalModuleListIfNeeded instead?

We don't have a mechanism to dynamic-cast between SymbolFiles at the moment and 
I think it's difficult to add one, since it's a base class of an open-ended 
plugin hierarchy. We could require all plugins to register in a global enum if 
we don't care about extensibility. I also thought about each class identifying 
itself via a string that is its class name, but then we couldn't implement 
casting to a base-class easily.

If you have any idea for how to do this elegantly I'm more than happy to 
implement it.

> It looks like that function should check that it has really found a dwarf 
> file (and not a pdb for instance) anyway...

Technically, yes, but you'd need DWARF that encodes the path of a PDB to get 
into that situation, so I'm not super concerned about this.


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

https://reviews.llvm.org/D70272



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


[Lldb-commits] [lldb] 3bc7119 - Comment the fact that DWARFDebugInfoEntry isn't copyable.

2019-11-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-15T09:14:48-08:00
New Revision: 3bc71193bd4f29ebb5e5baa11581909972265b4f

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

LOG: Comment the fact that DWARFDebugInfoEntry isn't copyable.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 25c885608d85..f3952ae9598b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -23,6 +23,10 @@ class DWARFDeclContext;
 
 #define DIE_SIBLING_IDX_BITSIZE 31
 
+/// DWARFDebugInfoEntry objects assume that they are living in one big
+/// vector and do pointer arithmetic on their this pointers. Don't
+/// pass them by value. Due to the way they are constructed in a
+/// std::vector, we cannot delete the copy constructor.
 class DWARFDebugInfoEntry {
 public:
   typedef std::vector collection;



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


[Lldb-commits] [PATCH] D70272: [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/include/lldb/Symbol/SymbolFile.h:283-285
+  /// Return a hash for this symbol file, such as a dwo_id.
+  virtual llvm::Optional GetSymbolHash() { return {}; }
+  

aprantl wrote:
> labath wrote:
> > Can we remove this and put a cast in 
> > `SymbolFileDWARF::UpdateExternalModuleListIfNeeded` instead? It looks like 
> > that function should check that it has really found a dwarf file (and not a 
> > pdb for instance) anyway...
> > Can we remove this and put a cast in 
> > SymbolFileDWARF::UpdateExternalModuleListIfNeeded instead?
> 
> We don't have a mechanism to dynamic-cast between SymbolFiles at the moment 
> and I think it's difficult to add one, since it's a base class of an 
> open-ended plugin hierarchy. We could require all plugins to register in a 
> global enum if we don't care about extensibility. I also thought about each 
> class identifying itself via a string that is its class name, but then we 
> couldn't implement casting to a base-class easily.
> 
> If you have any idea for how to do this elegantly I'm more than happy to 
> implement it.
> 
> > It looks like that function should check that it has really found a dwarf 
> > file (and not a pdb for instance) anyway...
> 
> Technically, yes, but you'd need DWARF that encodes the path of a PDB to get 
> into that situation, so I'm not super concerned about this.
> If you have any idea for how to do this elegantly I'm more than happy to 
> implement it.

I know at least of two ways of doing that:
- the "old" way. This is pretty similar to your string approach and involves 
doing something like:
```
if (symfile->GetPluginName() == SymbolFileDWARF::GetPluginNameStatic())
  static_cast(symfile)->stuff()
```
and probably doesn't require any extra coding (the presence of 
SymbolFileDWARFDebugMap makes things a bit complicated, but I don't think you 
need that here(?))
- for the new way, you can look at how we've implemented open-ended casting 
hierarchies in other plugins (last example here: D70070). This works with 
llvm::dyn_cast and everything. Not all plugins support that yet, but it is a 
direction we're going right now.


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

https://reviews.llvm.org/D70272



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


[Lldb-commits] [PATCH] D70314: [lldb] Add better test commands for expression evaluation

2019-11-16 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

In D70314#1747711 , @labath wrote:

> Semi-random idea: Instead of running the expression through the command line 
> and then unpacking the result, should we just use the appropriate SBFrame api 
> here (EvaluateExpression/GetValueForVariablePath)?


That's one of the APIs we need to test, but we need to test all of them to 
prevent regressions like D67803 . At least 
`frame var` and `expr` behave very differently (EvaluateExpression should be 
similar to `expr` but I never looked at that code path). So the idea is to have 
one command that tests all these APIs and if we can't do that (for example 
because the expression can't be repeated with the same result), at least make 
that safer/easier to do.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70314



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


[Lldb-commits] [PATCH] D70272: [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

2019-11-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked 2 inline comments as done.
aprantl added inline comments.



Comment at: lldb/source/Host/common/Host.cpp:300
   va_end(args);
+
+  // Log to log channel. This allows testcases to grep for log output.

jingham wrote:
> On macOS, SystemLog vsprintf's to stderr.  So you probably don't want to put 
> this out always.  Maybe since you don't know where SystemLog is going to 
> print things, it would be better to only output this if the log channel is 
> set to verbose.  That would still allow you to use it in tests, but wouldn't 
> introduce any new output in the normal case?
Turns out LIBLLDB has no VERBOSE channel, and I can't add one because all 32 
bits are already defined as channels. In the end this is probably not too bad — 
how many users are running with the host log enabled?

What do you think about making it either/or? It goes to the syslog by default 
and to the host log if it is enabled?


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

https://reviews.llvm.org/D70272



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


[Lldb-commits] [lldb] 81104ea - [CMake] Configure the Info.plist so it contains a real version number.

2019-11-16 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-15T09:50:42-08:00
New Revision: 81104ea9ab618219b608aec8bbcba54a3c470004

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

LOG: [CMake] Configure the Info.plist so it contains a real version number.

Use CMake to configure the Info.plist file so that we have a real
version number in things like crash reporter.

Added: 
lldb/tools/driver/lldb-Info.plist.in
lldb/tools/lldb-vscode/lldb-vscode-Info.plist.in

Modified: 
lldb/tools/driver/CMakeLists.txt
lldb/tools/lldb-vscode/CMakeLists.txt

Removed: 
lldb/tools/driver/lldb-Info.plist
lldb/tools/lldb-vscode/lldb-vscode-Info.plist



diff  --git a/lldb/tools/driver/CMakeLists.txt 
b/lldb/tools/driver/CMakeLists.txt
index fc10570f5b69..c31863b205ca 100644
--- a/lldb/tools/driver/CMakeLists.txt
+++ b/lldb/tools/driver/CMakeLists.txt
@@ -3,8 +3,12 @@ tablegen(LLVM Options.inc -gen-opt-parser-defs)
 add_public_tablegen_target(LLDBOptionsTableGen)
 
 if(APPLE)
+  configure_file(
+${CMAKE_CURRENT_SOURCE_DIR}/lldb-Info.plist.in
+${CMAKE_CURRENT_BINARY_DIR}/lldb-Info.plist
+)
   # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
-  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${LLDB_SOURCE_DIR}/tools/driver/lldb-Info.plist")
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-Info.plist")
 endif()
 
 add_lldb_tool(lldb

diff  --git a/lldb/tools/driver/lldb-Info.plist 
b/lldb/tools/driver/lldb-Info.plist.in
similarity index 94%
rename from lldb/tools/driver/lldb-Info.plist
rename to lldb/tools/driver/lldb-Info.plist.in
index 5a68a8b7adb5..a875129ef296 100644
--- a/lldb/tools/driver/lldb-Info.plist
+++ b/lldb/tools/driver/lldb-Info.plist.in
@@ -11,7 +11,7 @@
CFBundleName
lldb
CFBundleVersion
-   360.99.0
+   ${LLDB_VERSION}
SecTaskAccess

allowed

diff  --git a/lldb/tools/lldb-vscode/CMakeLists.txt 
b/lldb/tools/lldb-vscode/CMakeLists.txt
index 32cb55368dc2..b527addb6ba9 100644
--- a/lldb/tools/lldb-vscode/CMakeLists.txt
+++ b/lldb/tools/lldb-vscode/CMakeLists.txt
@@ -7,6 +7,16 @@ if (HAVE_LIBPTHREAD)
   list(APPEND extra_libs pthread)
 endif ()
 
+
+if(APPLE)
+  configure_file(
+${CMAKE_CURRENT_SOURCE_DIR}/lldb-vscode-Info.plist.in
+${CMAKE_CURRENT_BINARY_DIR}/lldb-vscode-Info.plist
+)
+  # Inline info plist in binary (use target_link_options for this as soon as 
CMake 3.13 is available)
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
-Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_CURRENT_BINARY_DIR}/lldb-vscode-Info.plist")
+endif()
+
 # We need to include the llvm components we depend on manually, as liblldb does
 # not re-export those.
 set(LLVM_LINK_COMPONENTS Support)

diff  --git a/lldb/tools/lldb-vscode/lldb-vscode-Info.plist 
b/lldb/tools/lldb-vscode/lldb-vscode-Info.plist.in
similarity index 94%
rename from lldb/tools/lldb-vscode/lldb-vscode-Info.plist
rename to lldb/tools/lldb-vscode/lldb-vscode-Info.plist.in
index a6b824372546..2098e190d6ba 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode-Info.plist
+++ b/lldb/tools/lldb-vscode/lldb-vscode-Info.plist.in
@@ -11,7 +11,7 @@
CFBundleName
lldb-vscode
CFBundleVersion
-   360.99.0
+   ${LLDB_VERSION}
SecTaskAccess

allowed



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


Re: [Lldb-commits] [PATCH] D70272: [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

2019-11-16 Thread Jim Ingham via lldb-commits
I'm not sure that's right.  LLDB_LOG_OPTION_VERBOSE is independent of the log 
channel, it's a basic feature of Log.h/cpp.  You test it with Log::GetVerbose.  
I know it works with the lldb channel because I hide a bunch of extra logging 
in the step & expr logs behind GetVerbose() == true.

Jim


> On Nov 15, 2019, at 9:29 AM, Adrian Prantl via Phabricator 
>  wrote:
> 
> aprantl marked 2 inline comments as done.
> aprantl added inline comments.
> 
> 
> 
> Comment at: lldb/source/Host/common/Host.cpp:300
>   va_end(args);
> +
> +  // Log to log channel. This allows testcases to grep for log output.
> 
> jingham wrote:
>> On macOS, SystemLog vsprintf's to stderr.  So you probably don't want to put 
>> this out always.  Maybe since you don't know where SystemLog is going to 
>> print things, it would be better to only output this if the log channel is 
>> set to verbose.  That would still allow you to use it in tests, but wouldn't 
>> introduce any new output in the normal case?
> Turns out LIBLLDB has no VERBOSE channel, and I can't add one because all 32 
> bits are already defined as channels. In the end this is probably not too bad 
> — how many users are running with the host log enabled?
> 
> What do you think about making it either/or? It goes to the syslog by default 
> and to the host log if it is enabled?
> 
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D70272/new/
> 
> https://reviews.llvm.org/D70272
> 
> 
> 

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


[Lldb-commits] [PATCH] D70322: Add RTTI support to SymbolFile

2019-11-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: labath, teemperor, jingham.

Thanks to Pavel for suggesting this and Raphael for helping me understand how 
this works.


https://reviews.llvm.org/D70322

Files:
  lldb/include/lldb/Expression/UserExpression.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  lldb/source/Symbol/SymbolFile.cpp

Index: lldb/source/Symbol/SymbolFile.cpp
===
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -24,6 +24,8 @@
 using namespace lldb_private;
 using namespace lldb;
 
+char SymbolFile::ID;
+
 void SymbolFile::PreloadSymbols() {
   // No-op for most implementations.
 }
Index: lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
===
--- lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -16,7 +16,18 @@
 #include "lldb/Symbol/Symtab.h"
 
 class SymbolFileSymtab : public lldb_private::SymbolFile {
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Constructors and Destructors
   SymbolFileSymtab(lldb::ObjectFileSP objfile_sp);
 
Index: lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
===
--- lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -25,6 +25,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+char SymbolFileSymtab::ID;
+
 void SymbolFileSymtab::Initialize() {
   PluginManager::RegisterPlugin(GetPluginNameStatic(),
 GetPluginDescriptionStatic(), CreateInstance);
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -22,7 +22,18 @@
 class PDBASTParser;
 
 class SymbolFilePDB : public lldb_private::SymbolFile {
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Static Functions
   static void Initialize();
 
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -58,6 +58,8 @@
 using namespace lldb_private;
 using namespace llvm::pdb;
 
+char SymbolFilePDB::ID;
+
 namespace {
 lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
   switch (lang) {
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -41,7 +41,18 @@
 class SymbolFileNativePDB : public SymbolFile {
   friend class UdtRecordCompleter;
 
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Static Functions
   static void Initialize();
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileN

[Lldb-commits] [PATCH] D70324: [lldb][test] Prevent \n in calls to lldb's expect() test helper.

2019-11-16 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added a reviewer: labath.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

expect() forwards its command to sendline(). This can be problematic if the 
command already contains a newline: sendline() unconditionally adds a newline 
to the command, which causes the command to run twice (hitting enter in lldb 
runs the previous command). The expect() helper looks for the prompt and finds 
the first one, but because the command has run a second time, the buffer will 
contain the contents of the second time the command ran, causing potential 
erroneous matching.

Simplify the editline test, which was using different commands to workaround 
this misunderstanding.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70324

Files:
  lldb/packages/Python/lldbsuite/test/lldbpexpect.py
  lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py


Index: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
===
--- lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
+++ lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -34,16 +34,13 @@
 """
 self.launch()
 
-# Run help for different commands for escape variants to make sure each
-# one matches uniquely (the buffer isn't cleared in between matches).
-cases = [
-("print", "\x1b[1;5D", "\x1b[1;5C"),
-("step", "\x1b[5D", "\x1b[5C"),
-("exit", "\x1b\x1b[D", "\x1b\x1b[C"),
+escape_pairs = [
+("\x1b[1;5D", "\x1b[1;5C"),
+("\x1b[5D", "\x1b[5C"),
+("\x1b\x1b[D", "\x1b\x1b[C"),
 ]
-for (cmd, l_escape, r_escape) in cases:
-self.expect("el {cmd_tail}{L}{cmd_head}{L}{L}h{R}p".format(
-cmd_head=cmd[0], cmd_tail=cmd[1:], L=l_escape, R=r_escape),
-substrs=["Syntax: %s" % cmd])
+for (l_escape, r_escape) in escape_pairs:
+self.expect("el rint{L}p{L}{L}h{R}p".format(
+L=l_escape, R=r_escape), substrs=["Syntax: print"])
 
 self.quit()
Index: lldb/packages/Python/lldbsuite/test/lldbpexpect.py
===
--- lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -50,6 +50,7 @@
 self.expect_prompt()
 
 def expect(self, cmd, substrs=None):
+self.assertNotIn('\n', cmd)
 self.child.sendline(cmd)
 if substrs is not None:
 for s in substrs:


Index: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
===
--- lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
+++ lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -34,16 +34,13 @@
 """
 self.launch()
 
-# Run help for different commands for escape variants to make sure each
-# one matches uniquely (the buffer isn't cleared in between matches).
-cases = [
-("print", "\x1b[1;5D", "\x1b[1;5C"),
-("step", "\x1b[5D", "\x1b[5C"),
-("exit", "\x1b\x1b[D", "\x1b\x1b[C"),
+escape_pairs = [
+("\x1b[1;5D", "\x1b[1;5C"),
+("\x1b[5D", "\x1b[5C"),
+("\x1b\x1b[D", "\x1b\x1b[C"),
 ]
-for (cmd, l_escape, r_escape) in cases:
-self.expect("el {cmd_tail}{L}{cmd_head}{L}{L}h{R}p".format(
-cmd_head=cmd[0], cmd_tail=cmd[1:], L=l_escape, R=r_escape),
-substrs=["Syntax: %s" % cmd])
+for (l_escape, r_escape) in escape_pairs:
+self.expect("el rint{L}p{L}{L}h{R}p".format(
+L=l_escape, R=r_escape), substrs=["Syntax: print"])
 
 self.quit()
Index: lldb/packages/Python/lldbsuite/test/lldbpexpect.py
===
--- lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -50,6 +50,7 @@
 self.expect_prompt()
 
 def expect(self, cmd, substrs=None):
+self.assertNotIn('\n', cmd)
 self.child.sendline(cmd)
 if substrs is not None:
 for s in substrs:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-16 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht marked 3 inline comments as done.
rupprecht added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:37-38
+
+# Run help for different commands for escape variants to make sure each
+# one matches uniquely (the buffer isn't cleared in between matches).
+cases = [

labath wrote:
> rupprecht wrote:
> > labath wrote:
> > > The buffer isn't exactly "cleared", but each "expect" command should only 
> > > match from the end of the previous match, so repeating the same command 
> > > should not be a problem. What the other (few) pexpect tests do is put an 
> > > `self.expect_prompt()` to ensure all output from the previous command is 
> > > ignored, and lldb is ready to receive a new command. You could do that 
> > > too. In fact, you could probably use the helper "expect" command which 
> > > does all of this for you:
> > > `self.expect("el ommand{L}c{L}{L}h{R}p".format(...), substrs=["Syntax: 
> > > command"])`
> > The expect helper is nice, thanks!
> > 
> > > but each "expect" command should only match from the end of the previous 
> > > match
> > I am not able to reproduce that. If I change the expect to the static 
> > string `"Syntax: print"` (not `% cmd`), then the second case (which types 
> > `"help step"`) passes. Which implies it's checking the entire buffer.
> > 
> > The third case (`"help exit"`) fails because the buffer does not contain 
> > the `print` help text anymore. But that means this behavior is dependent on 
> > the relation between help text length and buffer size. For now, I'll leave 
> > this as separate help commands.
> That's very odd. It's definitely not how things behave on my end (the second 
> check fails straight away), and it's not clear to me why would that differ 
> for you. Looking at the code, it's pretty obvious 
> 
>  that pexpect intends to reset the internal buffer to include only the text 
> after the last match.
> 
> I'd like to get to the bottom of this. Can you dig around (maybe step through 
> the pexpect code) to see what's happening in your case? One thing that's been 
> causing confusion in the past was the leftover 
> `third_party/Python/module/pexpect-2.X` folder from the time before we 
> updated pexpect. However, I find it unlikely that this would be the case 
> here, as this should have been the pexpect behavior since forever...
Figured out what was going on and mailed D70324 to prevent this from happening 
to the next person this bites -- which could be me :)

I originally had:

```
self.child.send("help command\n")
self.child.expect_exact("Syntax: command")
```

And based on your suggestion, changed it to:
```
self.expect("help command\n", substrs=["Syntax: command"])
```

Which is wrong, because `self.expect()` calls `self.child.sendline(cmd)`, so 
it's running `"help command\n\n"` == `"help command\nhelp command\n"`.
The `expect_prompt()` helper will match the first prompt it sees, so the second 
run of the command is still in the match buffer. Checking for "Syntax: command" 
would still pass even though it was not intentionally ran twice.

I also tried changing `expect_prompt()` to continuously match until the last 
prompt it sees, but it's simpler to just disallow `\n` in the command.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [PATCH] D70324: [lldb][test] Prevent \n in calls to lldb's expect() test helper.

2019-11-16 Thread pre-merge checks [bot] via Phabricator via lldb-commits
merge_guards_bot added a comment.

Build result: pass - 60084 tests passed, 0 failed and 729 were skipped.
Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324



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


[Lldb-commits] [PATCH] D70277: [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling

2019-11-16 Thread Vedant Kumar via Phabricator via lldb-commits
vsk updated this revision to Diff 229601.
vsk edited the summary of this revision.
vsk added a comment.

- Preserve the current behavior w.r.t SIGPIPE for all llvm-derived tools except 
lldb.
- Document the trickiness re: registering a SIGPIPE handler before llvm sets up 
its signal handlers.


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

https://reviews.llvm.org/D70277

Files:
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/lldb-server.cpp
  llvm/include/llvm/Support/InitLLVM.h
  llvm/include/llvm/Support/Signals.h
  llvm/lib/Support/InitLLVM.cpp
  llvm/lib/Support/Unix/Signals.inc
  llvm/lib/Support/Windows/Signals.inc

Index: llvm/lib/Support/Windows/Signals.inc
===
--- llvm/lib/Support/Windows/Signals.inc
+++ llvm/lib/Support/Windows/Signals.inc
@@ -560,6 +560,13 @@
   // Unimplemented.
 }
 
+void llvm::sys::SetOneShotPipeSignalFunction(void (*Handler)()) {
+  // Unimplemented.
+}
+
+void llvm::sys::DefaultOneShotPipeSignalHandler() {
+  // Unimplemented.
+}
 
 /// Add a function to be called when a signal is delivered to the process. The
 /// handler can have a cookie passed to it to identify what instance of the
Index: llvm/lib/Support/Unix/Signals.inc
===
--- llvm/lib/Support/Unix/Signals.inc
+++ llvm/lib/Support/Unix/Signals.inc
@@ -88,6 +88,9 @@
 ATOMIC_VAR_INIT(nullptr);
 static std::atomic InfoSignalFunction =
 ATOMIC_VAR_INIT(nullptr);
+/// The function to call on SIGPIPE (one-time use only).
+static std::atomic OneShotPipeSignalFunction =
+ATOMIC_VAR_INIT(nullptr);
 
 namespace {
 /// Signal-safe removal of files.
@@ -206,7 +209,7 @@
 /// if there is, it's not our direct responsibility. For whatever reason, our
 /// continued execution is no longer desirable.
 static const int IntSigs[] = {
-  SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR2
+  SIGHUP, SIGINT, SIGTERM, SIGUSR2
 };
 
 /// Signals that represent that we have a bug, and our prompt termination has
@@ -237,7 +240,7 @@
 
 static const size_t NumSigs =
 array_lengthof(IntSigs) + array_lengthof(KillSigs) +
-array_lengthof(InfoSigs);
+array_lengthof(InfoSigs) + 1 /* SIGPIPE */;
 
 
 static std::atomic NumRegisteredSignals = ATOMIC_VAR_INIT(0);
@@ -322,6 +325,8 @@
 registerHandler(S, SignalKind::IsKill);
   for (auto S : KillSigs)
 registerHandler(S, SignalKind::IsKill);
+  if (OneShotPipeSignalFunction)
+registerHandler(SIGPIPE, SignalKind::IsKill);
   for (auto S : InfoSigs)
 registerHandler(S, SignalKind::IsInfo);
 }
@@ -361,9 +366,10 @@
   if (auto OldInterruptFunction = InterruptFunction.exchange(nullptr))
 return OldInterruptFunction();
 
-  // Send a special return code that drivers can check for, from sysexits.h.
   if (Sig == SIGPIPE)
-exit(EX_IOERR);
+if (auto OldOneShotPipeFunction =
+OneShotPipeSignalFunction.exchange(nullptr))
+  return OldOneShotPipeFunction();
 
   raise(Sig);   // Execute the default handler.
   return;
@@ -403,6 +409,16 @@
   RegisterHandlers();
 }
 
+void llvm::sys::SetOneShotPipeSignalFunction(void (*Handler)()) {
+  OneShotPipeSignalFunction.exchange(Handler);
+  RegisterHandlers();
+}
+
+void llvm::sys::DefaultOneShotPipeSignalHandler() {
+  // Send a special return code that drivers can check for, from sysexits.h.
+  exit(EX_IOERR);
+}
+
 // The public API
 bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
std::string* ErrMsg) {
Index: llvm/lib/Support/InitLLVM.cpp
===
--- llvm/lib/Support/InitLLVM.cpp
+++ llvm/lib/Support/InitLLVM.cpp
@@ -21,7 +21,11 @@
 using namespace llvm;
 using namespace llvm::sys;
 
-InitLLVM::InitLLVM(int &Argc, const char **&Argv) : StackPrinter(Argc, Argv) {
+InitLLVM::InitLLVM(int &Argc, const char **&Argv,
+   bool InstallPipeSignalExitHandler)
+: StackPrinter(Argc, Argv) {
+  if (InstallPipeSignalExitHandler)
+sys::SetOneShotPipeSignalFunction(sys::DefaultOneShotPipeSignalHandler);
   sys::PrintStackTraceOnErrorSignal(Argv[0]);
   install_out_of_memory_new_handler();
 
Index: llvm/include/llvm/Support/Signals.h
===
--- llvm/include/llvm/Support/Signals.h
+++ llvm/include/llvm/Support/Signals.h
@@ -84,6 +84,28 @@
   /// function.  Note also that the handler may be executed on a different
   /// thread on some platforms.
   void SetInfoSignalFunction(void (*Handler)());
+
+  /// Registers a function to be called in a "one-shot" manner when a pipe
+  /// signal is delivered to the process (i.e., on a failed write to a pipe).
+  /// After the pipe signal is handled once, the handler is unregistered.
+  ///
+  /// The LLVM signal handling code will not install any handler for the pipe
+  /// signal unless one is provided with this 

[Lldb-commits] [PATCH] D70277: [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling

2019-11-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM if Pavel's happy :-)


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

https://reviews.llvm.org/D70277



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


[Lldb-commits] [PATCH] D69704: [lldb] Add IsDebugInfoCompatible method to SBModule to allow checking compatibility between language versions

2019-11-16 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor abandoned this revision.
teemperor added a comment.

Turns out this is actually not even used by anyone but was just (somehow?) 
added to the SBAPI in lldb-swift... Anyway, deleting this downstream...


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

https://reviews.llvm.org/D69704



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


[Lldb-commits] [lldb] 2f95b64 - Rename posix/FileSystem.cpp to FileSystemPosix.cpp

2019-11-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-15T11:48:46-08:00
New Revision: 2f95b6488bfa7197cae69f511066d84e926573ab

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

LOG: Rename posix/FileSystem.cpp to FileSystemPosix.cpp

to avoid a linker warning on Darwin about two files having the same name.

Added: 
lldb/source/Host/posix/FileSystemPosix.cpp

Modified: 
lldb/source/Host/CMakeLists.txt

Removed: 
lldb/source/Host/posix/FileSystem.cpp



diff  --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index aa409bf24c9b..ff849e2743dd 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -80,7 +80,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
 else()
   add_host_subdirectory(posix
 posix/DomainSocket.cpp
-posix/FileSystem.cpp
+posix/FileSystemPosix.cpp
 posix/HostInfoPosix.cpp
 posix/HostProcessPosix.cpp
 posix/HostThreadPosix.cpp

diff  --git a/lldb/source/Host/posix/FileSystem.cpp 
b/lldb/source/Host/posix/FileSystemPosix.cpp
similarity index 100%
rename from lldb/source/Host/posix/FileSystem.cpp
rename to lldb/source/Host/posix/FileSystemPosix.cpp



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


[Lldb-commits] [PATCH] D70322: Add RTTI support to SymbolFile

2019-11-16 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7d71dd928d1d: Add RTTI support to the SymbolFile class 
hierarchy (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70322

Files:
  lldb/include/lldb/Expression/UserExpression.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  lldb/source/Symbol/SymbolFile.cpp

Index: lldb/source/Symbol/SymbolFile.cpp
===
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -24,6 +24,8 @@
 using namespace lldb_private;
 using namespace lldb;
 
+char SymbolFile::ID;
+
 void SymbolFile::PreloadSymbols() {
   // No-op for most implementations.
 }
Index: lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
===
--- lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -16,7 +16,18 @@
 #include "lldb/Symbol/Symtab.h"
 
 class SymbolFileSymtab : public lldb_private::SymbolFile {
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Constructors and Destructors
   SymbolFileSymtab(lldb::ObjectFileSP objfile_sp);
 
Index: lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
===
--- lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -25,6 +25,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+char SymbolFileSymtab::ID;
+
 void SymbolFileSymtab::Initialize() {
   PluginManager::RegisterPlugin(GetPluginNameStatic(),
 GetPluginDescriptionStatic(), CreateInstance);
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -22,7 +22,18 @@
 class PDBASTParser;
 
 class SymbolFilePDB : public lldb_private::SymbolFile {
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Static Functions
   static void Initialize();
 
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -58,6 +58,8 @@
 using namespace lldb_private;
 using namespace llvm::pdb;
 
+char SymbolFilePDB::ID;
+
 namespace {
 lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
   switch (lang) {
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -41,7 +41,18 @@
 class SymbolFileNativePDB : public SymbolFile {
   friend class UdtRecordCompleter;
 
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Static Functions
   static void Initialize();
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFi

[Lldb-commits] [lldb] 7d71dd9 - Add RTTI support to the SymbolFile class hierarchy

2019-11-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-15T11:52:13-08:00
New Revision: 7d71dd928d1dcc838dc4dbe5cf294f557609f271

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

LOG: Add RTTI support to the SymbolFile class hierarchy

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

Added: 


Modified: 
lldb/include/lldb/Expression/UserExpression.h
lldb/include/lldb/Symbol/SymbolFile.h
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
lldb/source/Symbol/SymbolFile.cpp

Removed: 




diff  --git a/lldb/include/lldb/Expression/UserExpression.h 
b/lldb/include/lldb/Expression/UserExpression.h
index c669cac2974b..83122d8ba518 100644
--- a/lldb/include/lldb/Expression/UserExpression.h
+++ b/lldb/include/lldb/Expression/UserExpression.h
@@ -33,7 +33,7 @@ namespace lldb_private {
 /// implementations of UserExpression - which will be vended through the
 /// appropriate TypeSystem.
 class UserExpression : public Expression {
-  // LLVM RTTI support
+  /// LLVM RTTI support.
   static char ID;
 
 public:

diff  --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index 9c5e46b01634..2fb87962ea7c 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -33,7 +33,16 @@
 namespace lldb_private {
 
 class SymbolFile : public PluginInterface {
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Symbol file ability bits.
   //
   // Each symbol file can claim to support one or more symbol file abilities.

diff  --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index c77ddd378873..29d2e8a0c6a8 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -25,6 +25,8 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::breakpad;
 
+char SymbolFileBreakpad::ID;
+
 class SymbolFileBreakpad::LineIterator {
 public:
   // begin iterator for sections of given type

diff  --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
index 1748c6484ab9..de271224a65d 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -21,7 +21,18 @@ namespace lldb_private {
 namespace breakpad {
 
 class SymbolFileBreakpad : public SymbolFile {
+  /// LLVM RTTI support.
+  static char ID;
+
 public:
+  /// LLVM RTTI support.
+  /// \{
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+  /// \}
+
   // Static Functions
   static void Initialize();
   static void Terminate();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b61355376bf4..5b508181406d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -94,6 +94,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+char SymbolFileDWARF::ID;
+
 // static inline bool
 // child_requires_parent_class_union_or_struct_to_be_completed (dw_tag_t tag)
 //{

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index af9407fa6192..1b8633ad1f1f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lld

[Lldb-commits] [PATCH] D70272: [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

2019-11-16 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1cbe0038944a: [-gmodules] Let LLDB log a warning if the 
Clang module hash mismatches. (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D70272?vs=229400&id=229611#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70272

Files:
  lldb/include/lldb/Utility/Log.h
  lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/Makefile
  
lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/TestClangModulesHashMismatch.py
  lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/main.m
  lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/other.m
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/source/Host/common/Host.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -300,6 +300,9 @@
 
   virtual llvm::Optional GetDwoNum() { return llvm::None; }
 
+  /// If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
+  llvm::Optional GetDWOId();
+
   static bool
   DIEInDeclContext(const lldb_private::CompilerDeclContext *parent_decl_ctx,
const DWARFDIE &die);
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1555,6 +1555,40 @@
 return DWARFDIE();
 }
 
+/// Return the DW_AT_(GNU_)dwo_name.
+static const char *GetDWOName(DWARFCompileUnit &dwarf_cu,
+  const DWARFDebugInfoEntry &cu_die) {
+  const char *dwo_name =
+  cu_die.GetAttributeValueAsString(&dwarf_cu, DW_AT_GNU_dwo_name, nullptr);
+  if (!dwo_name)
+dwo_name =
+cu_die.GetAttributeValueAsString(&dwarf_cu, DW_AT_dwo_name, nullptr);
+  return dwo_name;
+}
+
+/// Return the DW_AT_(GNU_)dwo_id.
+/// FIXME: Technically 0 is a valid hash.
+static uint64_t GetDWOId(DWARFCompileUnit &dwarf_cu,
+ const DWARFDebugInfoEntry &cu_die) {
+  uint64_t dwo_id =
+  cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_GNU_dwo_id, 0);
+  if (!dwo_id)
+dwo_id = cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_dwo_id, 0);
+  return dwo_id;
+}
+
+llvm::Optional SymbolFileDWARF::GetDWOId() {
+  if (GetNumCompileUnits() == 1) {
+if (auto comp_unit = GetCompileUnitAtIndex(0))
+  if (DWARFCompileUnit *cu = llvm::dyn_cast_or_null(
+  GetDWARFCompileUnit(comp_unit.get(
+if (DWARFDebugInfoEntry *cu_die = cu->DIE().GetDIE())
+  if (uint64_t dwo_id = ::GetDWOId(*cu, *cu_die))
+return dwo_id;
+  }
+  return {};
+}
+
 std::unique_ptr
 SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
 DWARFUnit &unit, const DWARFDebugInfoEntry &cu_die) {
@@ -1571,15 +1605,13 @@
   if (!dwarf_cu)
 return nullptr;
 
-  const char *dwo_name =
-  cu_die.GetAttributeValueAsString(dwarf_cu, DW_AT_GNU_dwo_name, nullptr);
+  const char *dwo_name = GetDWOName(*dwarf_cu, cu_die);
   if (!dwo_name)
 return nullptr;
 
   SymbolFileDWARFDwp *dwp_symfile = GetDwpSymbolFile();
   if (dwp_symfile) {
-uint64_t dwo_id =
-cu_die.GetAttributeValueAsUnsigned(dwarf_cu, DW_AT_GNU_dwo_id, 0);
+uint64_t dwo_id = ::GetDWOId(*dwarf_cu, cu_die);
 std::unique_ptr dwo_symfile =
 dwp_symfile->GetSymbolFileForDwoId(*dwarf_cu, dwo_id);
 if (dwo_symfile)
@@ -1619,15 +1651,18 @@
   if (m_fetched_external_modules)
 return;
   m_fetched_external_modules = true;
-
   DWARFDebugInfo *debug_info = DebugInfo();
 
   // Follow DWO skeleton unit breadcrumbs.
   const uint32_t num_compile_units = GetNumCompileUnits();
   for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
-DWARFUnit *dwarf_cu = debug_info->GetUnitAtIndex(cu_idx);
+auto *dwarf_cu =
+llvm::dyn_cast(debug_info->GetUnitAtIndex(cu_idx));
+if (!dwarf_cu)
+  continue;
+
 const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly();
-if (!die || die.HasChildren())
+if (!die || die.HasChildren() || !die.GetDIE())
   continue;
 
 const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr);
@@ -1639,10 +1674,7 @@
 if (module_sp)
   continue;
 
-const char *dwo_path =
-die.GetAttributeValueAsString(DW_AT_GNU_dwo_name, nullptr);
-if (!dwo_path)
-  dwo_path = die.GetAttributeValueAsString(DW_AT_dwo_name, nullptr);
+const char *dwo_path = GetDWOName(*dwarf_cu, *die.GetDIE());
 if 

[Lldb-commits] [lldb] 1cbe003 - [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

2019-11-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-15T11:52:13-08:00
New Revision: 1cbe0038944a39ba79078997f9c65ba8abf6fbdd

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

LOG: [-gmodules] Let LLDB log a warning if the Clang module hash mismatches.

This feature is mostly there to aid debugging of Clang module issues,
since the only useful actual the end-user can to is to recompile their
program.

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

Added: 
lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/Makefile

lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/TestClangModulesHashMismatch.py
lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/main.m
lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/other.m

Modified: 
lldb/include/lldb/Utility/Log.h
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/source/Host/common/Host.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Removed: 




diff  --git a/lldb/include/lldb/Utility/Log.h b/lldb/include/lldb/Utility/Log.h
index 09c0f6954478..01edec044565 100644
--- a/lldb/include/lldb/Utility/Log.h
+++ b/lldb/include/lldb/Utility/Log.h
@@ -166,10 +166,10 @@ class Log final {
 
   bool GetVerbose() const;
 
-private:
   void VAPrintf(const char *format, va_list args);
   void VAError(const char *format, va_list args);
 
+private:
   Channel &m_channel;
 
   // The mutex makes sure enable/disable operations are thread-safe. The

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/Makefile 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/Makefile
new file mode 100644
index ..59bf009f6867
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/Makefile
@@ -0,0 +1,16 @@
+OBJC_SOURCES := main.m
+CFLAGS_EXTRAS = -I$(BUILDDIR)
+USE_PRIVATE_MODULE_CACHE = YES
+
+.PHONY: update-module
+
+all: $(EXE)
+   $(MAKE) -f $(SRCDIR)/Makefile update-module
+
+include Makefile.rules
+
+update-module:
+   echo "forcing an update of f.pcm"
+   echo "typedef int something_other;" > $(BUILDDIR)/f.h
+   $(CC) $(CFLAGS) $(MANDATORY_MODULE_BUILD_CFLAGS) \
+   -c $(SRCDIR)/other.m -o $(BUILDDIR)/other.o

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/TestClangModulesHashMismatch.py
 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/TestClangModulesHashMismatch.py
new file mode 100644
index ..298e26ee400d
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/TestClangModulesHashMismatch.py
@@ -0,0 +1,49 @@
+from __future__ import print_function
+
+import unittest2
+import os
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestClangModuleHashMismatch(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+@skipUnlessDarwin
+@skipIf(debug_info=no_match(["gmodules"]))
+def test_expr(self):
+with open(self.getBuildArtifact("module.modulemap"), "w") as f:
+f.write("""
+module Foo { header "f.h" }
+""")
+with open(self.getBuildArtifact("f.h"), "w") as f:
+f.write("""
+typedef int my_int;
+void f() {}
+""")
+
+mod_cache = self.getBuildArtifact("private-module-cache")
+if os.path.isdir(mod_cache):
+  shutil.rmtree(mod_cache)
+self.build()
+self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
+
+logfile = self.getBuildArtifact("host.log")
+self.runCmd("log enable -v -f %s lldb host" % logfile)
+target, _, _, _ = lldbutil.run_to_source_breakpoint(
+self, "break here", lldb.SBFileSpec("main.m"))
+target.GetModuleAtIndex(0).FindTypes('my_int') 
+
+found = False
+with open(logfile, 'r') as f:
+for line in f:
+if "hash mismatch" in line and "Foo" in line:
+found = True
+self.assertTrue(found)

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/main.m 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/main.m
new file mode 100644
index ..5065222731ea
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-hash-mismatch/main.m
@@ -0,0 +1,6 @@
+#include "f.h"
+int main(int argc, char **argv) {
+  my_int i = argc;
+  f(); // break h

[Lldb-commits] [PATCH] D70335: [lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

2019-11-16 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: krytarowski, labath.
Herald added a reviewer: jfb.
Herald added a subscriber: jfb.

https://reviews.llvm.org/D70335

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteTwoThreadsInvCont.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py

Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
@@ -30,6 +30,7 @@
 self.assertEqual(expected_name, kv_dict.get("name"))
 
 @skipIfWindows # the test is not updated for Windows.
+@skipIfNetBSD # build failure due to pthread_setname_np prototype
 @llgs_test
 def test(self):
 """ Make sure lldb-server can retrieve inferior thread name"""
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
@@ -82,6 +82,7 @@
 self.expect_exit_code(len(signals_to_ignore))
 
 @skipIfWindows # no signal support
+@expectedFailureNetBSD
 @llgs_test
 def test_default_signals_behavior(self):
 self.init_llgs_test()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
@@ -138,6 +138,7 @@
 self.assertEqual(
 ['0x727476787a7c7e71', '0x737577797b7d7f70'], get_reg_value('xmm15'))
 
+@expectedFailureNetBSD
 @llgs_test
 def test_g_returns_correct_data_with_suffix_llgs(self):
 self.init_llgs_test()
@@ -145,6 +146,7 @@
 self.set_inferior_startup_launch()
 self.g_returns_correct_data(True)
 
+@expectedFailureNetBSD
 @llgs_test
 def test_g_returns_correct_data_no_suffix_llgs(self):
 self.init_llgs_test()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -113,18 +113,21 @@
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_well_formed(self):
 self.setup_test()
 self.libraries_svr4_well_formed()
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_load_addr(self):
 self.setup_test()
 self.libraries_svr4_has_correct_load_addr()
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_libs_present(self):
 self.setup_test()
 self.libraries_svr4_libs_present()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
@@ -164,6 +164,7 @@
 self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
 self.THREAD_COUNT)
 
+@expectedFailureNetBSD
 @llgs_test
 def test_qThreadStopInfo_only_reports_one_threa

[Lldb-commits] [PATCH] D70335: [lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

2019-11-16 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 229629.
mgorny added a comment.
Herald added a subscriber: dexonsmith.

Missed a few tests.


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

https://reviews.llvm.org/D70335

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteTwoThreadsInvCont.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py

Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
@@ -30,6 +30,7 @@
 self.assertEqual(expected_name, kv_dict.get("name"))
 
 @skipIfWindows # the test is not updated for Windows.
+@skipIfNetBSD # build failure due to pthread_setname_np prototype
 @llgs_test
 def test(self):
 """ Make sure lldb-server can retrieve inferior thread name"""
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
@@ -82,6 +82,7 @@
 self.expect_exit_code(len(signals_to_ignore))
 
 @skipIfWindows # no signal support
+@expectedFailureNetBSD
 @llgs_test
 def test_default_signals_behavior(self):
 self.init_llgs_test()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
@@ -138,6 +138,7 @@
 self.assertEqual(
 ['0x727476787a7c7e71', '0x737577797b7d7f70'], get_reg_value('xmm15'))
 
+@expectedFailureNetBSD
 @llgs_test
 def test_g_returns_correct_data_with_suffix_llgs(self):
 self.init_llgs_test()
@@ -145,6 +146,7 @@
 self.set_inferior_startup_launch()
 self.g_returns_correct_data(True)
 
+@expectedFailureNetBSD
 @llgs_test
 def test_g_returns_correct_data_no_suffix_llgs(self):
 self.init_llgs_test()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -113,18 +113,21 @@
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_well_formed(self):
 self.setup_test()
 self.libraries_svr4_well_formed()
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_load_addr(self):
 self.setup_test()
 self.libraries_svr4_has_correct_load_addr()
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_libs_present(self):
 self.setup_test()
 self.libraries_svr4_libs_present()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
@@ -125,6 +125,7 @@
 self.qThreadStopInfo_works_for_multiple_threads(self.T

[Lldb-commits] [PATCH] D70252: [Docs] Add Python caveats under the development section

2019-11-16 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/docs/resources/caveats.rst:34
+with Xcode links against the Python that's part of Xcode. You should always use
+the system's Python interpreter to import the lldb module or install packages.

That 's confusingly worded... is `the Python that's part of Xcode` the same as 
`the system's Python interpreter`?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70252



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


[Lldb-commits] [lldb] a578adc - dotest: Add a way for the run_to_* helpers to register dylibs

2019-11-16 Thread Fred Riss via lldb-commits

Author: Fred Riss
Date: 2019-11-15T15:17:27-08:00
New Revision: a578adc1bc8e17b147ed5ef4794cd6f3f82b584b

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

LOG: dotest: Add a way for the run_to_* helpers to register dylibs

Summary:
To run the testsuite remotely the executable needs to be uploaded to
the target system. The Target takes care of this by default.

When the test uses additional shared libraries, those won't be handled
by default and need to be registered with the target using
test.registerSharedLibrariesWithTarget(target, dylib).

Calling this API requires a target, so it doesn't mesh well with the
run_to_* helpers that we've been advertising as the right way to write
tests.

This patch adds an extra_images argument to all the helpers and does
the registration automatically when running a remote
testsuite. TestWeakSymbols.py was converted to use this new scheme.

Reviewers: jingham

Subscribers: lldb-commits

Tags: #lldb

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

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
lldb/packages/Python/lldbsuite/test/lldbutil.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
index 2999cba7d99d..2b097e81ddfa 100644
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
@@ -49,17 +49,20 @@ def run_weak_var_check (self, weak_varname, present):
 
 def do_test(self):
 hidden_dir = os.path.join(self.getBuildDir(), "hidden")
-
+hidden_dylib = os.path.join(hidden_dir, "libdylib.dylib")
+
 launch_info = lldb.SBLaunchInfo(None)
 launch_info.SetWorkingDirectory(self.getBuildDir())
 # We have to point to the hidden directory to pick up the
 # version of the dylib without the weak symbols:
 env_expr = self.platformContext.shlib_environment_var + "=" + 
hidden_dir
 launch_info.SetEnvironmentEntries([env_expr], True)
-
-(self.target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
-
"Set a breakpoint here", self.main_source_file,
-
launch_info = launch_info)
+
+(self.target, _, thread, _) = lldbutil.run_to_source_breakpoint(
+  self, "Set a breakpoint here",
+  self.main_source_file,
+  launch_info = launch_info,
+  extra_images = [hidden_dylib])
 # First we have to import the Dylib module so we get the type info
 # for the weak symbol.  We need to add the source dir to the module
 # search paths, and then run @import to introduce it into the 
expression

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 5100dd596d0d..05d0c9f9d3e9 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -760,13 +760,18 @@ def run_to_breakpoint_make_target(test, exe_name = 
"a.out", in_cwd = True):
 test.assertTrue(target, "Target: %s is not valid."%(exe_name))
 return target
 
-def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None, 
only_one_thread = True):
+def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
+ only_one_thread = True, extra_images = None):
 
 # Launch the process, and do not stop at the entry point.
 if not launch_info:
 launch_info = lldb.SBLaunchInfo(None)
 launch_info.SetWorkingDirectory(test.get_process_working_directory())
 
+if extra_images and lldb.remote_platform:
+environ = test.registerSharedLibrariesWithTarget(target, extra_images)
+launch_info.SetEnvironmentEntries(environ, True)
+
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
@@ -791,7 +796,8 @@ def run_to_name_breakpoint (test, bkpt_name, launch_info = 
None,
 exe_name = "a.out",
 bkpt_module = None,
 in_cwd = True,
-only_one_thread = True):
+only_one_thread = True,
+extra_images = None):
 """Start up a target, 

[Lldb-commits] [PATCH] D70134: dotest: Add a way for the run_to_* helpers to register dylibs

2019-11-16 Thread Frederic Riss via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa578adc1bc8e: dotest: Add a way for the run_to_* helpers to 
register dylibs (authored by friss).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70134

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
  lldb/packages/Python/lldbsuite/test/lldbutil.py

Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -760,13 +760,18 @@
 test.assertTrue(target, "Target: %s is not valid."%(exe_name))
 return target
 
-def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None, only_one_thread = True):
+def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
+ only_one_thread = True, extra_images = None):
 
 # Launch the process, and do not stop at the entry point.
 if not launch_info:
 launch_info = lldb.SBLaunchInfo(None)
 launch_info.SetWorkingDirectory(test.get_process_working_directory())
 
+if extra_images and lldb.remote_platform:
+environ = test.registerSharedLibrariesWithTarget(target, extra_images)
+launch_info.SetEnvironmentEntries(environ, True)
+
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
@@ -791,7 +796,8 @@
 exe_name = "a.out",
 bkpt_module = None,
 in_cwd = True,
-only_one_thread = True):
+only_one_thread = True,
+extra_images = None):
 """Start up a target, using exe_name as the executable, and run it to
a breakpoint set by name on bkpt_name restricted to bkpt_module.
 
@@ -827,13 +833,15 @@
 
 test.assertTrue(breakpoint.GetNumLocations() > 0,
 "No locations found for name breakpoint: '%s'."%(bkpt_name))
-return run_to_breakpoint_do_run(test, target, breakpoint, launch_info, only_one_thread)
+return run_to_breakpoint_do_run(test, target, breakpoint, launch_info,
+only_one_thread, extra_images)
 
 def run_to_source_breakpoint(test, bkpt_pattern, source_spec,
  launch_info = None, exe_name = "a.out",
  bkpt_module = None,
  in_cwd = True,
- only_one_thread = True):
+ only_one_thread = True,
+ extra_images = None):
 """Start up a target, using exe_name as the executable, and run it to
a breakpoint set by source regex bkpt_pattern.
 
@@ -847,13 +855,15 @@
 test.assertTrue(breakpoint.GetNumLocations() > 0,
 'No locations found for source breakpoint: "%s", file: "%s", dir: "%s"'
 %(bkpt_pattern, source_spec.GetFilename(), source_spec.GetDirectory()))
-return run_to_breakpoint_do_run(test, target, breakpoint, launch_info, only_one_thread)
+return run_to_breakpoint_do_run(test, target, breakpoint, launch_info,
+only_one_thread, extra_images)
 
 def run_to_line_breakpoint(test, source_spec, line_number, column = 0,
launch_info = None, exe_name = "a.out",
bkpt_module = None,
in_cwd = True,
-   only_one_thread = True):
+   only_one_thread = True,
+   extra_images = None):
 """Start up a target, using exe_name as the executable, and run it to
a breakpoint set by (source_spec, line_number(, column)).
 
@@ -868,7 +878,8 @@
 'No locations found for line breakpoint: "%s:%d(:%d)", dir: "%s"'
 %(source_spec.GetFilename(), line_number, column,
   source_spec.GetDirectory()))
-return run_to_breakpoint_do_run(test, target, breakpoint, launch_info, only_one_thread)
+return run_to_breakpoint_do_run(test, target, breakpoint, launch_info,
+only_one_thread, extra_images)
 
 
 def continue_to_breakpoint(process, bkpt):
Index: lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
===
--- lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
+++ lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
@@ -49,17 +49,20 @@
 
 def do_test(self):
 hidden_dir = os.path.join(self.getBuildDir(), "hidden")
-
+hidden_dylib = os.path.join(hidden_dir, "libdylib.dylib")
+
 launch_info = lldb.SBLaunc

[Lldb-commits] [lldb] 0304360 - Add a testcase for Clang modules being updated within one LLDB session.

2019-11-16 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-15T16:27:14-08:00
New Revision: 0304360a40b45ffcbb040596d2a01733c0103455

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

LOG: Add a testcase for Clang modules being updated within one LLDB session.

This actually works as expected, but wasn't explicitly tested before.

Added: 
lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/Makefile

lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/TestClangModulesUpdate.py
lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/first.m

lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/module.modulemap
lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/second.m
lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/umbrella.h

Modified: 
lldb/source/Core/ModuleList.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/Makefile 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/Makefile
new file mode 100644
index ..5d0a2209ef72
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/Makefile
@@ -0,0 +1,3 @@
+CFLAGS_EXTRAS = -I$(BUILDDIR)
+USE_PRIVATE_MODULE_CACHE = YES
+include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/TestClangModulesUpdate.py
 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/TestClangModulesUpdate.py
new file mode 100644
index ..28e4fe46cb56
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/TestClangModulesUpdate.py
@@ -0,0 +1,69 @@
+from __future__ import print_function
+
+import unittest2
+import os
+import shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestClangModuleUpdate(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+@skipUnlessDarwin
+@skipIf(debug_info=no_match(["gmodules"]))
+def test_expr(self):
+with open(self.getBuildArtifact("module.modulemap"), "w") as f:
+f.write("""
+module Foo { header "f.h" }
+""")
+with open(self.getBuildArtifact("f.h"), "w") as f:
+f.write("""
+struct Q { int i; };
+void f() {}
+""")
+
+mod_cache = self.getBuildArtifact("private-module-cache")
+if os.path.isdir(mod_cache):
+  shutil.rmtree(mod_cache)
+d = {'OBJC_SOURCES': 'first.m'}
+self.build(dictionary=d)
+self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
+
+logfile = self.getBuildArtifact("modules.log")
+self.runCmd("log enable -f %s lldb module" % logfile)
+target, process, _, bkpt = lldbutil.run_to_name_breakpoint(self, 
"main")
+self.assertIn("int i", str(target.FindTypes('Q').GetTypeAtIndex(0)))
+self.expect("image list -g", patterns=[r'first\.o', r'Foo.*\.pcm'])
+
+# Update the module.
+with open(self.getBuildArtifact("f.h"), "w") as f:
+f.write("""
+struct S { int i; };
+struct S getS() { struct S r = {1}; return r; }
+void f() {}
+""")
+
+# Rebuild.
+d = {'OBJC_SOURCES': 'second.m'}
+self.build(dictionary=d)
+
+# Reattach.
+process.Kill()
+target, process, _, _ = lldbutil.run_to_breakpoint_do_run(self, 
target, bkpt)
+self.assertIn("int i", str(target.FindTypes('S').GetTypeAtIndex(0)))
+self.expect("image list -g", patterns=[r'second\.o', r'Foo.*\.pcm'])
+
+# Check log file.
+found = False
+with open(logfile, 'r') as f:
+for line in f:
+if "module changed" in line and "Foo" in line:
+found = True
+self.assertTrue(found)

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/first.m 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/first.m
new file mode 100644
index ..bcc458ffb8ef
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/first.m
@@ -0,0 +1,5 @@
+@import Umbrella;
+int main(int argc, char **argv) {
+  f(); // break here
+  return 0;
+}

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/module.modulemap 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/module.modulemap
new file mode 100644
index ..c142410cd07f
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-update/module.modulemap
@@ -0,0 +1,4 @

[Lldb-commits] [PATCH] D70252: [Docs] Add Python caveats under the development section

2019-11-16 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 229668.
JDevlieghere added a comment.

Address feedback


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

https://reviews.llvm.org/D70252

Files:
  lldb/docs/index.rst
  lldb/docs/resources/build.rst
  lldb/docs/resources/caveats.rst


Index: lldb/docs/resources/caveats.rst
===
--- /dev/null
+++ lldb/docs/resources/caveats.rst
@@ -0,0 +1,37 @@
+Caveats
+===
+
+.. contents::
+   :local:
+
+.. _python_caveat:
+
+Python
+--
+
+LLDB has a powerful scripting interface which is accessible through Python.
+Python is available either from withing LLDB through a (interactive) script
+interpreter, or as a Python module which you can import from the Python
+interpreter.
+
+To make this possible, LLDB links against the Python shared library. Linking
+against Python comes with some constraints to be aware of.
+
+1.  It is not possible to build and link LLDB against a Python 3 library and
+use it from Python 2 and vice versa.
+
+2.  It is not possible to build and link LLDB against one distribution on
+Python and use it through a interpreter coming from another distribution.
+For example, on macOS, if you build and link against Python from
+python.org, you cannot import the lldb module from the Python interpreter
+installed with Homebrew.
+
+3.  To use third party Python packages from inside LLDB, you need to install
+them using a utility (such as ``pip``) from the same Python distribution as
+the one used to build and link LLDB.
+
+The previous considerations are especially important during development, but
+apply to binary distributions of LLDB as well. For example, the LLDB that comes
+with Xcode links against the Python 3 that's part of Xcode. Therefore you
+should always use the Python in Xcode (through ``xcrun python3`` or
+``/usr/bin/python3``) to import the lldb module or install packages.
Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -533,6 +533,11 @@
 
   > python -c 'import lldb'
 
+
+Make sure you're using the Python interpreter that matches the Python library
+you linked against. For more details please refer to the :ref:`caveats
+`.
+
 .. _CodeSigning:
 
 Code Signing on macOS
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -144,6 +144,7 @@
resources/test
resources/bots
resources/sbapi
+   resources/caveats
 
 .. toctree::
:hidden:


Index: lldb/docs/resources/caveats.rst
===
--- /dev/null
+++ lldb/docs/resources/caveats.rst
@@ -0,0 +1,37 @@
+Caveats
+===
+
+.. contents::
+   :local:
+
+.. _python_caveat:
+
+Python
+--
+
+LLDB has a powerful scripting interface which is accessible through Python.
+Python is available either from withing LLDB through a (interactive) script
+interpreter, or as a Python module which you can import from the Python
+interpreter.
+
+To make this possible, LLDB links against the Python shared library. Linking
+against Python comes with some constraints to be aware of.
+
+1.  It is not possible to build and link LLDB against a Python 3 library and
+use it from Python 2 and vice versa.
+
+2.  It is not possible to build and link LLDB against one distribution on
+Python and use it through a interpreter coming from another distribution.
+For example, on macOS, if you build and link against Python from
+python.org, you cannot import the lldb module from the Python interpreter
+installed with Homebrew.
+
+3.  To use third party Python packages from inside LLDB, you need to install
+them using a utility (such as ``pip``) from the same Python distribution as
+the one used to build and link LLDB.
+
+The previous considerations are especially important during development, but
+apply to binary distributions of LLDB as well. For example, the LLDB that comes
+with Xcode links against the Python 3 that's part of Xcode. Therefore you
+should always use the Python in Xcode (through ``xcrun python3`` or
+``/usr/bin/python3``) to import the lldb module or install packages.
Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -533,6 +533,11 @@
 
   > python -c 'import lldb'
 
+
+Make sure you're using the Python interpreter that matches the Python library
+you linked against. For more details please refer to the :ref:`caveats
+`.
+
 .. _CodeSigning:
 
 Code Signing on macOS
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -144,6 +144,7 @@
resources/test
resources/bots
resourc

[Lldb-commits] [lldb] 4d23764 - Fix -Wunused-result warnings in LLDB

2019-11-16 Thread Reid Kleckner via lldb-commits

Author: Reid Kleckner
Date: 2019-11-15T16:38:00-08:00
New Revision: 4d23764dddc23e74ad165086d7f471a3e0e52bf8

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

LOG: Fix -Wunused-result warnings in LLDB

Three uses of try_lock intentionally ignore the result, as explained in
the comment. Make that explicit with a void cast.

Add what appears to be a missing return in the clang expression parser
code. It's a functional change, but presumably the right one.

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

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index 39b143022809..152549f8dd56 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -312,7 +312,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
   if (m_exe_ctx.GetTargetPtr())
 return m_exe_ctx.GetTargetPtr();
   else if (m_sym_ctx.target_sp)
-m_sym_ctx.target_sp.get();
+return m_sym_ctx.target_sp.get();
   return nullptr;
 }
 

diff  --git 
a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp 
b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index b777a5319104..5761b39f1115 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -166,7 +166,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList 
&old_thread_list,
   Target &target = m_process->GetTarget();
   std::unique_lock api_lock(target.GetAPIMutex(),
   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   LLDB_LOGF(log,
@@ -308,7 +308,7 @@ 
OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
   Target &target = m_process->GetTarget();
   std::unique_lock api_lock(target.GetAPIMutex(),
   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -395,7 +395,7 @@ lldb::ThreadSP 
OperatingSystemPython::CreateThread(lldb::tid_t tid,
 Target &target = m_process->GetTarget();
 std::unique_lock api_lock(target.GetAPIMutex(),
 std::defer_lock);
-api_lock.try_lock();
+(void)api_lock.try_lock(); // See above.
 auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
 StructuredData::DictionarySP thread_info_dict =



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


[Lldb-commits] [PATCH] D70281: Fix -Wunused-result warnings in LLDB

2019-11-16 Thread Reid Kleckner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4d23764dddc2: Fix -Wunused-result warnings in LLDB (authored 
by rnk).

Changed prior to commit:
  https://reviews.llvm.org/D70281?vs=229421&id=229667#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70281

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp


Index: lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
===
--- lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -166,7 +166,7 @@
   Target &target = m_process->GetTarget();
   std::unique_lock api_lock(target.GetAPIMutex(),
   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   LLDB_LOGF(log,
@@ -308,7 +308,7 @@
   Target &target = m_process->GetTarget();
   std::unique_lock api_lock(target.GetAPIMutex(),
   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -395,7 +395,7 @@
 Target &target = m_process->GetTarget();
 std::unique_lock api_lock(target.GetAPIMutex(),
 std::defer_lock);
-api_lock.try_lock();
+(void)api_lock.try_lock(); // See above.
 auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
 StructuredData::DictionarySP thread_info_dict =
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -312,7 +312,7 @@
   if (m_exe_ctx.GetTargetPtr())
 return m_exe_ctx.GetTargetPtr();
   else if (m_sym_ctx.target_sp)
-m_sym_ctx.target_sp.get();
+return m_sym_ctx.target_sp.get();
   return nullptr;
 }
 


Index: lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
===
--- lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -166,7 +166,7 @@
   Target &target = m_process->GetTarget();
   std::unique_lock api_lock(target.GetAPIMutex(),
   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   LLDB_LOGF(log,
@@ -308,7 +308,7 @@
   Target &target = m_process->GetTarget();
   std::unique_lock api_lock(target.GetAPIMutex(),
   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -395,7 +395,7 @@
 Target &target = m_process->GetTarget();
 std::unique_lock api_lock(target.GetAPIMutex(),
 std::defer_lock);
-api_lock.try_lock();
+(void)api_lock.try_lock(); // See above.
 auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
 StructuredData::DictionarySP thread_info_dict =
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -312,7 +312,7 @@
   if (m_exe_ctx.GetTargetPtr())
 return m_exe_ctx.GetTargetPtr();
   else if (m_sym_ctx.target_sp)
-m_sym_ctx.target_sp.get();
+return m_sym_ctx.target_sp.get();
   return nullptr;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 2c7c528 - [lldb-vscode] support the completion request

2019-11-16 Thread Walter Erquinigo via lldb-commits

Author: Walter Erquinigo
Date: 2019-11-15T17:37:55-08:00
New Revision: 2c7c528d7ac17230f1f239b629a02d407a74e1bf

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

LOG: [lldb-vscode] support the completion request

Summary:
The DAP has a completion request that has been unimplemented. It allows showing 
autocompletion tokens inside the Debug Console.
I implemented it in a very simple fashion mimicking what the user would see 
when autocompleting an expression inside the CLI.
There are two cases: normal variables and commands. The latter occurs when a 
text is prepepended with ` in the Debug Console.
These two cases work well and have tests.

Reviewers: clayborg, aadsm

Subscribers: lldb-commits

Tags: #lldb

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

Added: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/Makefile

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

Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py

lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/variables/TestVSCode_variables.py
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/Makefile 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/Makefile
new file mode 100644
index ..8b20bcb0
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
new file mode 100644
index ..4500a8093928
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
@@ -0,0 +1,117 @@
+"""
+Test lldb-vscode completions request
+"""
+
+from __future__ import print_function
+
+import lldbvscode_testcase
+import unittest2
+import vscode
+from lldbsuite.test import lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def verify_completions(self, actual_list, expected_list, 
not_expected_list=[]):
+for expected_item in expected_list:
+self.assertTrue(expected_item in actual_list)
+
+for not_expected_item in not_expected_list:
+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
+@no_debug_info_test
+def test_completions(self):
+"""
+Tests the completion request at 
diff erent breakpoints
+"""
+program = self.getBuildArtifact("a.out")
+self.build_and_launch(program)
+source = "main.cpp"
+breakpoint1_line = line_number(source, "// breakpoint 1")
+breakpoint2_line = line_number(source, "// breakpoint 2")
+breakpoint_ids = self.set_source_breakpoints(
+source, [breakpoint1_line, breakpoint2_line]
+)
+self.continue_to_next_stop()
+
+# shouldn't see variables inside main
+self.verify_completions(
+self.vscode.get_completions("var"),
+[
+{
+"text": "var",
+"label": "var -- vector, allocator >, allocator, allocator > > > &",
+}
+],
+[{"text": "var1", "label": "var1 -- int &"}],
+)
+
+# should see global keywords but not variables inside main
+self.verify_completions(
+self.vscode.get_completions("str"),
+[{"text": "struct", "label": "struct"}],
+[{"text": "str1", "label": "str1 -- std::string &"}],
+)
+
+self.continue_to_next_stop()
+
+# should see variables from main but not from the other function
+self.verify_completions(
+self.vscode.get_completions("var"),
+[
+{"text": "var1", "label": "var1 -- int &"},
+{"text": "var2", "label": "var2 -- int &"},
+],
+[
+{
+"text": "var",
+"label": "var -- vector, allocator >, allocator, allocator > > > &",
+}
+],
+)
+
+self

[Lldb-commits] [PATCH] D69873: [lldb-vscode] support the completion request

2019-11-16 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c7c528d7ac1: [lldb-vscode] support the completion request 
(authored by Walter Erquinigo ).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69873

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/Makefile
  
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/lldbvscode_testcase.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/variables/TestVSCode_variables.py
  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
@@ -821,6 +821,152 @@
   g_vsc.SendJSON(llvm::json::Value(std::move(response)));
 }
 
+// "CompletionsRequest": {
+//   "allOf": [ { "$ref": "#/definitions/Request" }, {
+// "type": "object",
+// "description": "Returns a list of possible completions for a given caret position and text.\nThe CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true.",
+// "properties": {
+//   "command": {
+// "type": "string",
+// "enum": [ "completions" ]
+//   },
+//   "arguments": {
+// "$ref": "#/definitions/CompletionsArguments"
+//   }
+// },
+// "required": [ "command", "arguments"  ]
+//   }]
+// },
+// "CompletionsArguments": {
+//   "type": "object",
+//   "description": "Arguments for 'completions' request.",
+//   "properties": {
+// "frameId": {
+//   "type": "integer",
+//   "description": "Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope."
+// },
+// "text": {
+//   "type": "string",
+//   "description": "One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion."
+// },
+// "column": {
+//   "type": "integer",
+//   "description": "The character position for which to determine the completion proposals."
+// },
+// "line": {
+//   "type": "integer",
+//   "description": "An optional line for which to determine the completion proposals. If missing the first line of the text is assumed."
+// }
+//   },
+//   "required": [ "text", "column" ]
+// },
+// "CompletionsResponse": {
+//   "allOf": [ { "$ref": "#/definitions/Response" }, {
+// "type": "object",
+// "description": "Response to 'completions' request.",
+// "properties": {
+//   "body": {
+// "type": "object",
+// "properties": {
+//   "targets": {
+// "type": "array",
+// "items": {
+//   "$ref": "#/definitions/CompletionItem"
+// },
+// "description": "The possible completions for ."
+//   }
+// },
+// "required": [ "targets" ]
+//   }
+// },
+// "required": [ "body" ]
+//   }]
+// },
+// "CompletionItem": {
+//   "type": "object",
+//   "description": "CompletionItems are the suggestions returned from the CompletionsRequest.",
+//   "properties": {
+// "label": {
+//   "type": "string",
+//   "description": "The label of this completion item. By default this is also the text that is inserted when selecting this completion."
+// },
+// "text": {
+//   "type": "string",
+//   "description": "If text is not falsy then it is inserted instead of the label."
+// },
+// "sortText": {
+//   "type": "string",
+//   "description": "A string that should be used when comparing this item with other items. When `falsy` the label is used."
+// },
+// "type": {
+//   "$ref": "#/definitions/CompletionItemType",
+//   "description": "The item's type. Typically the client uses this information to render the item in the UI with an icon."
+// },
+// "start": {
+//   "type": "integer",
+//   "description": "This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added.\nIf missing the text is added at the location specified by the CompletionsRequest's 'column' attribute."
+// },
+// "length": {
+//   "type": "integer",
+//   "description": "This value determines how many characters are overwritten by the completion text.\nIf missing the value 0 is assumed which results in the completion text being inserted."
+// }
+//   },
+//   "required": [ "label" ]
+// },
+// "CompletionItemType": {
+//   "type": "string",
+//   "descript

[Lldb-commits] [PATCH] D70335: [lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

2019-11-16 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

What's up with the new test (TestGdbRemoteTwoThreadsInvCont.py)? Is that ready 
for checkin or a mistake? Should it be in a separate patch?


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

https://reviews.llvm.org/D70335



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


[Lldb-commits] [lldb] 9b40a7f - Remove +x permission on some files

2019-11-16 Thread Sylvestre Ledru via lldb-commits

Author: Sylvestre Ledru
Date: 2019-11-16T14:47:20+01:00
New Revision: 9b40a7f3bf7198dd64403cbd83478087e72f994b

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

LOG: Remove +x permission on some files

Added: 


Modified: 
clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.h
clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h
clang/lib/StaticAnalyzer/Checkers/Yaml.h
clang/test/Modules/lsv-debuginfo.cpp

lldb/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/ParallelTask.cpp
openmp/runtime/test/ompt/callback.h

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
old mode 100755
new mode 100644

diff  --git a/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.h 
b/clang-tools-extra/clang-tidy/bugprone/ParentVirtualCallCheck.h
old mode 100755
new mode 100644

diff  --git 
a/clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h 
b/clang/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h
old mode 100755
new mode 100644

diff  --git a/clang/lib/StaticAnalyzer/Checkers/Yaml.h 
b/clang/lib/StaticAnalyzer/Checkers/Yaml.h
old mode 100755
new mode 100644

diff  --git a/clang/test/Modules/lsv-debuginfo.cpp 
b/clang/test/Modules/lsv-debuginfo.cpp
old mode 100755
new mode 100644

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/ParallelTask.cpp
 
b/lldb/packages/Python/lldbsuite/test/functionalities/thread/backtrace_all/ParallelTask.cpp
old mode 100755
new mode 100644

diff  --git a/openmp/runtime/test/ompt/callback.h 
b/openmp/runtime/test/ompt/callback.h
old mode 100755
new mode 100644



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


[Lldb-commits] [PATCH] D70335: [lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

2019-11-16 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py:33
 @skipIfWindows # the test is not updated for Windows.
+@skipIfNetBSD # build failure due to pthread_setname_np prototype
 @llgs_test

Can we fix the prototype in use on NetBSD?


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

https://reviews.llvm.org/D70335



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


[Lldb-commits] [PATCH] D70335: [lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

2019-11-16 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added a comment.

In D70335#1748773 , @labath wrote:

> What's up with the new test (TestGdbRemoteTwoThreadsInvCont.py)? Is that 
> ready for checkin or a mistake? Should it be in a separate patch?


Sorry, added accidentally. Unstaged now.




Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py:33
 @skipIfWindows # the test is not updated for Windows.
+@skipIfNetBSD # build failure due to pthread_setname_np prototype
 @llgs_test

krytarowski wrote:
> Can we fix the prototype in use on NetBSD?
Sure but I'd like to address that separately.


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

https://reviews.llvm.org/D70335



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


[Lldb-commits] [PATCH] D70335: [lldb] [test] Enable lldb-server tests on NetBSD, and set XFAILs

2019-11-16 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 229703.
mgorny added a comment.

Remove accidentally added wip test.


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

https://reviews.llvm.org/D70335

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py

Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
@@ -30,6 +30,7 @@
 self.assertEqual(expected_name, kv_dict.get("name"))
 
 @skipIfWindows # the test is not updated for Windows.
+@skipIfNetBSD # build failure due to pthread_setname_np prototype
 @llgs_test
 def test(self):
 """ Make sure lldb-server can retrieve inferior thread name"""
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
@@ -82,6 +82,7 @@
 self.expect_exit_code(len(signals_to_ignore))
 
 @skipIfWindows # no signal support
+@expectedFailureNetBSD
 @llgs_test
 def test_default_signals_behavior(self):
 self.init_llgs_test()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
@@ -138,6 +138,7 @@
 self.assertEqual(
 ['0x727476787a7c7e71', '0x737577797b7d7f70'], get_reg_value('xmm15'))
 
+@expectedFailureNetBSD
 @llgs_test
 def test_g_returns_correct_data_with_suffix_llgs(self):
 self.init_llgs_test()
@@ -145,6 +146,7 @@
 self.set_inferior_startup_launch()
 self.g_returns_correct_data(True)
 
+@expectedFailureNetBSD
 @llgs_test
 def test_g_returns_correct_data_no_suffix_llgs(self):
 self.init_llgs_test()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -113,18 +113,21 @@
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_well_formed(self):
 self.setup_test()
 self.libraries_svr4_well_formed()
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_load_addr(self):
 self.setup_test()
 self.libraries_svr4_has_correct_load_addr()
 
 @llgs_test
 @skipUnlessPlatform(["linux", "android", "netbsd"])
+@expectedFailureNetBSD
 def test_libraries_svr4_libs_present(self):
 self.setup_test()
 self.libraries_svr4_libs_present()
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
@@ -125,6 +125,7 @@
 self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT)
 
 @llgs_test
+@skipIfNetBSD
 def test_qThreadStopInfo_works_for_multiple_threads_llgs(se