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

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

@omjavaid I do not have the regression reproducible, could you provide more 
info?
Having on both hosts trunk `54a9b4c02ff57e9847e0c501578e51db6f73d3be` having 
applied your D69904 , having reverted your 
revert (=reapplied) of this my D63540 .
Running on Fedora 30 `armv7l`:

  ssh -L 1234:localhost:1234 -L 1235:localhost:1235 
arm03-packager00.cloud.fedoraproject.org
  ~/redhat/llvm-monorepo-clangassert/bin/lldb-server platform --listen "*:1234" 
--server --min-gdbserver-port 1235 --max-gdbserver-port 1236

On Fedora 30 x86_64:
./bin/lldb-dotest --arch=arm --platform-name=remote-linux 
--platform-url=connect://localhost:1234 -f TestSourceInfo -v -t

  UNSUPPORTED: LLDB 
(/home/jkratoch/redhat/llvm-monorepo-clangassert/bin/clang-10-arm) :: test_dsym 
(lldbsuite.test.lldbtest.TestSourceInfo) (test case does not fall in any 
category of interest for this run) 
  PASS: LLDB (/home/jkratoch/redhat/llvm-monorepo-clangassert/bin/clang-10-arm) 
:: test_dwarf (lldbsuite.test.lldbtest.TestSourceInfo)
  PASS: LLDB (/home/jkratoch/redhat/llvm-monorepo-clangassert/bin/clang-10-arm) 
:: test_dwo (lldbsuite.test.lldbtest.TestSourceInfo)
  UNSUPPORTED: LLDB 
(/home/jkratoch/redhat/llvm-monorepo-clangassert/bin/clang-10-arm) :: 
test_gmodules (lldbsuite.test.lldbtest.TestSourceInfo) (test case does not fall 
in any category of interest for this run) 
  --
  Ran 4 tests in 0.802s
  RESULT: PASSED (2 passes, 0 failures, 0 errors, 2 skipped, 0 expected 
failures, 0 unexpected successes)


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] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

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

Looks good. Thanks for adding the test. See inline comment for possible 
simplification.




Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:22
+
+Note: just sending escape characters to pexpect and checking the buffer
+doesn't work well, so we run real commands. We want to type

There are several reasons why doing that doesn't work well. The first is that 
the "console" output would differ depending on whether lldb/libedit has had a 
chance to disable echo or not. Assuming you got past that, the second problem 
would be that the output would contain a lot of ansi cursor movement escape 
sequences, and redraws, and you'd have to encode in the test the exact way in 
which libedit chose to implement the line editing operations. Checking for the 
effect of the command indeed seems like the best way to exercise this 
functionality.



Comment at: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py:27
+
+1. Send "el ommand" -> "el command[]"
+2. Ctrl+left once   -> "el []command"

```
el ommand[]
el []ommand
```




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 = [

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"])`


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] D70177: [lldb] Fix that trailing backslashes in source lines break the Clang highlighter

2019-11-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: JDevlieghere.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Clang's raw Lexer doesn't produce any tokens for trailing backslashes in a 
line. This doesn't work with
LLDB's Clang highlighter which builds the source code to display from the list 
of tokens the Lexer returns.
This causes that lines with trailing backslashes are lacking the backslash and 
the following newline when
rendering source code in LLDB.

This patch removes the trailing newline from the current line we are 
highlighting. This way Clang doesn't
drop the backslash token and we just restore the newline after tokenising.

Fixes rdar://57091487


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70177

Files:
  lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
  lldb/unittests/Language/Highlighting/HighlighterTest.cpp


Index: lldb/unittests/Language/Highlighting/HighlighterTest.cpp
===
--- lldb/unittests/Language/Highlighting/HighlighterTest.cpp
+++ lldb/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -205,6 +205,43 @@
 highlightC("#include \"foo\" //c", s));
 }
 
+TEST_F(HighlighterTest, ClangPreserveNewLine) {
+  HighlightStyle s;
+  s.comment.Set("", "");
+
+  EXPECT_EQ("//\n", highlightC("//\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashBeforeNewline) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\\n", highlightC("\\\n", s));
+  EXPECT_EQ("\\\r\n", highlightC("\\\r\n", s));
+
+  EXPECT_EQ("#define a \\\n", highlightC("#define a \\\n", s));
+  EXPECT_EQ("#define a \\\r\n", highlightC("#define a \\\r\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashWithWhitespace) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\  \n", highlightC("\\  \n", s));
+  EXPECT_EQ("\\ \t\n", highlightC("\\ \t\n", s));
+  EXPECT_EQ("\\ \n", highlightC("\\ \n", s));
+  EXPECT_EQ("\\\t\n", highlightC("\\\t\n", s));
+
+  EXPECT_EQ("#define a \\  \n", highlightC("#define a \\  \n", s));
+  EXPECT_EQ("#define a \\ \t\n", highlightC("#define a \\ \t\n", s));
+  EXPECT_EQ("#define a \\ \n", highlightC("#define a \\ \n", s));
+  EXPECT_EQ("#define a \\\t\n", highlightC("#define a \\\t\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashMissingNewLine) {
+  HighlightStyle s;
+  EXPECT_EQ("\\", highlightC("\\", s));
+  EXPECT_EQ("#define a\\", highlightC("#define a\\", s));
+}
+
 TEST_F(HighlighterTest, ClangComments) {
   HighlightStyle s;
   s.comment.Set("", "");
Index: lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
===
--- lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
+++ lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
@@ -139,6 +139,16 @@
   FileManager file_mgr(file_opts,
FileSystem::Instance().GetVirtualFileSystem());
 
+  // The line might end in a backslash which would cause Clang to drop the
+  // backslash and the terminating line feed. This makes sense when parsing 
C++,
+  // but when highlighting we care about preserving the backslash/newline. To
+  // not lose this information we remove the line feed here so that Clang knows
+  // this is just a single line we are highlighting. We add back the newline
+  // after tokenizing.
+  const bool line_had_cr_lf = line.endswith("\r\n");
+  const bool line_had_lf = line.endswith("\n") && !line_had_cr_lf;
+  line = line.trim("\r\n");
+
   unsigned line_number = previous_lines.count('\n') + 1U;
 
   // Let's build the actual source code Clang needs and setup some utility
@@ -227,6 +237,11 @@
 color.Apply(result, to_print);
   }
 
+  if (line_had_cr_lf)
+result << "\r\n";
+  else if (line_had_lf)
+result << "\n";
+
   // If we went over the whole file but couldn't find our own file, then
   // somehow our setup was wrong. When we're in release mode we just give the
   // user the normal line and pretend we don't know how to highlight it. In


Index: lldb/unittests/Language/Highlighting/HighlighterTest.cpp
===
--- lldb/unittests/Language/Highlighting/HighlighterTest.cpp
+++ lldb/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -205,6 +205,43 @@
 highlightC("#include \"foo\" //c", s));
 }
 
+TEST_F(HighlighterTest, ClangPreserveNewLine) {
+  HighlightStyle s;
+  s.comment.Set("", "");
+
+  EXPECT_EQ("//\n", highlightC("//\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashBeforeNewline) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\\n", highlightC("\\\n", s));
+  EXPECT_EQ("\\\r\n", highlightC("\\\r\n", s));
+
+  EXPECT_EQ("#define a \\\n", highlightC("#define a \\\n", s));
+  EXPECT_EQ("#define a \\\r\n", highlightC("#define a \\\r\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashWithWhitespace) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\  \n", highlightC("\\  \n", s));
+  EXPECT_E

[Lldb-commits] [PATCH] D70155: [LLDB] Avoid triple corruption while merging core info from platform and target triples

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

Can you add a test case for this? I assuming it could be similar to one of the 
existing ArchSpec::MergeFrom tests in 
https://github.com/llvm/llvm-project/blob/7dd7a3607596a51044b8706ebf6df2e613ce1e9b/lldb/unittests/Utility/ArchSpecTest.cpp#L137


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

https://reviews.llvm.org/D70155



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


[Lldb-commits] [PATCH] D70177: [lldb] Fix that trailing backslashes in source lines break the Clang highlighter

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



Comment at: lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp:150
+  const bool line_had_lf = line.endswith("\n") && !line_had_cr_lf;
+  line = line.trim("\r\n");
+

technically, this `trim` might remove additional spurious carriage return 
characters that will not be restored correctly afterwards. What I'd do is 
replace `endswith` with `consume_back` which will also remove the suffix while 
testing for it's presence.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70177



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


[Lldb-commits] [PATCH] D70154: [LLDB] Fix whitespace/tabs mismatch in lldbsuite Makefile.rules

2019-11-13 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

It looks like you're replacing everything with tabs. I suppose that's fine, as 
that is the prevalent local convention, but it might be better to go for 
spaces, as we don't use tabs anywhere else.


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

https://reviews.llvm.org/D70154



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


[Lldb-commits] [PATCH] D70177: [lldb] Fix that trailing backslashes in source lines break the Clang highlighter

2019-11-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 229087.
teemperor added a comment.

- Moved to `consume_back`


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

https://reviews.llvm.org/D70177

Files:
  lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
  lldb/unittests/Language/Highlighting/HighlighterTest.cpp


Index: lldb/unittests/Language/Highlighting/HighlighterTest.cpp
===
--- lldb/unittests/Language/Highlighting/HighlighterTest.cpp
+++ lldb/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -205,6 +205,43 @@
 highlightC("#include \"foo\" //c", s));
 }
 
+TEST_F(HighlighterTest, ClangPreserveNewLine) {
+  HighlightStyle s;
+  s.comment.Set("", "");
+
+  EXPECT_EQ("//\n", highlightC("//\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashBeforeNewline) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\\n", highlightC("\\\n", s));
+  EXPECT_EQ("\\\r\n", highlightC("\\\r\n", s));
+
+  EXPECT_EQ("#define a \\\n", highlightC("#define a \\\n", s));
+  EXPECT_EQ("#define a \\\r\n", highlightC("#define a \\\r\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashWithWhitespace) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\  \n", highlightC("\\  \n", s));
+  EXPECT_EQ("\\ \t\n", highlightC("\\ \t\n", s));
+  EXPECT_EQ("\\ \n", highlightC("\\ \n", s));
+  EXPECT_EQ("\\\t\n", highlightC("\\\t\n", s));
+
+  EXPECT_EQ("#define a \\  \n", highlightC("#define a \\  \n", s));
+  EXPECT_EQ("#define a \\ \t\n", highlightC("#define a \\ \t\n", s));
+  EXPECT_EQ("#define a \\ \n", highlightC("#define a \\ \n", s));
+  EXPECT_EQ("#define a \\\t\n", highlightC("#define a \\\t\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashMissingNewLine) {
+  HighlightStyle s;
+  EXPECT_EQ("\\", highlightC("\\", s));
+  EXPECT_EQ("#define a\\", highlightC("#define a\\", s));
+}
+
 TEST_F(HighlighterTest, ClangComments) {
   HighlightStyle s;
   s.comment.Set("", "");
Index: lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
===
--- lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
+++ lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
@@ -139,6 +139,15 @@
   FileManager file_mgr(file_opts,
FileSystem::Instance().GetVirtualFileSystem());
 
+  // The line might end in a backslash which would cause Clang to drop the
+  // backslash and the terminating line feed. This makes sense when parsing 
C++,
+  // but when highlighting we care about preserving the backslash/newline. To
+  // not lose this information we remove the line feed here so that Clang knows
+  // this is just a single line we are highlighting. We add back the newline
+  // after tokenizing.
+  const bool line_had_lf = line.consume_back("\n");
+  const bool line_had_cr_lf = line.consume_back("\r");
+
   unsigned line_number = previous_lines.count('\n') + 1U;
 
   // Let's build the actual source code Clang needs and setup some utility
@@ -227,6 +236,11 @@
 color.Apply(result, to_print);
   }
 
+  if (line_had_cr_lf)
+result << "\r\n";
+  else if (line_had_lf)
+result << "\n";
+
   // If we went over the whole file but couldn't find our own file, then
   // somehow our setup was wrong. When we're in release mode we just give the
   // user the normal line and pretend we don't know how to highlight it. In


Index: lldb/unittests/Language/Highlighting/HighlighterTest.cpp
===
--- lldb/unittests/Language/Highlighting/HighlighterTest.cpp
+++ lldb/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -205,6 +205,43 @@
 highlightC("#include \"foo\" //c", s));
 }
 
+TEST_F(HighlighterTest, ClangPreserveNewLine) {
+  HighlightStyle s;
+  s.comment.Set("", "");
+
+  EXPECT_EQ("//\n", highlightC("//\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashBeforeNewline) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\\n", highlightC("\\\n", s));
+  EXPECT_EQ("\\\r\n", highlightC("\\\r\n", s));
+
+  EXPECT_EQ("#define a \\\n", highlightC("#define a \\\n", s));
+  EXPECT_EQ("#define a \\\r\n", highlightC("#define a \\\r\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashWithWhitespace) {
+  HighlightStyle s;
+
+  EXPECT_EQ("\\  \n", highlightC("\\  \n", s));
+  EXPECT_EQ("\\ \t\n", highlightC("\\ \t\n", s));
+  EXPECT_EQ("\\ \n", highlightC("\\ \n", s));
+  EXPECT_EQ("\\\t\n", highlightC("\\\t\n", s));
+
+  EXPECT_EQ("#define a \\  \n", highlightC("#define a \\  \n", s));
+  EXPECT_EQ("#define a \\ \t\n", highlightC("#define a \\ \t\n", s));
+  EXPECT_EQ("#define a \\ \n", highlightC("#define a \\ \n", s));
+  EXPECT_EQ("#define a \\\t\n", highlightC("#define a \\\t\n", s));
+}
+
+TEST_F(HighlighterTest, ClangTrailingBackslashMissingNewLine) {
+  HighlightStyle s;
+  EXPECT_EQ("\\", highlightC("\\", s));
+  EXPECT_EQ("#define a\\", highlightC("#define a\\", s));

[Lldb-commits] [PATCH] D70127: [lldb-vscode] Fix a race in test_extra_launch_commands

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

In D70127#1743077 , @clayborg wrote:

> --stop-at-entry only really works for Darwin


That's not true. :) The reason this works on linux (and elsewhere) is that we 
don't use posix_spawn, but instead we launch the process (fork+exec) already 
under the control of ptrace. Ptrace automatically stops the process on 
execve(), so we are able to catch the process before it executes any 
(userspace) instructions.

In D70127#1742659 , @jingham wrote:

> It looks like all the continue routines in lldbvscode_testcase.py use 
> self.vscode.wait_for_stopped() after setting the target going.  Would that 
> fix the problem here?  Without knowing anything about the protocol VSCode is 
> using, I can't say that's right.  But if launch is asynchronous, as it looks 
> like it is, it seems reasonable to test whether wait_for_stopped() also works 
> for launch.  Be weird if it didn't...


I think that would fix it, but I don't know if that would test the thing that 
it should test (I don't know much about the LSP protocol either). I made this 
fix going off of the fact that lldb-vscode used eLaunchFlagStopAtEntry in a 
"regular" launch and that the "extra launch commands are just supposed to be a 
fancier form of a "regular" launch.

In D70127#1742471 , @jankratochvil 
wrote:

> BTW I did not have problem with this testcase, I had problem with 
> `TestVSCode_attach` but I never finished that patch: 
> https://people.redhat.com/jkratoch/TestVSCode_attach.patch


Interesting. I have seen that test fail in the past, but it doesn't seem to 
fail now. I don't think anything substantial has changed, so likely just random 
perturbations made it not fail on my end. I'll keep that patch in mind if I do 
see it fail again.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70127



___
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-13 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 229092.
teemperor added a comment.

- Simplified error handling (Thanks Pavel)


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

https://reviews.llvm.org/D69704

Files:
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBModule.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/packages/Python/lldbsuite/test/python_api/module_compability/Makefile
  
lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py
  lldb/packages/Python/lldbsuite/test/python_api/module_compability/main.cpp
  lldb/scripts/interface/SBModule.i
  lldb/source/API/SBModule.cpp
  lldb/source/Symbol/TypeSystem.cpp

Index: lldb/source/Symbol/TypeSystem.cpp
===
--- lldb/source/Symbol/TypeSystem.cpp
+++ lldb/source/Symbol/TypeSystem.cpp
@@ -147,6 +147,12 @@
   return false;
 }
 
+Status TypeSystem::IsCompatible() {
+  // Assume a language is compatible. Override this virtual function
+  // in your TypeSystem plug-in if version checking is desired.
+  return Status();
+}
+
 ConstString TypeSystem::DeclGetMangledName(void *opaque_decl) {
   return ConstString();
 }
Index: lldb/source/API/SBModule.cpp
===
--- lldb/source/API/SBModule.cpp
+++ lldb/source/API/SBModule.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Symbol/Symtab.h"
 #include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/StreamString.h"
 
@@ -687,6 +688,24 @@
   return LLDB_RECORD_RESULT(sb_addr);
 }
 
+lldb::SBError SBModule::IsDebugInfoCompatible(lldb::LanguageType language) {
+  SBError sb_error;
+  ModuleSP module_sp(GetSP());
+  if (!module_sp) {
+sb_error.SetErrorString("invalid module");
+return sb_error;
+  }
+
+  auto type_system_or_err = module_sp->GetTypeSystemForLanguage(language);
+  if (!type_system_or_err) {
+sb_error.ref() = type_system_or_err.takeError();
+return sb_error;
+  }
+
+  sb_error.SetError(type_system_or_err->IsCompatible());
+  return sb_error;
+}
+
 namespace lldb_private {
 namespace repro {
 
Index: lldb/scripts/interface/SBModule.i
===
--- lldb/scripts/interface/SBModule.i
+++ lldb/scripts/interface/SBModule.i
@@ -342,6 +342,9 @@
 lldb::SBAddress
 GetObjectFileEntryPointAddress() const;
 
+lldb::SBError
+IsDebugInfoCompatible(lldb::LanguageType language);
+
 %pythoncode %{
 def __len__(self):
 '''Return the number of symbols in a lldb.SBModule object.'''
Index: lldb/packages/Python/lldbsuite/test/python_api/module_compability/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/python_api/module_compability/main.cpp
@@ -0,0 +1 @@
+int main() {}
Index: lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py
@@ -0,0 +1,64 @@
+"""
+Test SBModule's IsDebugInfoCompatible.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ModuleDebugInfoCheckTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def assert_invalid_module_err(self, error):
+self.assertEquals("invalid module", error.GetCString())
+self.assertFalse(error.Success())
+
+# Py3 asserts due to a bug in SWIG.  A fix for this was upstreamed into
+# SWIG 3.0.8.
+@skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_default_module(self):
+exe_module = lldb.SBModule()
+self.assert_invalid_module_err(exe_module.IsDebugInfoCompatible(lldb.eLanguageTypeUnknown))
+self.assert_invalid_module_err(error = exe_module.IsDebugInfoCompatible(lldb.eLanguageTypeC))
+
+def assert_compatible(self, exe_module, lang):
+error = exe_module.IsDebugInfoCompatible(lang)
+self.assertTrue(error.Success())
+
+# Py3 asserts due to a bug in SWIG.  A fix for this was upstreamed into
+# SWIG 3.0.8.
+@skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_c_languages(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+self.assertTrue(target.GetNumModules() > 0)
+
+exe_module = target.GetModuleAtIndex(0)
+
+# Check that we get an error if LLDB doesn't implement the language
+

[Lldb-commits] [PATCH] D70177: [lldb] Fix that trailing backslashes in source lines break the Clang highlighter

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



Comment at: lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp:149
+  const bool line_had_lf = line.consume_back("\n");
+  const bool line_had_cr_lf = line.consume_back("\r");
+

`= line_had_lf && consume_back(\r)`


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

https://reviews.llvm.org/D70177



___
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-13 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D69704#1742638 , @jingham wrote:

> It doesn't seem like these are mutually exclusive.  If we were being 
> exhaustive about this we would have two levels of test, (1) is all the debug 
> information in the module uningestible and (2)  are there some CU's in the 
> module that have debug information that lldb can't ingest.  If we had (2) 
> then a language could decide "am I able to construct types from the debug 
> info for a module that has some broken parts?"  Deciding that depends on how 
> the debug info is laid out.  If the answer is yes, then (1) would return 
> "false if all CU's return false from (2)." if no, (1) would return "false if 
> any CU's return false from (2)".


Right, it's not that the two are mutually exclusive -- it's just that the 
semantics becomes fuzzier. You seem to think that the "natural" behavior would 
be to flag if "all" debug info is incompatible. My first though was that we 
should report if "any" debug info is incompatible.

> Also, IRL if we introduce some incompatibility in the toolchain from compiler 
> version -> lldb version, the vastly more common situation would be for all of 
> a module to be built in an incompatible way.  So having this larger scale 
> check still seems to me useful.  That lldb or some GUI using it can put up a 
> dialog saying "This module is not compatible with lldb".  If the whole module 
> is not compatible it would be awkward to complain about it CU by CU.

I actually don't think this is that uncommon in the c++ world. While it's true 
that all *user* code in a given library will likely use the same compiler, a 
typical module will also contain some startup/glue code taken from the libc 
and/or compiler support libraries. It's fairly likely that these were built 
with a different compiler, or at least different flags of the same compiler. 
And while these things will often have no debug info, there are also a lot of 
cases when they will (android NDK ships debug info for everything, most linux 
distros enable one to install it optionally, etc.)

BTW, what is the expected effect of this method returning "false"? I would 
expect that one can still normally use this module everywhere, only it will 
appear as if it contains no debug info (or just a limited subset).. Is that so?


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] [PATCH] D51830: Add a way to make scripted breakpoints

2019-11-13 Thread Konrad Wilhelm Kleine via Phabricator via lldb-commits
kwk added inline comments.



Comment at: source/Core/SearchFilter.cpp:757
+  }
+  if (m_cu_spec_list.FindFileIndex(0, sym_ctx.comp_unit, false) == UINT32_MAX)
+return false; // Fails the file check

@jingham Do you know why you check for the CU again here? I mean there's 
CompUnitPasses, that should do this, right?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D51830



___
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-13 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

It is still the same (no arm32 regression) with 
`16bdcc809c72c639a2888b6b859dca88453e3c28` and this patch reapplied.


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] D70177: [lldb] Fix that trailing backslashes in source lines break the Clang highlighter

2019-11-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

LGTM with Pavel's comment. Thanks for the quick turnaround on this!


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

https://reviews.llvm.org/D70177



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


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

2019-11-13 Thread Jim Ingham via Phabricator via lldb-commits
jingham marked an inline comment as done.
jingham added inline comments.



Comment at: source/Core/SearchFilter.cpp:757
+  }
+  if (m_cu_spec_list.FindFileIndex(0, sym_ctx.comp_unit, false) == UINT32_MAX)
+return false; // Fails the file check

kwk wrote:
> @jingham Do you know why you check for the CU again here? I mean there's 
> CompUnitPasses, that should do this, right?
The way the interaction between the Breakpoint Resolvers and the Search Filters 
work is that the SearchFilter asks the Resolver at what level it wants to be 
presented Symbol Containers (the module, the CU, Functions, etc.).  Then the 
Search Filter iterates over the Symbol Container space handing the Resolver 
entities at the level the Resolver requested.  Of course, the SearchFilter will 
only pass the resolver entities at that level that pass its test.  But there is 
no guarantee that the an object passed at the level the Resolver requested is 
passes the SearchFilter in its entirety.  So when the Resolver finds an address 
it was looking for in the search entity, it still needs to make sure that 
address actually passes SearchFilter.  So the Resolver always needs to call 
AddressPasses before it accepts that address.

For instance, name breakpoints are searched at the Module level, because name 
tables are per module, so that is the convenient level to do the search.  That 
means the by-name BreakpointResolver is going to get passed Modules.  But if 
the SearchFilter was actually a by CU one, when the resolver finds a name some 
Module it was passed, it still needs to be sure that it's in the SearchFilter's 
CU, which it does by calling back into AddressPasses before setting a 
breakpoint on that address.

Was that what you were asking?



Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D51830



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


[Lldb-commits] [lldb] ad88277 - [LLDB] Fix a bunch of -Wdocumentation warnings

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

Author: Jonas Devlieghere
Date: 2019-11-13T12:28:10-08:00
New Revision: ad882774fe4ee9b37ffcf35d86303c265bbc585a

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

LOG: [LLDB] Fix a bunch of -Wdocumentation warnings

Added: 


Modified: 
lldb/include/lldb/Breakpoint/Breakpoint.h
lldb/include/lldb/Breakpoint/BreakpointID.h
lldb/include/lldb/Breakpoint/BreakpointList.h
lldb/include/lldb/Breakpoint/BreakpointLocation.h
lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
lldb/include/lldb/Breakpoint/BreakpointLocationList.h
lldb/include/lldb/Breakpoint/BreakpointResolver.h
lldb/include/lldb/Breakpoint/BreakpointSite.h
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/include/lldb/Breakpoint/WatchpointList.h
lldb/include/lldb/Core/Address.h
lldb/include/lldb/Core/AddressRange.h
lldb/include/lldb/Core/Highlighter.h
lldb/include/lldb/Core/Mangled.h
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Core/ModuleChild.h
lldb/include/lldb/Core/ModuleList.h
lldb/include/lldb/Core/SearchFilter.h
lldb/include/lldb/Expression/DWARFExpression.h
lldb/include/lldb/Expression/FunctionCaller.h
lldb/include/lldb/Expression/IRExecutionUnit.h
lldb/include/lldb/Expression/REPL.h
lldb/include/lldb/Expression/UserExpression.h
lldb/include/lldb/Host/File.h
lldb/include/lldb/Host/HostInfoBase.h
lldb/include/lldb/Host/HostProcess.h
lldb/include/lldb/Host/PseudoTerminal.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Interpreter/Options.h
lldb/include/lldb/Symbol/Block.h
lldb/include/lldb/Symbol/CompileUnit.h
lldb/include/lldb/Symbol/Declaration.h
lldb/include/lldb/Symbol/Function.h
lldb/include/lldb/Symbol/LineEntry.h
lldb/include/lldb/Symbol/LineTable.h
lldb/include/lldb/Symbol/ObjectFile.h
lldb/include/lldb/Symbol/SymbolContext.h
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Target/Process.h
lldb/include/lldb/Target/StackFrame.h
lldb/include/lldb/Target/Target.h
lldb/include/lldb/Target/TargetList.h
lldb/include/lldb/Target/Thread.h
lldb/include/lldb/Utility/ConstString.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/tools/lldb-vscode/LLDBUtils.h

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index f561b6d900a1..94411bd57a67 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -193,7 +193,7 @@ class Breakpoint : public 
std::enable_shared_from_this,
   /// Tell this breakpoint to scan a given module list and resolve any new
   /// locations that match the breakpoint's specifications.
   ///
-  /// \param[in] changed_modules
+  /// \param[in] module_list
   ///The list of modules to look in for new locations.
   ///
   /// \param[in]  new_locations
@@ -205,7 +205,7 @@ class Breakpoint : public 
std::enable_shared_from_this,
   /// which case we will remove any locations that are in modules that got
   /// unloaded.
   ///
-  /// \param[in] changedModules
+  /// \param[in] changed_modules
   ///The list of modules to look in for new locations.
   /// \param[in] load_event
   ///If \b true then the modules were loaded, if \b false, unloaded.
@@ -372,10 +372,6 @@ class Breakpoint : public 
std::enable_shared_from_this,
   ///If \b true the callback will be run on the private event thread
   ///before the stop event gets reported.  If false, the callback will get
   ///handled on the public event thread after the stop has been posted.
-  ///
-  /// \return
-  ///\b true if the process should stop when you hit the breakpoint.
-  ///\b false if it should continue.
   void SetCallback(BreakpointHitCallback callback, void *baton,
bool is_synchronous = false);
 
@@ -522,7 +518,7 @@ class Breakpoint : public 
std::enable_shared_from_this,
 if (name_to_remove)
   m_name_list.erase(name_to_remove);
   }
-  
+
 public:
   bool MatchesName(const char *name) {
 return m_name_list.find(name) != m_name_list.end();
@@ -554,14 +550,14 @@ class Breakpoint : public 
std::enable_shared_from_this,
   lldb::BreakpointPreconditionSP GetPrecondition() {

[Lldb-commits] [lldb] 7858677 - Rename ParseTypeFromDWO to ParseTypeFromClangModule (NFC)

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

Author: Adrian Prantl
Date: 2019-11-13T13:37:43-08:00
New Revision: 78586775f7b26813740096024949907848e7ccc1

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

LOG: Rename ParseTypeFromDWO to ParseTypeFromClangModule (NFC)

Because that is what this function really does. The old name is
misleading.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index b129f999a288..f992a49a6dbc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -135,25 +135,26 @@ static bool IsClangModuleFwdDecl(const DWARFDIE &Die) {
   return false;
 }
 
-TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) {
+TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const DWARFDIE &die,
+ Log *log) {
   ModuleSP dwo_module_sp = die.GetContainingDWOModule();
   if (!dwo_module_sp)
 return TypeSP();
 
-  // If this type comes from a Clang module, look in the DWARF section
-  // of the pcm file in the module cache. Clang generates DWO skeleton
-  // units as breadcrumbs to find them.
+  // If this type comes from a Clang module, recursively look in the
+  // DWARF section of the .pcm file in the module cache. Clang
+  // generates DWO skeleton units as breadcrumbs to find them.
   llvm::SmallVector decl_context;
   die.GetDeclContext(decl_context);
-  TypeMap dwo_types;
+  TypeMap pcm_types;
 
   // The type in the Clang module must have the same language as the current 
CU.
   LanguageSet languages;
   languages.Insert(die.GetCU()->GetLanguageType());
   llvm::DenseSet searched_symbol_files;
   dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
-searched_symbol_files, dwo_types);
-  if (dwo_types.Empty()) {
+searched_symbol_files, pcm_types);
+  if (pcm_types.Empty()) {
 if (!IsClangModuleFwdDecl(die))
   return TypeSP();
 
@@ -164,34 +165,33 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const 
DWARFDIE &die, Log *log) {
   if (!name_module.second)
 continue;
   name_module.second->GetSymbolFile()->FindTypes(
-  decl_context, languages, searched_symbol_files, dwo_types);
-  if (dwo_types.GetSize())
+  decl_context, languages, searched_symbol_files, pcm_types);
+  if (pcm_types.GetSize())
 break;
 }
   }
 
-  if (dwo_types.GetSize() != 1)
+  if (pcm_types.GetSize() != 1)
 return TypeSP();
 
   // We found a real definition for this type in the Clang module, so lets use
   // it and cache the fact that we found a complete type for this die.
-  TypeSP dwo_type_sp = dwo_types.GetTypeAtIndex(0);
-  if (!dwo_type_sp)
+  TypeSP pcm_type_sp = pcm_types.GetTypeAtIndex(0);
+  if (!pcm_type_sp)
 return TypeSP();
 
-  lldb_private::CompilerType dwo_type = dwo_type_sp->GetForwardCompilerType();
-
+  lldb_private::CompilerType pcm_type = pcm_type_sp->GetForwardCompilerType();
   lldb_private::CompilerType type =
-  GetClangASTImporter().CopyType(m_ast, dwo_type);
+  GetClangASTImporter().CopyType(m_ast, pcm_type);
 
   if (!type)
 return TypeSP();
 
   SymbolFileDWARF *dwarf = die.GetDWARF();
   TypeSP type_sp(new Type(
-  die.GetID(), dwarf, dwo_type_sp->GetName(), dwo_type_sp->GetByteSize(),
+  die.GetID(), dwarf, pcm_type_sp->GetName(), pcm_type_sp->GetByteSize(),
   nullptr, LLDB_INVALID_UID, Type::eEncodingInvalid,
-  &dwo_type_sp->GetDeclaration(), type, Type::eResolveStateForward));
+  &pcm_type_sp->GetDeclaration(), type, Type::eResolveStateForward));
 
   dwarf->GetTypeList().Insert(type_sp);
   dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get();
@@ -382,13 +382,12 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
 
 dwarf->GetObjectFile()->GetModule()->LogMessage(
 log,
-"SymbolFileDWARF::ParseType (die = 0x%8.8x, decl_ctx = %p (die "
-"0x%8.8x)) %s name = '%s')",
+"DWARFASTParserClang::ParseTypeFromDWARF "
+"(die = 0x%8.8x, decl_ctx = %p (die 0x%8.8x)) %s name = '%s')",
 die.GetOffset(), static_cast(context), context_die.GetOffset(),
 die.GetTagAsCString(), die.GetName());
   }
 
-
   Type *type_ptr = dwarf->GetDIEToType().lookup(die.GetDIE());
   if (type_ptr == DIE_IS_BEING_PARSED)
 return nullptr;
@@ -462,7 +461,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   // contain th

[Lldb-commits] [lldb] 3d30c14 - Rename clang-module-related *DWO* functions to *ClangModule* (NFC)

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

Author: Adrian Prantl
Date: 2019-11-13T14:07:20-08:00
New Revision: 3d30c142e147b772463f99a81b106898a9f04971

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

LOG: Rename clang-module-related *DWO* functions to *ClangModule* (NFC)

This avoids confusing them with fission-related functionality.

I also moved two accessor functions from DWARFDIE into static
functions in DWARFASTParserClang were their only use is located.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index f992a49a6dbc..7b8498303d22 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -135,9 +135,42 @@ static bool IsClangModuleFwdDecl(const DWARFDIE &Die) {
   return false;
 }
 
+static DWARFDIE GetContainingClangModuleDIE(const DWARFDIE &die) {
+  if (die.IsValid()) {
+DWARFDIE top_module_die;
+// Now make sure this DIE is scoped in a DW_TAG_module tag and return true
+// if so
+for (DWARFDIE parent = die.GetParent(); parent.IsValid();
+ parent = parent.GetParent()) {
+  const dw_tag_t tag = parent.Tag();
+  if (tag == DW_TAG_module)
+top_module_die = parent;
+  else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
+break;
+}
+
+return top_module_die;
+  }
+  return DWARFDIE();
+}
+
+static lldb::ModuleSP GetContainingClangModule(const DWARFDIE &die) {
+  if (die.IsValid()) {
+DWARFDIE clang_module_die = GetContainingClangModuleDIE(die);
+
+if (clang_module_die) {
+  const char *module_name = clang_module_die.GetName();
+  if (module_name)
+return die.GetDWARF()->GetExternalModule(
+lldb_private::ConstString(module_name));
+}
+  }
+  return lldb::ModuleSP();
+}
+
 TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const DWARFDIE &die,
  Log *log) {
-  ModuleSP dwo_module_sp = die.GetContainingDWOModule();
+  ModuleSP dwo_module_sp = GetContainingClangModule(die);
   if (!dwo_module_sp)
 return TypeSP();
 
@@ -873,7 +906,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   if (class_type) {
 bool alternate_defn = false;
 if (class_type->GetID() != decl_ctx_die.GetID() ||
-decl_ctx_die.GetContainingDWOModuleDIE()) {
+GetContainingClangModuleDIE(decl_ctx_die)) {
   alternate_defn = true;
 
   // We uniqued the parent class of this function to another
@@ -887,11 +920,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
 CopyUniqueClassMethodTypes(decl_ctx_die, class_type_die,
class_type, failures);
 
-// FIXME do something with these failures that's smarter
-// than
-// just dropping them on the ground.  Unfortunately classes
-// don't like having stuff added to them after their
-// definitions are complete...
+// FIXME do something with these failures that's
+// smarter than just dropping them on the ground.
+// Unfortunately classes don't like having stuff added
+// to them after their definitions are complete...
 
 type_ptr = dwarf->GetDIEToType()[die.GetDIE()];
 if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 5ee0687995a1..c5411a17f274 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -406,39 +406,6 @@ bool DWARFDIE::IsMethod() const {
   return false;
 }
 
-DWARFDIE
-DWARFDIE::GetContainingDWOModuleDIE() const {
-  if (IsValid()) {
-DWARFDIE top_module_die;
-// Now make sure this DIE is scoped in a DW_TAG_module tag and return true
-// if so
-for (DWARFDIE parent = GetParent(); parent.IsValid();
- parent = parent.GetParent()) {
-  const dw_tag_t tag = parent.Tag();
-  if (tag == DW_TAG_module)
-top_module_die = parent;
-  else if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
-break;
-}
-
-return top_module_di

[Lldb-commits] [lldb] 7f9d36e - Use cheaper, equivalent predicate. (NFC)

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

Author: Adrian Prantl
Date: 2019-11-13T14:16:40-08:00
New Revision: 7f9d36e2db05a7e4646972a88f5b6946c2f343e3

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

LOG: Use cheaper, equivalent predicate. (NFC)

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 7b8498303d22..c9dab6585280 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -906,7 +906,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   if (class_type) {
 bool alternate_defn = false;
 if (class_type->GetID() != decl_ctx_die.GetID() ||
-GetContainingClangModuleDIE(decl_ctx_die)) {
+IsClangModuleFwdDecl(decl_ctx_die)) {
   alternate_defn = true;
 
   // We uniqued the parent class of this function to another



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


[Lldb-commits] [lldb] 9072f01 - Remove redundant check. (NFC)

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

Author: Adrian Prantl
Date: 2019-11-13T14:19:01-08:00
New Revision: 9072f0103b3d54a0db76c881edce03fbe7cb973c

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

LOG: Remove redundant check. (NFC)

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index c9dab6585280..51a9c490bd80 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -188,9 +188,6 @@ TypeSP DWARFASTParserClang::ParseTypeFromClangModule(const 
DWARFDIE &die,
   dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, languages,
 searched_symbol_files, pcm_types);
   if (pcm_types.Empty()) {
-if (!IsClangModuleFwdDecl(die))
-  return TypeSP();
-
 // Since this type is defined in one of the Clang modules imported
 // by this symbol file, search all of them.
 auto &sym_file = die.GetCU()->GetSymbolFileDWARF();



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


[Lldb-commits] [lldb] 8df482e - [LLDB] Fix a bunch of -Wdocumentation warnings in ExpressionParser

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

Author: Jonas Devlieghere
Date: 2019-11-13T14:40:55-08:00
New Revision: 8df482e51c5508203af348589391c776ba8112f8

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

LOG: [LLDB] Fix a bunch of -Wdocumentation warnings in ExpressionParser

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
index 670ba6dce72e..0b0f3b97705d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
@@ -135,18 +135,11 @@ class ASTResultSynthesizer : public clang::SemaConsumer {
   void RecordPersistentTypes(clang::DeclContext *FunDeclCtx);
 
   /// Given a TypeDecl, if it declares a type whose name starts with a dollar
-  /// sign, register it as a pointer type in the target's scratch
-  /// AST context.
-  ///
-  /// \param[in] Body
-  /// The body of the function.
+  /// sign, register it as a pointer type in the target's scratch AST context.
   void MaybeRecordPersistentType(clang::TypeDecl *D);
 
   /// Given a NamedDecl, register it as a pointer type in the target's scratch
   /// AST context.
-  ///
-  /// \param[in] Body
-  /// The body of the function.
   void RecordPersistentDecl(clang::NamedDecl *D);
 
   clang::ASTContext

diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
index 7a8bacf48a8f..cfb81482d832 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
@@ -89,7 +89,7 @@ class ClangASTSource : public ClangExternalASTSourceCommon,
   /// \param[in] DC
   /// The DeclContext being searched.
   ///
-  /// \param[in] isKindWeWant
+  /// \param[in] IsKindWeWant
   /// A callback function that returns true given the
   /// DeclKinds of desired Decls, and false otherwise.
   ///
@@ -155,7 +155,7 @@ class ClangASTSource : public ClangExternalASTSourceCommon,
   /// setHasExternalVisibleStorage() and setHasExternalLexicalStorage() that
   /// this object has something to say about undefined names.
   ///
-  /// \param[in] ASTConsumer
+  /// \param[in] Consumer
   /// Unused.
   void StartTranslationUnit(clang::ASTConsumer *Consumer) override;
 
@@ -321,13 +321,6 @@ class ClangASTSource : public ClangExternalASTSourceCommon,
   /// A wrapper for ClangASTContext::CopyType that sets a flag that
   /// indicates that we should not respond to queries during import.
   ///
-  /// \param[in] dest_context
-  /// The target AST context, typically the parser's AST context.
-  ///
-  /// \param[in] source_context
-  /// The source AST context, typically the AST context of whatever
-  /// symbol file the type was found in.
-  ///
   /// \param[in] src_type
   /// The source type.
   ///
@@ -341,7 +334,7 @@ class ClangASTSource : public ClangExternalASTSourceCommon,
   /// \param[in] name
   /// The name to be considered.
   ///
-  /// \param[in] ignore_all_dollar_nmmes
+  /// \param[in] ignore_all_dollar_names
   /// True if $-names of all sorts should be ignored.
   ///
   /// \return
@@ -358,7 +351,7 @@ class ClangASTSource : public ClangExternalASTSourceCommon,
   /// \return
   /// A copy of the Decl in m_ast_context, or NULL if the copy failed.
   clang::Decl *CopyDecl(clang::Decl *src_decl);
- 
+
   /// Copies a single Type to the target of the given ExternalASTMerger.
   ///
   /// \param[in] src_context
@@ -392,11 +385,11 @@ class ClangASTSource : public 
ClangExternalASTSourceCommon,
   /// True if lookup succeeded; false otherwise.
   bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl,
  clang::ASTContext **original_ctx);
- 
+
   /// Returns m_merger_up.  Only call this if the target is configured to use
   /// modern lookup,
clang::ExternalASTMerger &GetMergerUnchecked();
- 
+
   /// Returns true if there is a merger.  This only occurs if the target is
   /// using modern lookup.
   bool HasMerger() { return (bool)m_merger_up; }

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclM

[Lldb-commits] [lldb] 294ef76 - [RegisterContext] Remove now unneded vestiges.

2019-11-13 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-11-13T14:53:13-08:00
New Revision: 294ef766e8f13818369c22fbad47283c84d87c2f

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

LOG: [RegisterContext] Remove now unneded vestiges.

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
index 4ca33c248c6f..94eebabfe2e0 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
@@ -21,12 +21,6 @@
 
 #include 
 
-// Support building against older versions of LLVM, this macro was added
-// recently.
-#ifndef LLVM_EXTENSION
-#define LLVM_EXTENSION
-#endif
-
 #include "Utility/ARM_DWARF_Registers.h"
 #include "Utility/ARM_ehframe_Registers.h"
 

diff  --git 
a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
index b3ec24d8905d..fa5197cd6bf4 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -30,12 +30,6 @@
 #include 
 #endif
 
-// Support building against older versions of LLVM, this macro was added
-// recently.
-#ifndef LLVM_EXTENSION
-#define LLVM_EXTENSION
-#endif
-
 #include "Utility/ARM64_DWARF_Registers.h"
 
 using namespace lldb;

diff  --git 
a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
index 873713fd8373..959b04700b17 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp
@@ -19,12 +19,6 @@
 
 #include 
 
-// Support building against older versions of LLVM, this macro was added
-// recently.
-#ifndef LLVM_EXTENSION
-#define LLVM_EXTENSION
-#endif
-
 #include "RegisterContextDarwin_i386.h"
 
 using namespace lldb;

diff  --git 
a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
index 47758ce85eb2..22088a7d6448 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp
@@ -21,12 +21,6 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Compiler.h"
 
-// Support building against older versions of LLVM, this macro was added
-// recently.
-#ifndef LLVM_EXTENSION
-#define LLVM_EXTENSION
-#endif
-
 #include "RegisterContextDarwin_x86_64.h"
 
 using namespace lldb;



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


[Lldb-commits] [lldb] 95807cb - [LLDB] Remove dead code from StreamFile

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

Author: Jonas Devlieghere
Date: 2019-11-13T15:08:51-08:00
New Revision: 95807cb039c96323570e0d16a8cbafbf759f7141

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

LOG: [LLDB] Remove dead code from StreamFile

Added: 


Modified: 
lldb/include/lldb/Core/StreamFile.h
lldb/source/Core/StreamFile.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/StreamFile.h 
b/lldb/include/lldb/Core/StreamFile.h
index 712b289aa8d9..bd7d6e8e6ad3 100644
--- a/lldb/include/lldb/Core/StreamFile.h
+++ b/lldb/include/lldb/Core/StreamFile.h
@@ -21,15 +21,10 @@ namespace lldb_private {
 
 class StreamFile : public Stream {
 public:
-  // Constructors and Destructors
-  StreamFile();
-
   StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
 
   StreamFile(int fd, bool transfer_ownership);
 
-  StreamFile(const char *path);
-
   StreamFile(const char *path, File::OpenOptions options,
  uint32_t permissions = lldb::eFilePermissionsFileDefault);
 
@@ -47,7 +42,6 @@ class StreamFile : public Stream {
 
   void Flush() override;
 
-
 protected:
   // Classes that inherit from StreamFile can see and modify these
   std::shared_ptr m_file_sp; // never NULL

diff  --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp
index 2ddb39659d66..475c27ec4117 100644
--- a/lldb/source/Core/StreamFile.cpp
+++ b/lldb/source/Core/StreamFile.cpp
@@ -15,9 +15,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-// StreamFile constructor
-StreamFile::StreamFile() : Stream() { m_file_sp = std::make_shared(); }
-
 StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder 
byte_order)
 : Stream(flags, addr_size, byte_order) {
   m_file_sp = std::make_shared();
@@ -32,20 +29,6 @@ StreamFile::StreamFile(FILE *fh, bool transfer_ownership) : 
Stream() {
   m_file_sp = std::make_shared(fh, transfer_ownership);
 }
 
-StreamFile::StreamFile(const char *path) : Stream() {
-  auto file = FileSystem::Instance().Open(
-  FileSpec(path), File::eOpenOptionWrite | File::eOpenOptionCanCreate |
-  File::eOpenOptionCloseOnExec);
-  if (file)
-m_file_sp = std::move(file.get());
-  else {
-// TODO refactor this so the error gets popagated up instead of logged 
here.
-LLDB_LOG_ERROR(GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST), 
file.takeError(),
-   "Cannot open {1}: {0}", path);
-m_file_sp = std::make_shared();
-  }
-}
-
 StreamFile::StreamFile(const char *path, File::OpenOptions options,
uint32_t permissions)
 : Stream() {



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


[Lldb-commits] [lldb] 9634064 - [LLDB] Fix another set of -Wdocumentation warnings

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

Author: Jonas Devlieghere
Date: 2019-11-13T15:13:06-08:00
New Revision: 9634064cfa1b9bf7b70e1cdf1f4e52a25d6184e7

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

LOG: [LLDB] Fix another set of -Wdocumentation warnings

At this point I'm just fixing issues as I see them pop up locally in
incremental builds.

Added: 


Modified: 
lldb/include/lldb/Target/Queue.h
lldb/include/lldb/Utility/Connection.h
lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Queue.h 
b/lldb/include/lldb/Target/Queue.h
index 01e8994f2441..10b9e0242070 100644
--- a/lldb/include/lldb/Target/Queue.h
+++ b/lldb/include/lldb/Target/Queue.h
@@ -126,10 +126,7 @@ class Queue : public std::enable_shared_from_this {
 m_pending_items.push_back(item);
   }
 
-  /// Return the kind (serial, concurrent) of this queue
-  ///
-  /// \return
-  //  Whether this is a serial or a concurrent queue
+  /// Return the kind (serial, concurrent) of this queue.
   lldb::QueueKind GetKind();
 
   void SetKind(lldb::QueueKind kind);

diff  --git a/lldb/include/lldb/Utility/Connection.h 
b/lldb/include/lldb/Utility/Connection.h
index 77f3ef4a76ba..2ff905d11833 100644
--- a/lldb/include/lldb/Utility/Connection.h
+++ b/lldb/include/lldb/Utility/Connection.h
@@ -171,7 +171,7 @@ class Connection {
   ///
   /// \return
   /// The underlying IOObject used for reading.
-  virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
+  virtual lldb::IOObjectSP GetReadObject() = 0;
 
 private:
   // For Connection only

diff  --git a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp 
b/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
index 50f1d48d03e0..137ecab224bc 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp
@@ -207,7 +207,7 @@ bool UndefinedBehaviorSanitizerRuntime::NotifyBreakpointHit(
 user_id_t break_loc_id) {
   assert(baton && "null baton");
   if (!baton)
-return false; //< false => resume execution.
+return false; ///< false => resume execution.
 
   UndefinedBehaviorSanitizerRuntime *const instance =
   static_cast(baton);



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


[Lldb-commits] [lldb] 33c3e0b - [LLDB] Implement pure virtual method in MockConnection

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

Author: Jonas Devlieghere
Date: 2019-11-13T15:37:57-08:00
New Revision: 33c3e0b96c14e5986fec778625c1e2a37b452956

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

LOG: [LLDB] Implement pure virtual method in MockConnection

I made GetReadObject pure virtual in the base class and forgot to add
the method to the mock class.

Added: 


Modified: 
lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h

Removed: 




diff  --git a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h 
b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h
index 76f92d84be04..53e94a39e8b3 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h
@@ -46,6 +46,8 @@ class MockConnection : public lldb_private::Connection {
 return dst_len;
   };
 
+  lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }
+
   std::vector *m_packets;
 };
 



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


[Lldb-commits] [lldb] bfe663c - Revert a hunk from 9634064cfa1b9bf7b7

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

Author: Reid Kleckner
Date: 2019-11-13T15:43:54-08:00
New Revision: bfe663ce22db6697459510ae5c139da2197df56c

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

LOG: Revert a hunk from 9634064cfa1b9bf7b7

This causes errors when building LLDB because the Windows implementation
doesn't implement this method:

C:\src\llvm-project\lldb\source\Plugins\ScriptInterpreter\Python\ScriptInterpreterPython.cpp(915,19):
 error: allocating an object of abstract class type 
'lldb_private::ConnectionGenericFile'
  new ConnectionGenericFile(read_file, true));
  ^
C:\src\llvm-project\lldb\include\lldb/Utility/Connection.h(174,28): note: 
unimplemented pure virtual method 'GetReadObject' in 'ConnectionGenericFile'
  virtual lldb::IOObjectSP GetReadObject() = 0;
   ^

Added: 


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

Removed: 




diff  --git a/lldb/include/lldb/Utility/Connection.h 
b/lldb/include/lldb/Utility/Connection.h
index 2ff905d11833..9e66dee1363b 100644
--- a/lldb/include/lldb/Utility/Connection.h
+++ b/lldb/include/lldb/Utility/Connection.h
@@ -171,7 +171,7 @@ class Connection {
   ///
   /// \return
   /// The underlying IOObject used for reading.
-  virtual lldb::IOObjectSP GetReadObject() = 0;
+  virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); };
 
 private:
   // For Connection only



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


[Lldb-commits] [lldb] 8ac053e - [LLDB] Cleanup the DataEncoder utility. (NFC)

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

Author: Jonas Devlieghere
Date: 2019-11-13T15:44:51-08:00
New Revision: 8ac053eea20b56f80653191a210682f8bd6fc10d

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

LOG: [LLDB] Cleanup the DataEncoder utility. (NFC)

This commit removes unused methods from the DataEncoder class and cleans
up the API by making all the internal methods private.

Added: 


Modified: 
lldb/include/lldb/Utility/DataEncoder.h
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Plugins/Platform/Android/AdbClient.cpp
lldb/source/Utility/DataEncoder.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/DataEncoder.h 
b/lldb/include/lldb/Utility/DataEncoder.h
index 7d44afd2ce69..f4964b250b9d 100644
--- a/lldb/include/lldb/Utility/DataEncoder.h
+++ b/lldb/include/lldb/Utility/DataEncoder.h
@@ -21,8 +21,9 @@
 
 namespace lldb_private {
 
-/// \class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h" An binary data
-/// encoding class.
+/// \class DataEncoder
+///
+/// An binary data encoding class.
 ///
 /// DataEncoder is a class that can encode binary data (swapping if needed) to
 /// a data buffer. The data buffer can be caller owned, or can be shared data
@@ -86,74 +87,6 @@ class DataEncoder {
   /// any references to shared data that this object may contain.
   void Clear();
 
-  /// Get the current address size.
-  ///
-  /// Return the size in bytes of any address values this object will extract.
-  ///
-  /// \return
-  /// The size in bytes of address values that will be extracted.
-  uint8_t GetAddressByteSize() const { return m_addr_size; }
-
-  /// Get the number of bytes contained in this object.
-  ///
-  /// \return
-  /// The total number of bytes of data this object refers to.
-  size_t GetByteSize() const { return m_end - m_start; }
-
-  /// Get the data end pointer.
-  ///
-  /// \return
-  /// Returns a pointer to the next byte contained in this
-  /// object's data, or NULL of there is no data in this object.
-  uint8_t *GetDataEnd() { return m_end; }
-
-  const uint8_t *GetDataEnd() const { return m_end; }
-
-  /// Get the shared data offset.
-  ///
-  /// Get the offset of the first byte of data in the shared data (if any).
-  ///
-  /// \return
-  /// If this object contains shared data, this function returns
-  /// the offset in bytes into that shared data, zero otherwise.
-  size_t GetSharedDataOffset() const;
-
-  /// Get the current byte order value.
-  ///
-  /// \return
-  /// The current byte order value from this object's internal
-  /// state.
-  lldb::ByteOrder GetByteOrder() const { return m_byte_order; }
-
-  /// Get the data start pointer.
-  ///
-  /// \return
-  /// Returns a pointer to the first byte contained in this
-  /// object's data, or NULL of there is no data in this object.
-  uint8_t *GetDataStart() { return m_start; }
-
-  const uint8_t *GetDataStart() const { return m_start; }
-
-  /// Encode unsigned integer values into the data at \a offset.
-  ///
-  /// \param[in] offset
-  /// The offset within the contained data at which to put the
-  /// data.
-  ///
-  /// \param[in] value
-  /// The value to encode into the data.
-  ///
-  /// \return
-  /// The next offset in the bytes of this data if the data
-  /// was successfully encoded, UINT32_MAX if the encoding failed.
-  uint32_t PutU8(uint32_t offset, uint8_t value);
-
-  uint32_t PutU16(uint32_t offset, uint16_t value);
-
-  uint32_t PutU32(uint32_t offset, uint32_t value);
-
-  uint32_t PutU64(uint32_t offset, uint64_t value);
-
   /// Encode an unsigned integer of size \a byte_size to \a offset.
   ///
   /// Encode a single integer value at \a offset and return the offset that
@@ -176,7 +109,7 @@ class DataEncoder {
   /// \return
   /// The next offset in the bytes of this data if the integer
   /// was successfully encoded, UINT32_MAX if the encoding failed.
-  uint32_t PutMaxU64(uint32_t offset, uint32_t byte_size, uint64_t value);
+  uint32_t PutUnsigned(uint32_t offset, uint32_t byte_size, uint64_t value);
 
   /// Encode an arbitrary number of bytes.
   ///
@@ -232,36 +165,27 @@ class DataEncoder {
   /// NULL will be returned.
   uint32_t PutCString(uint32_t offset, const char *cstr);
 
-  lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; }
+private:
+  uint32_t PutU8(uint32_t offset, uint8_t value);
+  uint32_t PutU16(uint32_t offset, uint16_t value);
+  uint32_t PutU32(uint32_t offset, uint32_t value);
+  uint32_t PutU64(uint32_t offset, uint64_t value);
 
-  /// Set the address byte size.
-  ///
-  /// Set the size in bytes that will be used when extracting any address and
-  /// pointer values from data contained in this object.
-  ///
-  /// \param[in] addr_size
-  /// The size in 

[Lldb-commits] [lldb] a36f316 - Forward declare Optional in STLExtras.h

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

Author: Reid Kleckner
Date: 2019-11-13T16:34:00-08:00
New Revision: a36f316390d4bc1bcb0e9de0f55831385ab24099

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

LOG: Forward declare Optional in STLExtras.h

WIP stats

Added: 


Modified: 
lldb/include/lldb/Utility/UserIDResolver.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/StringSwitch.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/Support/CachePruning.h
llvm/include/llvm/Support/Error.h
llvm/include/llvm/Support/Format.h
llvm/include/llvm/Support/Threading.h
llvm/lib/MC/MCInstrAnalysis.cpp
llvm/lib/Support/CrashRecoveryContext.cpp
llvm/lib/Support/DJB.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/UserIDResolver.h 
b/lldb/include/lldb/Utility/UserIDResolver.h
index bca82a11b660..60f3982f573d 100644
--- a/lldb/include/lldb/Utility/UserIDResolver.h
+++ b/lldb/include/lldb/Utility/UserIDResolver.h
@@ -10,6 +10,7 @@
 #define LLDB_UTILITY_USERIDRESOLVER_H
 
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include 
 

diff  --git a/llvm/include/llvm/ADT/STLExtras.h 
b/llvm/include/llvm/ADT/STLExtras.h
index 274933bc5204..c3b704c3fd79 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -16,8 +16,6 @@
 #ifndef LLVM_ADT_STLEXTRAS_H
 #define LLVM_ADT_STLEXTRAS_H
 
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Config/abi-breaking.h"
@@ -42,6 +40,9 @@
 
 namespace llvm {
 
+template  class Optional;
+template  class SmallVector;
+
 // Only used by compiler if both template types are the same.  Useful when
 // using SFINAE to test for the existence of member functions.
 template  struct SameType;

diff  --git a/llvm/include/llvm/ADT/StringSwitch.h 
b/llvm/include/llvm/ADT/StringSwitch.h
index fea911f6928b..d2a657ecbbee 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -12,6 +12,7 @@
 #ifndef LLVM_ADT_STRINGSWITCH_H
 #define LLVM_ADT_STRINGSWITCH_H
 
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index c6539df0d756..5edf92a95f84 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -10,9 +10,10 @@
 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/iterator.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
 #include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/Support/Error.h"

diff  --git a/llvm/include/llvm/Support/CachePruning.h 
b/llvm/include/llvm/Support/CachePruning.h
index a72a86439f6a..297aa6d1ab8b 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_SUPPORT_CACHE_PRUNING_H
 #define LLVM_SUPPORT_CACHE_PRUNING_H
 
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include 
 

diff  --git a/llvm/include/llvm/Support/Error.h 
b/llvm/include/llvm/Support/Error.h
index 350877a219bf..01bfc4a5fb5f 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -14,6 +14,7 @@
 #define LLVM_SUPPORT_ERROR_H
 
 #include "llvm-c/Error.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"

diff  --git a/llvm/include/llvm/Support/Format.h 
b/llvm/include/llvm/Support/Format.h
index 9dd7b401b46a..3f5251ca8d24 100644
--- a/llvm/include/llvm/Support/Format.h
+++ b/llvm/include/llvm/Support/Format.h
@@ -23,6 +23,7 @@
 #define LLVM_SUPPORT_FORMAT_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"

diff  --git a/llvm/include/llvm/Support/Threading.h 
b/llvm/include/llvm/Support/Threading.h
index bacab8fa23b6..f53c116f0d44 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -15,6 +15,7 @@
 #define LLVM_SUPPORT_THREADING_H
 
 #include "llvm/ADT/FunctionExtras.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #include "llvm/Support/Compiler.h"

diff  --git a/llvm/lib/MC/MCInstrAnalysis.cpp b/llvm/lib/MC/MCInstrAnalysis.cpp
index 54741fdd686

[Lldb-commits] [lldb] 5565d36 - Revert "Forward declare Optional in STLExtras.h"

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

Author: Reid Kleckner
Date: 2019-11-13T16:36:21-08:00
New Revision: 5565d365f2af0f6d17f12ed1a980e6d9415a6607

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

LOG: Revert "Forward declare Optional in STLExtras.h"

This reverts commit a36f316390d4bc1bcb0e9de0f55831385ab24099.

I did not intend to push this with the InitializePasses.h change.

Added: 


Modified: 
lldb/include/lldb/Utility/UserIDResolver.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/StringSwitch.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/Support/CachePruning.h
llvm/include/llvm/Support/Error.h
llvm/include/llvm/Support/Format.h
llvm/include/llvm/Support/Threading.h
llvm/lib/MC/MCInstrAnalysis.cpp
llvm/lib/Support/CrashRecoveryContext.cpp
llvm/lib/Support/DJB.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/UserIDResolver.h 
b/lldb/include/lldb/Utility/UserIDResolver.h
index 60f3982f573d..bca82a11b660 100644
--- a/lldb/include/lldb/Utility/UserIDResolver.h
+++ b/lldb/include/lldb/Utility/UserIDResolver.h
@@ -10,7 +10,6 @@
 #define LLDB_UTILITY_USERIDRESOLVER_H
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include 
 

diff  --git a/llvm/include/llvm/ADT/STLExtras.h 
b/llvm/include/llvm/ADT/STLExtras.h
index c3b704c3fd79..274933bc5204 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -16,6 +16,8 @@
 #ifndef LLVM_ADT_STLEXTRAS_H
 #define LLVM_ADT_STLEXTRAS_H
 
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Config/abi-breaking.h"
@@ -40,9 +42,6 @@
 
 namespace llvm {
 
-template  class Optional;
-template  class SmallVector;
-
 // Only used by compiler if both template types are the same.  Useful when
 // using SFINAE to test for the existence of member functions.
 template  struct SameType;

diff  --git a/llvm/include/llvm/ADT/StringSwitch.h 
b/llvm/include/llvm/ADT/StringSwitch.h
index d2a657ecbbee..fea911f6928b 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -12,7 +12,6 @@
 #ifndef LLVM_ADT_STRINGSWITCH_H
 #define LLVM_ADT_STRINGSWITCH_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index 5edf92a95f84..c6539df0d756 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -10,10 +10,9 @@
 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Triple.h"
-#include "llvm/ADT/iterator.h"
 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
 #include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/Support/Error.h"

diff  --git a/llvm/include/llvm/Support/CachePruning.h 
b/llvm/include/llvm/Support/CachePruning.h
index 297aa6d1ab8b..a72a86439f6a 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_CACHE_PRUNING_H
 #define LLVM_SUPPORT_CACHE_PRUNING_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include 
 

diff  --git a/llvm/include/llvm/Support/Error.h 
b/llvm/include/llvm/Support/Error.h
index 01bfc4a5fb5f..350877a219bf 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_ERROR_H
 
 #include "llvm-c/Error.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"

diff  --git a/llvm/include/llvm/Support/Format.h 
b/llvm/include/llvm/Support/Format.h
index 3f5251ca8d24..9dd7b401b46a 100644
--- a/llvm/include/llvm/Support/Format.h
+++ b/llvm/include/llvm/Support/Format.h
@@ -23,7 +23,6 @@
 #define LLVM_SUPPORT_FORMAT_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"

diff  --git a/llvm/include/llvm/Support/Threading.h 
b/llvm/include/llvm/Support/Threading.h
index f53c116f0d44..bacab8fa23b6 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -15,7 +15,6 @@
 #define LLVM_SUPPORT_THREADING_H
 
 #include "llvm/ADT/FunctionExtras.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
 #incl

[Lldb-commits] [PATCH] D70215: Use ForEachExternalModule in ParseTypeFromClangModule (NFC)

2019-11-13 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added a reviewer: teemperor.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: shafik.

I wanted to further simplify ParseTypeFromClangModule by replacing the 
hand-rolled loop with ForEachExternalModule, and then realized that 
ForEachExternalModule also had the problem of visiting the same leaf node an 
exponential number of times in the worst-case. This adds a set of 
`searched_symbol_files` set to the function as well as the ability to 
early-exit from it.


https://reviews.llvm.org/D70215

Files:
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.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/Symbol/CompileUnit.cpp

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -379,9 +379,12 @@
   return m_imported_modules;
 }
 
-void CompileUnit::ForEachExternalModule(llvm::function_ref f) {
+bool CompileUnit::ForEachExternalModule(
+llvm::DenseSet &visited_symbol_files,
+llvm::function_ref lambda) {
   if (SymbolFile *symfile = GetModule()->GetSymbolFile())
-symfile->ForEachExternalModule(*this, f);
+return symfile->ForEachExternalModule(*this, visited_symbol_files, lambda);
+  return false;
 }
 
 const FileSpecList &CompileUnit::GetSupportFiles() {
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -53,9 +53,9 @@
 
   bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override;
 
-  void
-  ForEachExternalModule(lldb_private::CompileUnit &comp_unit,
-llvm::function_ref f) override;
+  bool ForEachExternalModule(
+  lldb_private::CompileUnit &, llvm::DenseSet &,
+  llvm::function_ref) override;
 
   bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit,
  lldb_private::FileSpecList &support_files) override;
@@ -114,6 +114,11 @@
 uint32_t max_matches,
 llvm::DenseSet &searched_symbol_files,
 lldb_private::TypeMap &types) override;
+  void
+  FindTypes(llvm::ArrayRef context,
+lldb_private::LanguageSet languages,
+llvm::DenseSet &searched_symbol_files,
+lldb_private::TypeMap &types) override;
   lldb_private::CompilerDeclContext FindNamespace(
   lldb_private::ConstString name,
   const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -652,12 +652,15 @@
   return false;
 }
 
-void SymbolFileDWARFDebugMap::ForEachExternalModule(
-CompileUnit &comp_unit, llvm::function_ref f) {
+bool SymbolFileDWARFDebugMap::ForEachExternalModule(
+CompileUnit &comp_unit,
+llvm::DenseSet &visited_symbol_files,
+llvm::function_ref f) {
   std::lock_guard guard(GetModuleMutex());
   SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit);
   if (oso_dwarf)
-oso_dwarf->ForEachExternalModule(comp_unit, f);
+return oso_dwarf->ForEachExternalModule(comp_unit, visited_symbol_files, f);
+  return false;
 }
 
 bool SymbolFileDWARFDebugMap::ParseSupportFiles(CompileUnit &comp_unit,
@@ -1183,6 +1186,16 @@
   });
 }
 
+void SymbolFileDWARFDebugMap::FindTypes(
+llvm::ArrayRef context, LanguageSet languages,
+llvm::DenseSet &searched_symbol_files,
+TypeMap &types) {
+  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
+oso_dwarf->FindTypes(context, languages, searched_symbol_files, types);
+return false;
+  });
+}
+
 //
 // uint32_t
 // SymbolFileDWARFDebugMap::FindTypes (const SymbolContext& sc, const
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -105,9 +105,9 @@
 
   bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override;
 
-  void
-  ForEachExternalModule(lldb_private::CompileUnit &comp_unit,
-llvm::function_ref f) override;
+  bool ForEachExternalModule(
+  ll

[Lldb-commits] [lldb] fa6984a - [LLDB] Don't install the pretty stack trace handler twice.

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

Author: Jonas Devlieghere
Date: 2019-11-13T17:35:58-08:00
New Revision: fa6984a3de81b74bf03325bea71416d8bf483efb

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

LOG: [LLDB] Don't install the pretty stack trace handler twice.

I noticed that currently we are printing LLVM's pretty stack trace
twice. The reason is that we're calling PrintStackTraceOnErrorSignal in
addition to InitLLVM, which besides some other useful things, also
register LLVM's pretty stack trace handler.

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

Added: 


Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 8140e2a04c6e..2070e55d7d2b 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@ llvm::Optional 
InitializeReproducer(opt::InputArgList &input_args) {
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@ int main(int argc, char const *argv[])
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 



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


[Lldb-commits] [PATCH] D70216: [LLDB] Don't install the pretty backtrace handlers twice.

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

Fold `ToolName` into `printHelp`


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

https://reviews.llvm.org/D70216

Files:
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70216: [LLDB] Don't install the pretty backtrace handlers twice.

2019-11-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: vsk, labath.
Herald added a reviewer: jfb.
Herald added a project: LLDB.
JDevlieghere added a subscriber: friss.
Herald added a subscriber: dexonsmith.
JDevlieghere updated this revision to Diff 229212.
JDevlieghere added a comment.
vsk accepted this revision.
This revision is now accepted and ready to land.

Fold `ToolName` into `printHelp`


vsk added a comment.

Looks good to me!


I noticed that currently we are printing LLVM's pretty stack trace
twice. The reason is that we're calling PrintStackTraceOnErrorSignal in
addition to InitLLVM, which besides some other useful things, also
register LLVM's pretty stack trace handler.


https://reviews.llvm.org/D70216

Files:
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70216: [LLDB] Don't install the pretty backtrace handlers twice.

2019-11-13 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfa6984a3de81: [LLDB] Don't install the pretty stack 
trace handler twice. (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70216

Files:
  lldb/tools/driver/Driver.cpp


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 


Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -22,7 +22,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/WithColor.h"
@@ -809,13 +808,10 @@
 
 int main(int argc, char const *argv[])
 {
+  // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
+  // destruction.
   llvm::InitLLVM IL(argc, argv);
 
-  // Print stack trace on crash.
-  llvm::StringRef ToolName = llvm::sys::path::filename(argv[0]);
-  llvm::sys::PrintStackTraceOnErrorSignal(ToolName);
-  llvm::PrettyStackTraceProgram X(argc, argv);
-
   // Parse arguments.
   LLDBOptTable T;
   unsigned MAI;
@@ -824,7 +820,7 @@
   opt::InputArgList input_args = T.ParseArgs(arg_arr, MAI, MAC);
 
   if (input_args.hasArg(OPT_help)) {
-printHelp(T, ToolName);
+printHelp(T, llvm::sys::path::filename(argv[0]));
 return 0;
   }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70216: [LLDB] Don't install the pretty backtrace handlers twice.

2019-11-13 Thread Vedant Kumar via Phabricator via lldb-commits
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

Looks good to me!


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

https://reviews.llvm.org/D70216



___
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-13 Thread Alex Cameron via Phabricator via lldb-commits
tetsuo-cpp added a comment.

Friendly ping. Could I please get this looked at?


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] D68179: [lldb] Fix JSON parser to allow empty arrays

2019-11-13 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

Thanks for adding the tests. I took a look at the patch and it seems fine to 
me. Do you need somebody to commit this for you?
@jingham or @labath may want to have another look.


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] D69820: [Symbol] Add TypeSystem::GetClassName

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

Some minor comments to make this more NFC.




Comment at: lldb/source/Core/ValueObject.cpp:2028
+
+  // TODO: Don't make this specific to C++.
+  auto type_system_or_err =

Can't you just call `GetCompilerType().GetTypeSystem()`? This way this whole 
code isn't C++ specific and much shorter. It also fixes that we end up in the 
Scratch type system for a language when the CompilerType might not even be from 
that TypeSystem (but from another TypeSystem for the same language).



Comment at: lldb/source/Symbol/ClangASTContext.cpp:3857
+  // TODO: Support more than C++, if needed.
+  if (lang_type != eLanguageTypeC_plus_plus)
+return llvm::None;

`ClangUtil::IsClangType(compiler_type)` seems like a more complete check. Then 
you can also drop the `lang_type` parameter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69820



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


[Lldb-commits] [PATCH] D70216: [LLDB] Don't install the pretty backtrace handlers twice.

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

Cool. I saw that we print stack trace twice, but I thought that was because of 
the whole liblldb+lldb signal double installation. Thanks for fixing this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70216



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