[Lldb-commits] [PATCH] D66451: [ClangExpressionParser] Add ClangDeclVendor

2019-08-20 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66451



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


[Lldb-commits] [PATCH] D66429: [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added subscribers: stella.stamenova, labath.
labath added a comment.

I agree that the USE variables seem redundant. I remember thinking the same 
thing when they were introduced, but I was not objecting back then because 
there seemed to be a good reason for it. However, now I don't know what that 
reason was... Tagging @stella.stamenova in case she does (I know it had 
something to do with multi-config generators and visual studio).

That said, I'm not a fan of force-overwriting cache variables specified by the 
user, particularly when the same effect can be achieved by *deleting* the cache 
variable instead of setting it to an empty string. I think you should be able 
to reset the default value of `LLDB_TEST_C_COMPILER` (just like any other cmake 
variable) by running `cmake -ULLDB_TEST_C_COMPILER`. You can even delete both 
variables at once with `-ULLDB_TEST_*_COMPILER`.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66429



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I am glad you're finding lldb-test useful. Please see my inline comment about 
quoting.




Comment at: lldb/lit/SymbolFile/DWARF/compilercontext.ll:1
+; This simulates the debug info for a Clang module.
+source_filename = "/t.c"

We generally put test data into an `Inputs` subfolder. Though in this case, it 
looks like you could actually inline the data into the test file below. (Feel 
free to add `.ll` into the list of test suffixes.)



Comment at: lldb/tools/lldb-test/lldb-test.cpp:145
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));

JDevlieghere wrote:
> aprantl wrote:
> > JDevlieghere wrote:
> > > > ...as a JSON array...`
> > > 
> > > This makes me wonder though, wouldn't it be better to pass a file here 
> > > and have it live in inputs? Do you expect it to be different across tests 
> > > or could we reuse the context across tests?
> > I don't really expect a DeclContexts to have more than 3 entries in the 
> > forseeable future, so that would arguable just make the test harder to read.
> But would those entries be the same across tests or not? If they're the same 
> I think it'd be better to reuse them, even if it's only a few entries.
I actually think it is nice to have the entries present in the test file 
directly. However, what I think will be an issue is that you need to use two 
layers of quotes to pass a json string over the command line. I expect this 
will cause problems on windows, because quoting works differently there.

What I would actually suggest is to ditch JSON, and use a custom format for 
passing this. Maybe something like `--compiler-context 
Module:CModule,Module:SubModule,...`. That would be both shorter and completely 
avoid quotes. I don't think is should make parsing this signtificantly more 
difficult than what you have now.


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/Makefile:4-6
+CFLAGS := -g -O0 -std=c++2a
+
+clean: OBJECTS+=$(wildcard main.d.*)

Replace with `CFLAGS_EXTRAS+=-std=c++2a`



Comment at: 
lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py:46
+
+# Check that we correctly report templates on wchar_t
+self.expect(

This comment looks misplaced.



Comment at: lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp:1-7
+#include 
+
+int main (int argc, char const *argv[])
+{
+char8_t c8 = u8'\0';
+return 0; // Set break point at this line.
+}

It doesn't look like you actually need a running process for this at all. I 
think you could just make `c8` a global variable and inspect it from the 
executable image directly (`target variable c8`).



Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:857-862
+  cpp_category_sp, lldb_private::formatters::Char8StringSummaryProvider,
+  "char8_t * summary provider", ConstString("char8_t *"), string_flags);
+  AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::Char8StringSummaryProvider,
+"char8_t [] summary provider",
+ConstString("char8_t \\[[0-9]+\\]"), string_array_flags, true);

It looks like you're also adding formatters for `char8_t *` and `char8_t[N]`. I 
guess those should be tested too...


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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-20 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked 8 inline comments as done.
jankratochvil added inline comments.



Comment at: lldb/include/lldb/Utility/RegularExpression.h:34
+  /// \param[in] string
+  /// A NULL terminated C string that represents the regular
+  /// expression to compile.

labath wrote:
> Null terminated? I hope not..
Updated+added:
```
+  /// An llvm::StringRef that represents the regular expression to compile.
+  //  String is not referenced anymore after the object is constructed.
```



Comment at: 
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp:445
 
   RegularExpression regex;
   llvm::SmallVector matches;

labath wrote:
> Here I'd just declare a fresh variable in each of the blocks instead of 
> continuously recycling this one.
Rather dropped the variable.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66392



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


[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D66357#1635851 , @clayborg wrote:

> Pavel, any comments on the testing code?


I am worried that this approach of using pointers into thin air instead of real 
objects (which admittedly, would be hard to create/mock) is going to make this 
test fragile in face of future modifications of this code (if, e.g., something 
suddenly decides it needs to dereference these pointers).

However, given that this patch is (if I understand correctly) fixing a 
performance bug, and not an actual correctness bug, and we don't really have a 
framework for testing performance, I would be fine with accepting the patch 
without a test, and so I suppose I would be also fine with just deleting this 
test if/when it starts to become a maintenance burden...




Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:18-19
+namespace {
+class DWARFASTParserClangTests : public testing::Test {};
+
+class DWARFASTParserClangStub : public DWARFASTParserClang {

If you're not going to be putting any code here, you can just drop the fixture 
and use `TEST` instead of `TEST_F` below.



Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:32-36
+  auto unit = (DWARFUnit *)nullptr;
+  auto die1 = DWARFDIE(unit, (DWARFDebugInfoEntry *)1LL);
+  auto die2 = DWARFDIE(unit, (DWARFDebugInfoEntry *)2LL);
+  auto die3 = DWARFDIE(unit, (DWARFDebugInfoEntry *)3LL);
+  auto die4 = DWARFDIE(unit, (DWARFDebugInfoEntry *)4LL);

This seems to be written in the "always use auto" style. That is definitely not 
consistent with the llvm coding style 
,
 as there's a shorter, more traditional way to write this, and the style guide 
explicitly rejects "always use auto".



Comment at: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp:44
+  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL));
+  EXPECT_EQ(2u, die_list.size());
+  EXPECT_EQ(die2, die_list[0]);

s/EXPECT/ASSERT


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66357



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


[Lldb-commits] [lldb] r369352 - [lldb] D66174 `RegularExpression` cleanup

2019-08-20 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue Aug 20 02:24:20 2019
New Revision: 369352

URL: http://llvm.org/viewvc/llvm-project?rev=369352&view=rev
Log:
[lldb] D66174 `RegularExpression` cleanup

I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI
as an advantage and there is already constructor parameter to compile the
regex.

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

Modified:
lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
lldb/trunk/include/lldb/Utility/RegularExpression.h
lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Core/AddressResolverName.cpp
lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
lldb/trunk/source/Interpreter/OptionValueRegex.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
lldb/trunk/source/Utility/RegularExpression.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h?rev=369352&r1=369351&r2=369352&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h Tue Aug 20 02:24:20 
2019
@@ -50,7 +50,7 @@ public:
 
   void SetCurrentValue(const char *value) {
 if (value && value[0])
-  m_regex.Compile(llvm::StringRef(value));
+  m_regex = RegularExpression(llvm::StringRef(value));
 else
   m_regex = RegularExpression();
   }

Modified: lldb/trunk/include/lldb/Utility/RegularExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/RegularExpression.h?rev=369352&r1=369351&r2=369352&view=diff
==
--- lldb/trunk/include/lldb/Utility/RegularExpression.h (original)
+++ lldb/trunk/include/lldb/Utility/RegularExpression.h Tue Aug 20 02:24:20 2019
@@ -23,7 +23,18 @@ public:
   /// contains no compiled regular expression.
   RegularExpression() = default;
 
+  /// Constructor for a regular expression.
+  ///
+  /// Compile a regular expression using the supplied regular expression text.
+  /// The compiled regular expression lives in this object so that it can be
+  /// readily used for regular expression matches. Execute() can be called
+  /// after the regular expression is compiled.
+  ///
+  /// \param[in] string
+  /// An llvm::StringRef that represents the regular expression to compile.
+  //  String is not referenced anymore after the object is constructed.
   explicit RegularExpression(llvm::StringRef string);
+
   ~RegularExpression() = default;
 
   RegularExpression(const RegularExpression &rhs);
@@ -32,22 +43,6 @@ public:
   RegularExpression &operator=(RegularExpression &&rhs) = default;
   RegularExpression &operator=(const RegularExpression &rhs) = default;
 
-  /// Compile a regular expression.
-  ///
-  /// Compile a regular expression using the supplied regular expression text.
-  /// The compiled regular expression lives in this object so that it can be
-  /// readily used for regular expression matches. Execute() can be called
-  /// after the regular expression is compiled. Any previously compiled
-  /// regular expression contained in this object will be freed.
-  ///
-  /// \param[in] re
-  /// A NULL terminated C string that represents the regular
-  /// expression to compile.
-  ///
-  /// \return \b true if the regular expression compiles successfully, \b false
-  /// otherwise.
-  bool Compile(llvm::StringRef string);
-
   /// Executes a regular expression.
   ///
   /// Execute a regular expression match using the compiled regular expression
@@ -65,7 +60,7 @@ public:
   /// matches, or nullptr if no parenthesized matching is needed.
   ///
   /// \return \b true if \a string matches the compiled regular expression, \b
-  /// false otherwise.
+  /// false otherwise incl. the case regular exression failed to compile.
   bool Execute(llvm::StringRef string,
llvm::SmallVectorImpl *matches = nullptr) 
const;
 

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=369352&r1=369351&r2=369352&view=diff
==
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointReso

[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-20 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
jankratochvil marked 2 inline comments as done.
Closed by commit rL369352: [lldb] D66174 `RegularExpression` cleanup (authored 
by jankratochvil, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66392?vs=215897&id=216079#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66392

Files:
  lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
  lldb/trunk/include/lldb/Utility/RegularExpression.h
  lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
  lldb/trunk/source/Commands/CommandCompletions.cpp
  lldb/trunk/source/Commands/CommandObjectFrame.cpp
  lldb/trunk/source/Commands/CommandObjectType.cpp
  lldb/trunk/source/Core/AddressResolverName.cpp
  lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
  lldb/trunk/source/Interpreter/OptionValueRegex.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/trunk/source/Target/ThreadPlanStepInRange.cpp
  lldb/trunk/source/Utility/RegularExpression.cpp

Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -332,11 +332,12 @@
 std::string regex_str = "^";
 regex_str += echo_packet;
 regex_str += "$";
-response_regex.Compile(regex_str);
+response_regex = RegularExpression(regex_str);
   } else {
 echo_packet_len =
 ::snprintf(echo_packet, sizeof(echo_packet), "qC");
-response_regex.Compile(llvm::StringRef("^QC[0-9A-Fa-f]+$"));
+response_regex =
+RegularExpression(llvm::StringRef("^QC[0-9A-Fa-f]+$"));
   }
 
   PacketResult echo_packet_result =
Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -442,21 +442,12 @@
   // elements fails the contents of &coord are undefined and `false` is
   // returned, `true` otherwise
 
-  RegularExpression regex;
   llvm::SmallVector matches;
 
-  bool matched = false;
-  if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+),([0-9]+)$")) &&
-  regex.Execute(coord_s, &matches))
-matched = true;
-  else if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+)$")) &&
-   regex.Execute(coord_s, &matches))
-matched = true;
-  else if (regex.Compile(llvm::StringRef("^([0-9]+)$")) &&
-   regex.Execute(coord_s, &matches))
-matched = true;
-
-  if (!matched)
+  if (!RegularExpression("^([0-9]+),([0-9]+),([0-9]+)$")
+   .Execute(coord_s, &matches) &&
+  !RegularExpression("^([0-9]+),([0-9]+)$").Execute(coord_s, &matches) &&
+  !RegularExpression("^([0-9]+)$").Execute(coord_s, &matches))
 return false;
 
   auto get_index = [&](size_t idx, uint32_t &i) -> bool {
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -582,9 +582,9 @@
 case 0:
   break;
 case 1: {
-  regex_up.reset(new RegularExpression());
-  if (!regex_up->Compile(llvm::StringRef::withNullAsEmpty(
-  command.GetArgumentAtIndex(0 {
+  regex_up.reset(new RegularExpression(
+  llvm::StringRef::withNullAsEmpty(command.GetArgumentAtIndex(0;
+  if (!regex_up->IsValid()) {
 result.AppendError(
 "invalid argument - please provide a valid regular expression");
 result.SetStatus(lldb::eReturnStatusFailed);
Index: lldb/trunk/source/Commands/CommandObjectFrame.cpp
===
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp
@@ -534,7 +534,7 @@
 const size_t regex_start_index = regex_var_list.GetSize();
 llvm::StringRef name_str = entry.ref;
 RegularExpression regex(name_str);
-if (regex.Compile(name_str)) {
+if (regex.IsValid()) {
   size_t num_matches = 0;
   const si

[Lldb-commits] [PATCH] D66392: 1/2: D66174 `RegularExpression` cleanup

2019-08-20 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

Thanks for the review, I hope my updates for the check-in are fine.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66392



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


[Lldb-commits] [lldb] r369353 - [lldb][NFC] Test quotes when completing

2019-08-20 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Tue Aug 20 02:26:58 2019
New Revision: 369353

URL: http://llvm.org/viewvc/llvm-project?rev=369353&view=rev
Log:
[lldb][NFC] Test quotes when completing

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=369353&r1=369352&r2=369353&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
 Tue Aug 20 02:26:58 2019
@@ -91,6 +91,32 @@ class CommandLineCompletionTestCase(Test
'arm64'])
 
 @skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_quoted_command(self):
+self.complete_from_to('"set',
+  ['"settings" '])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_quoted_arg_with_quoted_command(self):
+self.complete_from_to('"settings" "repl',
+  ['"replace" '])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_quoted_arg_without_quoted_command(self):
+self.complete_from_to('settings "repl',
+  ['"replace" '])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_single_quote_command(self):
+self.complete_from_to("'set",
+  ["'settings' "])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
+def test_terminated_quote_command(self):
+# This should not crash, but we don't get any
+# reasonable completions from this.
+self.complete_from_to("'settings'", [])
+
+@skipIfFreeBSD  # timing out on the FreeBSD buildbot
 def test_process_launch_arch_arm(self):
 self.complete_from_to('process launch --arch arm',
   ['arm64'])


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


[Lldb-commits] [lldb] r369371 - [cmake] Remove the test for libstdc++<4.9

2019-08-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug 20 05:17:42 2019
New Revision: 369371

URL: http://llvm.org/viewvc/llvm-project?rev=369371&view=rev
Log:
[cmake] Remove the test for libstdc++<4.9

It is no longer relevant now that llvm requires >=5.1.

Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=369371&r1=369370&r2=369371&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Aug 20 05:17:42 2019
@@ -437,28 +437,6 @@ if (NOT LLDB_DISABLE_CURSES)
 include_directories(${CURSES_INCLUDE_DIR})
 endif ()
 
-check_cxx_symbol_exists("__GLIBCXX__" "string" LLDB_USING_LIBSTDCXX)
-if(LLDB_USING_LIBSTDCXX)
-# There doesn't seem to be an easy way to check the library version. 
Instead, we rely on the
-# fact that std::set did not have the allocator constructor available 
until version 4.9
-check_cxx_source_compiles("
-#include 
-std::set s = std::set(std::allocator());
-int main() { return 0; }"
-LLDB_USING_LIBSTDCXX_4_9)
-if (NOT LLDB_USING_LIBSTDCXX_4_9 AND NOT LLVM_ENABLE_EH)
-message(WARNING
-"You appear to be linking to libstdc++ version lesser than 4.9 
without exceptions "
-"enabled. These versions of the library have an issue, which 
causes occasional "
-"lldb crashes. See 
 for "
-"details. Possible courses of action are:\n"
-"- use libstdc++ version 4.9 or newer\n"
-"- use libc++ (via LLVM_ENABLE_LIBCXX)\n"
-"- enable exceptions (via LLVM_ENABLE_EH)\n"
-"- ignore this warning and accept occasional instability")
-endif()
-endif()
-
 if ((CMAKE_SYSTEM_NAME MATCHES "Android") AND LLVM_BUILD_STATIC AND
 ((ANDROID_ABI MATCHES "armeabi") OR (ANDROID_ABI MATCHES "mips")))
   add_definitions(-DANDROID_USE_ACCEPT_WORKAROUND)


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


[Lldb-commits] [lldb] r369374 - unittests: Use yaml2obj as a library instead of an external process

2019-08-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug 20 05:28:36 2019
New Revision: 369374

URL: http://llvm.org/viewvc/llvm-project?rev=369374&view=rev
Log:
unittests: Use yaml2obj as a library instead of an external process

Summary:
Recently, yaml2obj has been turned into a library. This means we can use
it from our unit tests directly, instead of shelling out to an external
process. This patch does just that.

Reviewers: JDevlieghere, aadsm, espindola, jdoerfert

Subscribers: emaste, mgorny, arichardson, MaskRay, jhenderson, abrachet, 
lldb-commits

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

Removed:
lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml

lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml
lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml
Modified:
lldb/trunk/unittests/Core/CMakeLists.txt
lldb/trunk/unittests/Core/MangledTest.cpp
lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
lldb/trunk/unittests/Symbol/CMakeLists.txt
lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
lldb/trunk/unittests/Symbol/TestLineEntry.cpp
lldb/trunk/unittests/TestingSupport/CMakeLists.txt
lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
lldb/trunk/unittests/TestingSupport/TestUtilities.h

Modified: lldb/trunk/unittests/Core/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/CMakeLists.txt?rev=369374&r1=369373&r2=369374&view=diff
==
--- lldb/trunk/unittests/Core/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Core/CMakeLists.txt Tue Aug 20 05:28:36 2019
@@ -15,8 +15,3 @@ add_lldb_unittest(LLDBCoreTests
   LINK_COMPONENTS
 Support
   )
-
-set(test_inputs
-  mangled-function-names.yaml
-  )
-add_unittest_inputs(LLDBCoreTests "${test_inputs}")

Removed: lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml?rev=369373&view=auto
==
--- lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml (original)
+++ lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml (removed)
@@ -1,129 +0,0 @@
 !ELF
-FileHeader:  
-  Class:   ELFCLASS64
-  Data:ELFDATA2LSB
-  Type:ET_EXEC
-  Machine: EM_X86_64
-Sections:
-  - Name:.text
-Type:SHT_PROGBITS
-Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
-AddressAlign:0x0010
-Content: 554889E58B0425A8005DC30F1F00
-  - Name:.anothertext
-Type:SHT_PROGBITS
-Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
-Address: 0x0010
-AddressAlign:0x0010
-Content: 
554889E54883EC20488D0425A800C745FC488945F0488B45F08B08894DECE8C7FF8B4DEC01C189C84883C4205D746573742073747200C3
-  - Name:.eh_frame
-Type:SHT_PROGBITS
-Flags:   [ SHF_ALLOC ]
-Address: 0x0050
-AddressAlign:0x0008
-Content: 
1400017A5200017810011B0C070890011C001C0090FF0D410E108602430D06001C003C0080FF3F410E108602430D0600
-  - Name:.data
-Type:SHT_PROGBITS
-Flags:   [ SHF_WRITE, SHF_ALLOC ]
-Address: 0x00A8
-AddressAlign:0x0004
-Content: '0100'
-  - Name:.comment
-Type:SHT_PROGBITS
-Flags:   [ SHF_MERGE, SHF_STRINGS ]
-AddressAlign:0x0001
-Content: 
5562756E747520636C616E672076657273696F6E20332E352D317562756E74753120287472756E6B2920286261736564206F6E204C4C564D20332E352900
-Symbols:
-  - Type:STT_SECTION
-Section: .text
-  - Type:STT_SECTION
-Section: .anothertext
-Value:   0x0010
-  - Type:STT_SECTION
-Section: .eh_frame
-Value:   0x0050
-  - Type:STT_SECTION
-Section: .data
-Value:   0x00A8
-  - Type:STT_SECTION
-Section: .comment
-  - Name:/tmp/a.c
-Type:STT_FILE
-  - Type:STT_FILE  
-  - Name:somedata
-Type:STT_OBJECT
-Section: .anothertext
-Value:   0x0045
-Binding: STB_GLOBAL
-  - Name:main
-Type:STT_FUNC
-Section: .anothertext
-Value:   0x0010
-Size:0x003F
-Binding: STB_GLOBAL
-  - Name:_Z3foov
-

[Lldb-commits] [PATCH] D65949: unittests: Use yaml2obj as a library instead of an external process

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369374: unittests: Use yaml2obj as a library instead of an 
external process (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D65949

Files:
  lldb/trunk/unittests/Core/CMakeLists.txt
  lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml
  lldb/trunk/unittests/Core/MangledTest.cpp
  lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
  lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml
  lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
  lldb/trunk/unittests/Symbol/CMakeLists.txt
  lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml
  lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
  lldb/trunk/unittests/Symbol/TestLineEntry.cpp
  lldb/trunk/unittests/TestingSupport/CMakeLists.txt
  lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
  lldb/trunk/unittests/TestingSupport/TestUtilities.h

Index: lldb/trunk/unittests/TestingSupport/TestUtilities.h
===
--- lldb/trunk/unittests/TestingSupport/TestUtilities.h
+++ lldb/trunk/unittests/TestingSupport/TestUtilities.h
@@ -12,6 +12,7 @@
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/FileUtilities.h"
 #include 
 
 #define ASSERT_NO_ERROR(x) \
@@ -27,8 +28,28 @@
 
 namespace lldb_private {
 std::string GetInputFilePath(const llvm::Twine &name);
-llvm::Error ReadYAMLObjectFile(const llvm::Twine &yaml_name,
-   llvm::SmallString<128> &obj);
+
+class TestFile {
+public:
+  static llvm::Expected fromYaml(llvm::StringRef Yaml);
+  static llvm::Expected fromYamlFile(const llvm::Twine &Name);
+
+  TestFile(TestFile &&RHS) : Name(std::move(RHS.Name)) {
+RHS.Name = llvm::None;
+  }
+
+  ~TestFile();
+
+  llvm::StringRef name() { return *Name; }
+
+private:
+  TestFile(llvm::StringRef Name, llvm::FileRemover &&Remover) : Name(Name) {
+Remover.releaseFile();
+  }
+  void operator=(const TestFile &) = delete;
+
+  llvm::Optional Name;
+};
 }
 
 #endif
Index: lldb/trunk/unittests/TestingSupport/CMakeLists.txt
===
--- lldb/trunk/unittests/TestingSupport/CMakeLists.txt
+++ lldb/trunk/unittests/TestingSupport/CMakeLists.txt
@@ -8,7 +8,5 @@
 
   LINK_COMPONENTS
 Support
+ObjectYAML
   )
-
-add_dependencies(lldbUtilityHelpers yaml2obj)
-add_definitions(-DYAML2OBJ="$")
\ No newline at end of file
Index: lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
===
--- lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
+++ lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
@@ -8,9 +8,14 @@
 
 #include "TestUtilities.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ObjectYAML/yaml2obj.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
+#include "llvm/Support/YAMLTraits.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
 
 extern const char *TestMainArgv0;
 
@@ -21,23 +26,39 @@
   return result.str();
 }
 
-llvm::Error
-lldb_private::ReadYAMLObjectFile(const llvm::Twine &yaml_name,
- llvm::SmallString<128> &object_file) {
-  std::string yaml = GetInputFilePath(yaml_name);
-  llvm::StringRef args[] = {YAML2OBJ, yaml};
-  llvm::StringRef obj_ref = object_file;
-  const llvm::Optional redirects[] = {llvm::None, obj_ref,
-   llvm::None};
-  if (llvm::sys::ExecuteAndWait(YAML2OBJ, args, llvm::None, redirects) != 0)
-return llvm::createStringError(llvm::inconvertibleErrorCode(),
-   "Error running yaml2obj %s.", yaml.c_str());
-  uint64_t size;
-  if (auto ec = llvm::sys::fs::file_size(object_file, size))
-return llvm::errorCodeToError(ec);
-  if (size == 0)
-return llvm::createStringError(
-llvm::inconvertibleErrorCode(),
-"Empty object file created from yaml2obj %s.", yaml.c_str());
-  return llvm::Error::success();
+llvm::Expected TestFile::fromYaml(llvm::StringRef Yaml) {
+  const auto *Info = testing::UnitTest::GetInstance()->current_test_info();
+  assert(Info);
+  llvm::SmallString<128> Name;
+  int FD;
+  if (std::error_code EC = llvm::sys::fs::createTemporaryFile(
+  llvm::Twine(Info->test_case_name()) + "-" + Info->name(), "test", FD,
+  Name))
+return llvm::errorCodeToError(EC);
+  llvm::FileRemover Remover(Name);
+  {
+llvm::raw_fd_ostream OS(FD, /*shouldClose*/ true);
+llvm::yaml::Input YIn(Yaml);
+if (llvm::Error E = llvm::yaml::convertYAML(YIn, OS))
+ 

[Lldb-commits] [lldb] r369379 - Convert minidump unittests to use llvm::yaml::convertYAML

2019-08-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug 20 05:53:42 2019
New Revision: 369379

URL: http://llvm.org/viewvc/llvm-project?rev=369379&view=rev
Log:
Convert minidump unittests to use llvm::yaml::convertYAML

previously they used a minidump-specific function for this purpose, but
this is no longer needed now that whole of yaml2obj is available as a
library.

Modified:
lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp

Modified: lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp?rev=369379&r1=369378&r2=369379&view=diff
==
--- lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp (original)
+++ lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Tue Aug 20 
05:53:42 2019
@@ -19,10 +19,11 @@
 #include "lldb/Utility/FileSpec.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
-#include "llvm/ObjectYAML/MinidumpYAML.h"
+#include "llvm/ObjectYAML/yaml2obj.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/YAMLTraits.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 
@@ -54,7 +55,8 @@ public:
   llvm::Error SetUpFromYaml(llvm::StringRef yaml) {
 std::string data;
 llvm::raw_string_ostream os(data);
-if (llvm::Error E = llvm::MinidumpYAML::writeAsBinary(yaml, os))
+llvm::yaml::Input YIn(yaml);
+if (llvm::Error E = llvm::yaml::convertYAML(YIn, os))
   return E;
 
 os.flush();
@@ -73,16 +75,15 @@ public:
 TEST_F(MinidumpParserTest, InvalidMinidump) {
   std::string duplicate_streams;
   llvm::raw_string_ostream os(duplicate_streams);
-  ASSERT_THAT_ERROR(llvm::MinidumpYAML::writeAsBinary(R"(
+  llvm::yaml::Input YIn(R"(
 --- !minidump
 Streams:
   - Type:LinuxAuxv
 Content: DEADBEEFBAADF00D
   - Type:LinuxAuxv
 Content: DEADBEEFBAADF00D
-  )",
-  os),
-llvm::Succeeded());
+  )");
+  ASSERT_THAT_ERROR(llvm::yaml::convertYAML(YIn, os), llvm::Succeeded());
   os.flush();
   auto data_buffer_sp = std::make_shared(
   duplicate_streams.data(), duplicate_streams.size());


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


[Lldb-commits] [lldb] r369381 - Fix build for r369374

2019-08-20 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Aug 20 06:17:20 2019
New Revision: 369381

URL: http://llvm.org/viewvc/llvm-project?rev=369381&view=rev
Log:
Fix build for r369374

This patch added some gtest code to the TestingSupport library. As this
is not a unit test, but a unit test library, gtest does not get added to
the include path automatically, but we have to do that ourselves. (It
was working for me without this because the compiler picked up the
system gtest instead.)

Modified:
lldb/trunk/unittests/TestingSupport/CMakeLists.txt

Modified: lldb/trunk/unittests/TestingSupport/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/TestingSupport/CMakeLists.txt?rev=369381&r1=369380&r2=369381&view=diff
==
--- lldb/trunk/unittests/TestingSupport/CMakeLists.txt (original)
+++ lldb/trunk/unittests/TestingSupport/CMakeLists.txt Tue Aug 20 06:17:20 2019
@@ -10,3 +10,4 @@ add_lldb_library(lldbUtilityHelpers
 Support
 ObjectYAML
   )
+include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)


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


[Lldb-commits] [PATCH] D66429: [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D66429#1636655 , @labath wrote:

> That said, I'm not a fan of force-overwriting cache variables specified by 
> the user, particularly when the same effect can be achieved by *deleting* the 
> cache variable instead of setting it to an empty string. I think you should 
> be able to reset the default value of `LLDB_TEST_C_COMPILER` (just like any 
> other cmake variable) by running `cmake -ULLDB_TEST_C_COMPILER`. You can even 
> delete both variables at once with `-ULLDB_TEST_*_COMPILER`.


Sounds good to me, I'll update the patch. The only reason I did it this way is 
because I wasn't sure everyone knew about this functionality.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66429



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


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added inline comments.



Comment at: lldb/source/DataFormatters/FormatManager.cpp:950
+  RegularExpression any_size_char_arr(llvm::StringRef("char \\[[0-9]+\\]"));
+#if 0 // FIXME: unused:
+  RegularExpression any_size_wchar_arr(llvm::StringRef("wchar_t 
\\[[0-9]+\\]"));

I'd just remove this


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398



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


[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-20 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade updated this revision to Diff 216166.
guiandrade marked 3 inline comments as done.
guiandrade added a comment.

I'm fixing the style issues pointed by @labath, but I acknowledge the flakiness 
of this test the way it is right now and am open to deleting it. I can also try 
to spend some time trying to implement it in a more proper manner. It's your 
call, @clayborg.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66357

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp


Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -0,0 +1,47 @@
+//===-- DWARFASTParserClangTests.cpp *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+class DWARFASTParserClangStub : public DWARFASTParserClang {
+public:
+  using DWARFASTParserClang::DWARFASTParserClang;
+  using DWARFASTParserClang::LinkDeclContextToDIE;
+};
+} // namespace
+
+// If your implementation needs to dereference the dummy pointers we are
+// defining here, causing this test to fail, feel free to delete it.
+TEST(DWARFASTParserClangTests,
+ TestGetDIEForDeclContextReturnsOnlyMatchingEntries) {
+  ClangASTContext ast_ctx;
+  DWARFASTParserClangStub ast_parser(ast_ctx);
+
+  DWARFUnit *unit = nullptr;
+  DWARFDIE die1(unit, (DWARFDebugInfoEntry *)1LL);
+  DWARFDIE die2(unit, (DWARFDebugInfoEntry *)2LL);
+  DWARFDIE die3(unit, (DWARFDebugInfoEntry *)3LL);
+  DWARFDIE die4(unit, (DWARFDebugInfoEntry *)4LL);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)1LL, die1);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)2LL, die2);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)2LL, die3);
+  ast_parser.LinkDeclContextToDIE((clang::DeclContext *)3LL, die4);
+
+  auto die_list = ast_parser.GetDIEForDeclContext(
+  CompilerDeclContext(nullptr, (clang::DeclContext *)2LL));
+  ASSERT_EQ(2u, die_list.size());
+  ASSERT_EQ(die2, die_list[0]);
+  ASSERT_EQ(die3, die_list[1]);
+}
Index: lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
===
--- lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(SymbolFileDWARFTests
+  DWARFASTParserClangTests.cpp
   SymbolFileDWARFTests.cpp
 
   LINK_LIBS
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2183,9 +2183,10 @@
 std::vector DWARFASTParserClang::GetDIEForDeclContext(
 lldb_private::CompilerDeclContext decl_context) {
   std::vector result;
-  for (auto it = m_decl_ctx_to_die.find(
-   (clang::DeclContext *)decl_context.GetOpaqueDeclContext());
-   it != m_decl_ctx_to_die.end(); it++)
+  auto opaque_decl_ctx =
+  (clang::DeclContext *)decl_context.GetOpaqueDeclContext();
+  for (auto it = m_decl_ctx_to_die.find(opaque_decl_ctx);
+   it != m_decl_ctx_to_die.end() && it->first == opaque_decl_ctx; it++)
 result.push_back(it->second);
   return result;
 }


Index: lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
===
--- /dev/null
+++ lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
@@ -0,0 +1,47 @@
+//===-- DWARFASTParserClangTests.cpp *- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+class DWARFASTParserClangStub : public DWARFASTParserClang {
+public:
+  using DWARFASTParserClang::DWARFASTParserClang;
+  using DWARFASTParserClang::LinkDeclContextToDIE;
+};
+} /

[Lldb-commits] [lldb] r369398 - [lldb] Use the new Regex::isValid() with no parameter

2019-08-20 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Tue Aug 20 09:08:27 2019
New Revision: 369398

URL: http://llvm.org/viewvc/llvm-project?rev=369398&view=rev
Log:
[lldb] Use the new Regex::isValid() with no parameter

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

Modified:
lldb/trunk/source/Utility/RegularExpression.cpp

Modified: lldb/trunk/source/Utility/RegularExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/RegularExpression.cpp?rev=369398&r1=369397&r2=369398&view=diff
==
--- lldb/trunk/source/Utility/RegularExpression.cpp (original)
+++ lldb/trunk/source/Utility/RegularExpression.cpp Tue Aug 20 09:08:27 2019
@@ -28,10 +28,7 @@ bool RegularExpression::Execute(
   return m_regex.match(str, matches);
 }
 
-bool RegularExpression::IsValid() const {
-  std::string discarded;
-  return m_regex.isValid(discarded);
-}
+bool RegularExpression::IsValid() const { return m_regex.isValid(); }
 
 llvm::StringRef RegularExpression::GetText() const { return m_regex_text; }
 


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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 216175.
JDevlieghere marked an inline comment as done.
JDevlieghere added a comment.

- Address Pavel's comments.


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

https://reviews.llvm.org/D66447

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
  lldb/source/Symbol/ClangASTContext.cpp

Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -1378,11 +1378,12 @@
 
 case DW_ATE_UTF:
   if (type_name) {
-if (streq(type_name, "char16_t")) {
+if (streq(type_name, "char16_t"))
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());
-} else if (streq(type_name, "char32_t")) {
+else if (streq(type_name, "char32_t"))
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());
-}
+else if (streq(type_name, "char8_t"))
+  return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());
   }
   break;
 }
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
@@ -16,6 +16,9 @@
 
 namespace lldb_private {
 namespace formatters {
+bool Char8StringSummaryProvider(ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // char8_t*
+
 bool Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t* and unichar*
@@ -27,6 +30,9 @@
 bool WCharStringSummaryProvider(ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // wchar_t*
 
+bool Char8SummaryProvider(ValueObject &valobj, Stream &stream,
+  const TypeSummaryOptions &options); // char8_t
+
 bool Char16SummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t and unichar
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -32,6 +32,31 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+bool lldb_private::formatters::Char8StringSummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+return false;
+
+  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
+  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
+return false;
+
+  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+  options.SetLocation(valobj_addr);
+  options.SetProcessSP(process_sp);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+
+  if (!StringPrinter::ReadStringAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options)) {
+stream.Printf("Summary Unavailable");
+return true;
+  }
+
+  return true;
+}
+
 bool lldb_private::formatters::Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   ProcessSP process_sp = valobj.GetProcessSP();
@@ -128,6 +153,32 @@
   return true;
 }
 
+bool lldb_private::formatters::Char8SummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+
+  if (error.Fail())
+return false;
+
+  std::string value;
+  valobj.GetValueAsCString(lldb::eFormatUnicode8, value);
+  if (!value.empty())
+stream.Printf("%s ", value.c_str());
+
+  StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
+  options.SetData(data);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+  options.SetQuote('\'');
+  options.SetSourceSize(1);
+  options.SetBinaryZeroIsTerminator(false);
+
+  return StringPrinter::ReadBufferAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options);
+}
+
 bool lldb_private::formatters::Char16SummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   DataExtractor data;
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked an inline comment as done.
aprantl added inline comments.



Comment at: lldb/tools/lldb-test/lldb-test.cpp:145
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));

labath wrote:
> JDevlieghere wrote:
> > aprantl wrote:
> > > JDevlieghere wrote:
> > > > > ...as a JSON array...`
> > > > 
> > > > This makes me wonder though, wouldn't it be better to pass a file here 
> > > > and have it live in inputs? Do you expect it to be different across 
> > > > tests or could we reuse the context across tests?
> > > I don't really expect a DeclContexts to have more than 3 entries in the 
> > > forseeable future, so that would arguable just make the test harder to 
> > > read.
> > But would those entries be the same across tests or not? If they're the 
> > same I think it'd be better to reuse them, even if it's only a few entries.
> I actually think it is nice to have the entries present in the test file 
> directly. However, what I think will be an issue is that you need to use two 
> layers of quotes to pass a json string over the command line. I expect this 
> will cause problems on windows, because quoting works differently there.
> 
> What I would actually suggest is to ditch JSON, and use a custom format for 
> passing this. Maybe something like `--compiler-context 
> Module:CModule,Module:SubModule,...`. That would be both shorter and 
> completely avoid quotes. I don't think is should make parsing this 
> signtificantly more difficult than what you have now.
> But would those entries be the same across tests or not? If they're the same 
> I think it'd be better to reuse them, even if it's only a few entries.

No, they would be highly specific to the test. A context is a search criterium, 
something like "any class type called Foo nested inside a module called A".


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 216174.
aprantl added a comment.

Address Pavel's comments.


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

https://reviews.llvm.org/D66453

Files:
  lldb/lit/SymbolFile/DWARF/compilercontext.ll
  lldb/lit/SymbolFile/DWARF/lit.local.cfg
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -30,6 +30,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/CleanUp.h"
 #include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/JSON.h"
 #include "lldb/Utility/State.h"
 #include "lldb/Utility/StreamString.h"
 
@@ -139,6 +140,11 @@
 cl::desc("Restrict search to the context of the given variable."),
 cl::value_desc("variable"), cl::sub(SymbolsSubcommand));
 
+static cl::opt CompilerContext(
+"compiler-context",
+cl::desc("Specify a compiler context as \"kind:name,...\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));
+
 static cl::list FunctionNameFlags(
 "function-flags", cl::desc("Function search flags:"),
 cl::values(clEnumValN(eFunctionNameTypeAuto, "auto",
@@ -220,6 +226,46 @@
 
 } // namespace opts
 
+std::vector parseCompilerContext() {
+  std::vector result;
+  if (opts::symbols::CompilerContext.empty())
+return result;
+
+  StringRef str{opts::symbols::CompilerContext};
+  SmallVector entries_str;
+  str.split(entries_str, ',', /*maxSplit*/-1, /*keepEmpty=*/false);
+  for (auto entry_str : entries_str) {
+StringRef key, value;
+std::tie(key, value) = entry_str.split(':');
+auto kind =
+StringSwitch(key)
+.Case("TranslationUnit", CompilerContextKind::TranslationUnit)
+.Case("Module", CompilerContextKind::Module)
+.Case("Namespace", CompilerContextKind::Namespace)
+.Case("Class", CompilerContextKind::Class)
+.Case("Structure", CompilerContextKind::Structure)
+.Case("Union", CompilerContextKind::Union)
+.Case("Function", CompilerContextKind::Function)
+.Case("Variable", CompilerContextKind::Variable)
+.Case("Enumeration", CompilerContextKind::Enumeration)
+.Case("Typedef", CompilerContextKind::Typedef)
+.Default(CompilerContextKind::Invalid);
+if (value.empty()) {
+  WithColor::error() << "compiler context entry has no \"name\"\n";
+  exit(1);
+}
+result.push_back({kind, ConstString{value}});
+  }
+  outs() << "Search context: {\n";
+  for (auto entry: result) {
+outs() << " " << (unsigned)entry.type;
+outs() << " \"" << entry.name.GetStringRef() << "\"\n";
+  }
+  outs() << "}\n";
+
+  return result;
+}
+
 template 
 static Error make_string_error(const char *Format, Args &&... args) {
   return llvm::make_error(
@@ -464,8 +510,11 @@
 
   DenseSet SearchedFiles;
   TypeMap Map;
-  Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
-   SearchedFiles, Map);
+  if (!Name.empty())
+Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
+  SearchedFiles, Map);
+  else
+Symfile.FindTypes(parseCompilerContext(), true, Map);
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;
@@ -679,6 +728,9 @@
 if (Regex || !File.empty() || Line != 0)
   return make_string_error("Cannot search for types using regular "
"expressions, file names or line numbers.");
+if (!Name.empty() && !CompilerContext.empty())
+  return make_string_error("Name is ignored if compiler context present.");
+
 return findTypes;
 
   case FindType::Variable:
Index: lldb/lit/SymbolFile/DWARF/lit.local.cfg
===
--- lldb/lit/SymbolFile/DWARF/lit.local.cfg
+++ lldb/lit/SymbolFile/DWARF/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.cpp', '.s', '.test']
+config.suffixes = ['.cpp', '.s', '.test', '.ll']
Index: lldb/lit/SymbolFile/DWARF/compilercontext.ll
===
--- /dev/null
+++ lldb/lit/SymbolFile/DWARF/compilercontext.ll
@@ -0,0 +1,35 @@
+; Test finding types by CompilerContext.
+; RUN: llc %s -filetype=obj -o %t.o
+; RUN: lldb-test symbols %t.o -find=type -compiler-context="Module:CModule,Module:SubModule,Structure:FromSubmodule" | FileCheck %s
+;  
+;  
+; CHECK: Found 1 types:
+; CHECK: struct FromSubmodule {
+; CHECK-NEXT: unsigned int x;
+; CHECK-NEXT: unsigned int y;
+; CHECK-NEXT: unsigned int z;
+; CHECK-NEXT: }
+
+source_filename = "/t.c"
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.14.0"
+
+!llvm.dbg.cu = !{!2}
+!llvm.linker.options = !{}
+!llvm.module.flags = !{!18, !19}
+!llvm.ident = !{!22}
+
+; This simulates the debug info

[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D66447#1636456 , @jblachly wrote:

> Thank you for creating a revision and reviewing this.
>
> I made inline comments on the test harness and Dlang types / qualifiers.
>
> With removal of the Dlang types, where is the appropriate place to put them?
>  It is not clear to me whether language plugins can replace the functionality 
> in ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize.
>
> Thanks again


Thanks James. I removed the DLang part from this patch because it's orthogonal 
to the `char8_t` support. The changes might be fine but they really should have 
their own differential and test. I'll try to put up another patch later today 
if I find the time.


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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/tools/lldb-test/lldb-test.cpp:145
+"compiler-context",
+cl::desc("Specify a compiler context as \"[(type,name),...]\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));

aprantl wrote:
> labath wrote:
> > JDevlieghere wrote:
> > > aprantl wrote:
> > > > JDevlieghere wrote:
> > > > > > ...as a JSON array...`
> > > > > 
> > > > > This makes me wonder though, wouldn't it be better to pass a file 
> > > > > here and have it live in inputs? Do you expect it to be different 
> > > > > across tests or could we reuse the context across tests?
> > > > I don't really expect a DeclContexts to have more than 3 entries in the 
> > > > forseeable future, so that would arguable just make the test harder to 
> > > > read.
> > > But would those entries be the same across tests or not? If they're the 
> > > same I think it'd be better to reuse them, even if it's only a few 
> > > entries.
> > I actually think it is nice to have the entries present in the test file 
> > directly. However, what I think will be an issue is that you need to use 
> > two layers of quotes to pass a json string over the command line. I expect 
> > this will cause problems on windows, because quoting works differently 
> > there.
> > 
> > What I would actually suggest is to ditch JSON, and use a custom format for 
> > passing this. Maybe something like `--compiler-context 
> > Module:CModule,Module:SubModule,...`. That would be both shorter and 
> > completely avoid quotes. I don't think is should make parsing this 
> > signtificantly more difficult than what you have now.
> > But would those entries be the same across tests or not? If they're the 
> > same I think it'd be better to reuse them, even if it's only a few entries.
> 
> No, they would be highly specific to the test. A context is a search 
> criterium, something like "any class type called Foo nested inside a module 
> called A".
Okay, in that case passing them on the command line is definitely the way to go.


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 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.

lgtm




Comment at: lldb/tools/lldb-test/lldb-test.cpp:33
 #include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/JSON.h"
 #include "lldb/Utility/State.h"

I guess this is not needed now.


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

https://reviews.llvm.org/D66453



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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This looks good to me, but why are we using a nul character to test utf8 
support? Shouldn't we insert some funnier characters too? I mean, one of the 
advantages of unicode is that it should not be affected by the system code 
pages and such, so hopefully this would not cause problems even on some more 
exotic setups. (And I am pretty sure I remember already seeing some chinese 
chars in some of our data formatter tests)




Comment at: lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/Makefile:6
+
+clean: OBJECTS+=$(wildcard main.d.*)
+

I'm pretty sure this part isn't needed too, particularly as we now don't even 
run the clean actions.


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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [PATCH] D66248: [JIT][Command] Add "inject-condition" flag to conditional breakpoints

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py:45
+
+def enable_injected_breakpoint_condition(self, cli):
+exe = self.getBuildArtifact(self.binary)

mib wrote:
> JDevlieghere wrote:
> > What does `cli` stand for?
> CLI = Command Line Interface. In this case, it means running the command 
> through the "REPL" instead of the SBAPI, to test if it works properly.
That's definitely not clear from the variable. How about `use_sbapi` or 
`use_interpreter` instead? 



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py:79
+# indeed, being set correctly.
+# there's only one thread for the process.
+breakpoint.SetThreadIndex(1)

> ... being set correctly and that there's only ...



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py:93
+
+# Set the condition on the breakpoint
+location.SetCondition(self.condition)

Add full stop



Comment at: lldb/source/API/SBBreakpointLocation.cpp:214
+  BreakpointLocationSP loc_sp = GetSP();
+  if (loc_sp) {
+std::lock_guard guard(

Early return?



Comment at: lldb/source/API/SBBreakpointLocation.cpp:226
+  BreakpointLocationSP loc_sp = GetSP();
+  if (loc_sp) {
+std::lock_guard guard(

Early return?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66248



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


[Lldb-commits] [lldb] r369407 - Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Tue Aug 20 09:44:25 2019
New Revision: 369407

URL: http://llvm.org/viewvc/llvm-project?rev=369407&view=rev
Log:
Make the FindTypes(std::vector, ...) API testable in lldb-test

This adds a -compiler-context=<...> option to lldb-test that trakes a
comma-separated string that is a list of kind/name pairs and
translates it into a std::vector, a CompilerContext
being a pair of context-kind and name.

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



Added:
lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
Modified:
lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg
lldb/trunk/tools/lldb-test/lldb-test.cpp

Added: lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll?rev=369407&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll Tue Aug 20 09:44:25 2019
@@ -0,0 +1,35 @@
+; Test finding types by CompilerContext.
+; RUN: llc %s -filetype=obj -o %t.o
+; RUN: lldb-test symbols %t.o -find=type 
-compiler-context="Module:CModule,Module:SubModule,Structure:FromSubmodule" | 
FileCheck %s
+;
+;
+; CHECK: Found 1 types:
+; CHECK: struct FromSubmodule {
+; CHECK-NEXT: unsigned int x;
+; CHECK-NEXT: unsigned int y;
+; CHECK-NEXT: unsigned int z;
+; CHECK-NEXT: }
+
+source_filename = "/t.c"
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.14.0"
+
+!llvm.dbg.cu = !{!2}
+!llvm.linker.options = !{}
+!llvm.module.flags = !{!18, !19}
+!llvm.ident = !{!22}
+
+; This simulates the debug info for a Clang module.
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: 
"clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, 
nameTableKind: GNU, retainedTypes: !{!11})
+!3 = !DIFile(filename: "t.c", directory: "/")
+!8 = !DIModule(scope: !9, name: "SubModule", includePath: "", isysroot: "/")
+!9 = !DIModule(scope: null, name: "CModule", includePath: "", isysroot: "/")
+!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: 
"FromSubmodule", scope: !8, file: !3, line: 1, size: 96, elements: !13)
+!13 = !{!14, !16, !17}
+!14 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !3, 
line: 2, baseType: !15, size: 32)
+!15 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
+!16 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !11, file: !3, 
line: 2, baseType: !15, size: 32, offset: 32)
+!17 = !DIDerivedType(tag: DW_TAG_member, name: "z", scope: !11, file: !3, 
line: 2, baseType: !15, size: 32, offset: 64)
+!18 = !{i32 2, !"Dwarf Version", i32 4}
+!19 = !{i32 2, !"Debug Info Version", i32 3}
+!22 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project 
056f1b5cc7c2133f0cb3e30e7f24808d321096d7)"}

Modified: lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg?rev=369407&r1=369406&r2=369407&view=diff
==
--- lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg (original)
+++ lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg Tue Aug 20 09:44:25 2019
@@ -1 +1 @@
-config.suffixes = ['.cpp', '.s', '.test']
+config.suffixes = ['.cpp', '.s', '.test', '.ll']

Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=369407&r1=369406&r2=369407&view=diff
==
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Tue Aug 20 09:44:25 2019
@@ -139,6 +139,11 @@ static cl::opt
 cl::desc("Restrict search to the context of the given variable."),
 cl::value_desc("variable"), cl::sub(SymbolsSubcommand));
 
+static cl::opt CompilerContext(
+"compiler-context",
+cl::desc("Specify a compiler context as \"kind:name,...\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));
+
 static cl::list FunctionNameFlags(
 "function-flags", cl::desc("Function search flags:"),
 cl::values(clEnumValN(eFunctionNameTypeAuto, "auto",
@@ -220,6 +225,44 @@ int evaluateMemoryMapCommands(Debugger &
 
 } // namespace opts
 
+std::vector parseCompilerContext() {
+  std::vector result;
+  if (opts::symbols::CompilerContext.empty())
+return result;
+
+  StringRef str{opts::symbols::CompilerContext};
+  SmallVector entries_str;
+  str.split(entries_str, ',', /*maxSplit*/-1, /*keepEmpty=*/false);
+  for (auto entry_str : entries_str) {
+StringRef key, value;
+std::tie(key, value) = entry_str.split(':');
+auto kind =
+StringSwitch(key)
+.Case("TranslationUnit", CompilerContextKind::TranslationUnit)
+.Case("Module", Comp

[Lldb-commits] [PATCH] D66453: Make the FindTypes(std::vector, ...) API testable in lldb-test

2019-08-20 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369407: Make the 
FindTypes(std::vector, ...) API testable in lldb-test 
(authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66453?vs=216174&id=216187#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66453

Files:
  lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
  lldb/trunk/lit/SymbolFile/DWARF/lit.local.cfg
  lldb/trunk/tools/lldb-test/lldb-test.cpp

Index: lldb/trunk/tools/lldb-test/lldb-test.cpp
===
--- lldb/trunk/tools/lldb-test/lldb-test.cpp
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp
@@ -139,6 +139,11 @@
 cl::desc("Restrict search to the context of the given variable."),
 cl::value_desc("variable"), cl::sub(SymbolsSubcommand));
 
+static cl::opt CompilerContext(
+"compiler-context",
+cl::desc("Specify a compiler context as \"kind:name,...\"."),
+cl::value_desc("context"), cl::sub(SymbolsSubcommand));
+
 static cl::list FunctionNameFlags(
 "function-flags", cl::desc("Function search flags:"),
 cl::values(clEnumValN(eFunctionNameTypeAuto, "auto",
@@ -220,6 +225,44 @@
 
 } // namespace opts
 
+std::vector parseCompilerContext() {
+  std::vector result;
+  if (opts::symbols::CompilerContext.empty())
+return result;
+
+  StringRef str{opts::symbols::CompilerContext};
+  SmallVector entries_str;
+  str.split(entries_str, ',', /*maxSplit*/-1, /*keepEmpty=*/false);
+  for (auto entry_str : entries_str) {
+StringRef key, value;
+std::tie(key, value) = entry_str.split(':');
+auto kind =
+StringSwitch(key)
+.Case("TranslationUnit", CompilerContextKind::TranslationUnit)
+.Case("Module", CompilerContextKind::Module)
+.Case("Namespace", CompilerContextKind::Namespace)
+.Case("Class", CompilerContextKind::Class)
+.Case("Structure", CompilerContextKind::Structure)
+.Case("Union", CompilerContextKind::Union)
+.Case("Function", CompilerContextKind::Function)
+.Case("Variable", CompilerContextKind::Variable)
+.Case("Enumeration", CompilerContextKind::Enumeration)
+.Case("Typedef", CompilerContextKind::Typedef)
+.Default(CompilerContextKind::Invalid);
+if (value.empty()) {
+  WithColor::error() << "compiler context entry has no \"name\"\n";
+  exit(1);
+}
+result.push_back({kind, ConstString{value}});
+  }
+  outs() << "Search context: {\n";
+  for (auto entry: result)
+entry.Dump();
+  outs() << "}\n";
+
+  return result;
+}
+
 template 
 static Error make_string_error(const char *Format, Args &&... args) {
   return llvm::make_error(
@@ -464,8 +507,11 @@
 
   DenseSet SearchedFiles;
   TypeMap Map;
-  Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
-   SearchedFiles, Map);
+  if (!Name.empty())
+Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
+  SearchedFiles, Map);
+  else
+Symfile.FindTypes(parseCompilerContext(), true, Map);
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;
@@ -679,6 +725,9 @@
 if (Regex || !File.empty() || Line != 0)
   return make_string_error("Cannot search for types using regular "
"expressions, file names or line numbers.");
+if (!Name.empty() && !CompilerContext.empty())
+  return make_string_error("Name is ignored if compiler context present.");
+
 return findTypes;
 
   case FindType::Variable:
Index: lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
===
--- lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
+++ lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
@@ -0,0 +1,35 @@
+; Test finding types by CompilerContext.
+; RUN: llc %s -filetype=obj -o %t.o
+; RUN: lldb-test symbols %t.o -find=type -compiler-context="Module:CModule,Module:SubModule,Structure:FromSubmodule" | FileCheck %s
+;
+;
+; CHECK: Found 1 types:
+; CHECK: struct FromSubmodule {
+; CHECK-NEXT: unsigned int x;
+; CHECK-NEXT: unsigned int y;
+; CHECK-NEXT: unsigned int z;
+; CHECK-NEXT: }
+
+source_filename = "/t.c"
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.14.0"
+
+!llvm.dbg.cu = !{!2}
+!llvm.linker.options = !{}
+!llvm.module.flags = !{!18, !19}
+!llvm.ident = !{!22}
+
+; This simulates the debug info for a Clang module.
+!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, nameTableKind: GNU, retainedTypes: !{!11})
+!3 = !DIFile(filename: "t.c", directory:

[Lldb-commits] [PATCH] D66429: [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

2019-08-20 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

I think this is actually fine. The change that was needed for 
multi-configuration generators is how the two default paths for the compilers 
are set. The USE variables were to make it explicit when we will or we won't 
override the user-set compiler. As long as we are OK overriding it if they set 
it to an empty string (which is probably an error, anyway), this change is good.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66429



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


[Lldb-commits] [lldb] r369424 - [ClangExpressionParser] Add ClangDeclVendor

2019-08-20 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Aug 20 11:47:30 2019
New Revision: 369424

URL: http://llvm.org/viewvc/llvm-project?rev=369424&view=rev
Log:
[ClangExpressionParser] Add ClangDeclVendor

Summary:
This introduces a layer between DeclVendor and the currently implemented
DeclVendors (ClangModulesDeclVendor and AppleObjCDeclVendor). This
allows the removal of DeclVendor::GetImporterSource which is extremely
clang-specific, freeing up the interface to be more general.

A good follow up to this would be to remove the remaining instances of
clang in DeclVendor, either by moving things to ClangDeclVendor or by
using wrappers (e.g. CompilerDecl instead of clang::NamedDecl).

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

Added:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
Modified:
lldb/trunk/include/lldb/Symbol/DeclVendor.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h

Modified: lldb/trunk/include/lldb/Symbol/DeclVendor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DeclVendor.h?rev=369424&r1=369423&r2=369424&view=diff
==
--- lldb/trunk/include/lldb/Symbol/DeclVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/DeclVendor.h Tue Aug 20 11:47:30 2019
@@ -12,8 +12,6 @@
 #include "lldb/Core/ClangForward.h"
 #include "lldb/lldb-defines.h"
 
-#include "clang/AST/ExternalASTMerger.h"
-
 #include 
 
 namespace lldb_private {
@@ -22,11 +20,19 @@ namespace lldb_private {
 // declarations that are not necessarily backed by a specific symbol file.
 class DeclVendor {
 public:
+  enum DeclVendorKind {
+eClangDeclVendor,
+eClangModuleDeclVendor,
+eAppleObjCDeclVendor,
+eLastClangDeclVendor,
+  };
   // Constructors and Destructors
-  DeclVendor() {}
+  DeclVendor(DeclVendorKind kind) : m_kind(kind) {}
 
   virtual ~DeclVendor() {}
 
+  DeclVendorKind GetKind() const { return m_kind; }
+
   /// Look up the set of Decls that the DeclVendor currently knows about
   /// matching a given name.
   ///
@@ -60,16 +66,11 @@ public:
   /// The vector of CompilerTypes that was found.
   std::vector FindTypes(ConstString name, uint32_t max_matches);
 
-  /// Interface for ExternalASTMerger.  Returns an ImporterSource 
-  /// allowing type completion.
-  ///
-  /// \return
-  /// An ImporterSource for this DeclVendor.
-  virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
-
 private:
   // For DeclVendor only
   DISALLOW_COPY_AND_ASSIGN(DeclVendor);
+
+  const DeclVendorKind m_kind;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=369424&r1=369423&r2=369424&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Tue Aug 
20 11:47:30 2019
@@ -100,17 +100,15 @@ void ClangASTSource::InstallASTContext(c
   if (!language_runtime)
 break;
 
-  DeclVendor *runtime_decl_vendor = language_runtime->GetDeclVendor();
-
-  if (!runtime_decl_vendor)
-break;
-
-  sources.push_back(runtime_decl_vendor->GetImporterSource());
+  if (auto *runtime_decl_vendor = llvm::dyn_cast_or_null(
+  language_runtime->GetDeclVendor())) {
+sources.push_back(runtime_decl_vendor->GetImporterSource());
+  }
 } while (false);
 
 do {
-  DeclVendor *modules_decl_vendor =
-  m_target->GetClangModulesDeclVendor();
+  auto *modules_decl_vendor = llvm::cast(
+  m_target->GetClangModulesDeclVendor());
 
   if (!modules_decl_vendor)
 break;

Added: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h?rev=369424&view=auto
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h (added)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h Tue Aug 
20 11:47:30 2019
@@ -0,0 +1,42 @@
+//===-- ClangDeclVendor.h ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WI

[Lldb-commits] [PATCH] D66451: [ClangExpressionParser] Add ClangDeclVendor

2019-08-20 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369424: [ClangExpressionParser] Add ClangDeclVendor 
(authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66451?vs=216015&id=216201#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66451

Files:
  lldb/trunk/include/lldb/Symbol/DeclVendor.h
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h

Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
@@ -10,19 +10,23 @@
 #define liblldb_AppleObjCDeclVendor_h_
 
 #include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/lldb-private.h"
 
+#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
 #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
 
 namespace lldb_private {
 
 class AppleObjCExternalASTSource;
 
-class AppleObjCDeclVendor : public DeclVendor {
+class AppleObjCDeclVendor : public ClangDeclVendor {
 public:
   AppleObjCDeclVendor(ObjCLanguageRuntime &runtime);
 
+  static bool classof(const DeclVendor *vendor) {
+return vendor->GetKind() == eAppleObjCDeclVendor;
+  }
+
   uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches,
  std::vector &decls) override;
 
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -151,12 +151,13 @@
 };
 
 AppleObjCDeclVendor::AppleObjCDeclVendor(ObjCLanguageRuntime &runtime)
-: DeclVendor(), m_runtime(runtime), m_ast_ctx(runtime.GetProcess()
-  ->GetTarget()
-  .GetArchitecture()
-  .GetTriple()
-  .getTriple()
-  .c_str()),
+: ClangDeclVendor(eAppleObjCDeclVendor), m_runtime(runtime),
+  m_ast_ctx(runtime.GetProcess()
+->GetTarget()
+.GetArchitecture()
+.GetTriple()
+.getTriple()
+.c_str()),
   m_type_realizer_sp(m_runtime.GetEncodingToType()) {
   m_external_source = new AppleObjCExternalASTSource(*this);
   llvm::IntrusiveRefCntPtr external_source_owning_ptr(
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
@@ -0,0 +1,42 @@
+//===-- ClangDeclVendor.h ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef liblldb_ClangDeclVendor_h_
+#define liblldb_ClangDeclVendor_h_
+
+#include "lldb/Symbol/DeclVendor.h"
+
+#include "clang/AST/ExternalASTMerger.h"
+
+namespace lldb_private {
+
+// A clang specialized extension to DeclVendor.
+class ClangDeclVendor : public DeclVendor {
+public:
+  ClangDeclVendor(DeclVendorKind kind) : DeclVendor(kind) {}
+
+  virtual ~ClangDeclVendor() {}
+
+  /// Interface for ExternalASTMerger. Returns an ImporterSource allowing type
+  /// completion.
+  ///
+  /// \return
+  /// An ImporterSource for this ClangDeclVendor.
+  virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
+
+  static bool classof(const DeclVendor *vendor) {
+return vendor->GetKind() >= eClangDeclVendor &&
+   vendor->GetKind() < eLastClangDeclVendor;
+  }
+
+private:
+  DISALLOW_COPY_AND_ASSIGN(ClangDeclVendor);
+};
+}; // namespace lldb_priva

[Lldb-commits] [PATCH] D66248: [JIT][Command] Add "inject-condition" flag to conditional breakpoints

2019-08-20 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/include/lldb/Breakpoint/BreakpointOptions.h:120
+  ///
   BreakpointOptions(const char *condition, bool enabled = true,
 int32_t ignore = 0, bool one_shot = false,

mib wrote:
> shafik wrote:
> > You have a lot of `bool` parameters, these are hard to distinguish when 
> > calling the function and easy to get mixed up during refactors and 
> > subsequent merge conflicts. It would probably be better to combine these 
> > `bool` options into a `struct` and then each option has an explicit name 
> > that that will be assigned to which makes it explicit which options are 
> > being chosen at the call site.
> I only added the `bool inject_condition` parameter to the `BreakpointOptions` 
> constructor. I also added documentation that was missing for the other 
> parameters. I don't think having a struct for those options is a necessary 
> since that's what the `BreakpointOptions` class is for. 
Sadly we won't have designated initializers until C++20 [see 
godbolt](https://godbolt.org/z/2xlti5) but instead of `bool` we can use enums 
and that would clarify the code at the calling site. As discussed this can be 
done as a patch after landing this change,


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66248



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


[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

2019-08-20 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/source/Commands/CommandObjectTarget.cpp:3561
 
+  if (UnwindPlanSP plan_sp = func_unwinders_sp->GetTrampolineUnwindPlan()) 
{
+result.GetOutputStream().Printf("Trampoline UnwindPlan:\n");

Curious I noticed you stuck this in the middle someplace, does the order matter?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66250



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


[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

2019-08-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added inline comments.



Comment at: lldb/source/Commands/CommandObjectTarget.cpp:3561
 
+  if (UnwindPlanSP plan_sp = func_unwinders_sp->GetTrampolineUnwindPlan()) 
{
+result.GetOutputStream().Printf("Trampoline UnwindPlan:\n");

shafik wrote:
> Curious I noticed you stuck this in the middle someplace, does the order 
> matter?
Not in the `CommandObjectTarget` class but it does in the `FuncUnwinders`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66250



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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 216224.
JDevlieghere added a comment.

- Remove clean rule
- Use more readable names


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

https://reviews.llvm.org/D66447

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/TestCxxChar8_t.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp
  lldb/source/Commands/CommandObjectMemory.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
  lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
  lldb/source/Symbol/ClangASTContext.cpp

Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -1378,11 +1378,12 @@
 
 case DW_ATE_UTF:
   if (type_name) {
-if (streq(type_name, "char16_t")) {
+if (streq(type_name, "char16_t"))
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());
-} else if (streq(type_name, "char32_t")) {
+else if (streq(type_name, "char32_t"))
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());
-}
+else if (streq(type_name, "char8_t"))
+  return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());
   }
   break;
 }
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.h
@@ -16,6 +16,9 @@
 
 namespace lldb_private {
 namespace formatters {
+bool Char8StringSummaryProvider(ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // char8_t*
+
 bool Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t* and unichar*
@@ -27,6 +30,9 @@
 bool WCharStringSummaryProvider(ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // wchar_t*
 
+bool Char8SummaryProvider(ValueObject &valobj, Stream &stream,
+  const TypeSummaryOptions &options); // char8_t
+
 bool Char16SummaryProvider(
 ValueObject &valobj, Stream &stream,
 const TypeSummaryOptions &options); // char16_t and unichar
Index: lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -32,6 +32,31 @@
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
+bool lldb_private::formatters::Char8StringSummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+return false;
+
+  lldb::addr_t valobj_addr = GetArrayAddressOrPointerValue(valobj);
+  if (valobj_addr == 0 || valobj_addr == LLDB_INVALID_ADDRESS)
+return false;
+
+  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+  options.SetLocation(valobj_addr);
+  options.SetProcessSP(process_sp);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+
+  if (!StringPrinter::ReadStringAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options)) {
+stream.Printf("Summary Unavailable");
+return true;
+  }
+
+  return true;
+}
+
 bool lldb_private::formatters::Char16StringSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   ProcessSP process_sp = valobj.GetProcessSP();
@@ -128,6 +153,32 @@
   return true;
 }
 
+bool lldb_private::formatters::Char8SummaryProvider(
+ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
+  DataExtractor data;
+  Status error;
+  valobj.GetData(data, error);
+
+  if (error.Fail())
+return false;
+
+  std::string value;
+  valobj.GetValueAsCString(lldb::eFormatUnicode8, value);
+  if (!value.empty())
+stream.Printf("%s ", value.c_str());
+
+  StringPrinter::ReadBufferAndDumpToStreamOptions options(valobj);
+  options.SetData(data);
+  options.SetStream(&stream);
+  options.SetPrefixToken("u8");
+  options.SetQuote('\'');
+  options.SetSourceSize(1);
+  options.SetBinaryZeroIsTerminator(false);
+
+  return StringPrinter::ReadBufferAndDumpToStream<
+  StringPrinter::StringElementType::UTF8>(options);
+}
+
 bool lldb_private::formatters::Char16SummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &) {
   DataExtractor data;
Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/P

[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D66447#1637640 , @labath wrote:

> This looks good to me, but why are we using a nul character to test utf8 
> support? Shouldn't we insert some funnier characters too? I mean, one of the 
> advantages of unicode is that it should not be affected by the system code 
> pages and such, so hopefully this would not cause problems even on some more 
> exotic setups. (And I am pretty sure I remember already seeing some chinese 
> chars in some of our data formatter tests)


I only glanced at the proposal, but unless I misunderstand the type only fits 
UTF-8 characters representable in 1 byte, which are basically just ASCII.


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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [lldb] r369435 - [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 13:20:20 2019
New Revision: 369435

URL: http://llvm.org/viewvc/llvm-project?rev=369435&view=rev
Log:
[CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

Given that LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_C_COMPILER are
both set at configuration time, I don't really see the point of having
both. This patch simplifies things and uses the custom C/C++ compiler
when the variable is set, and uses the default one when it's not set.
The variable can be unset by passing -ULLDB_TEST_C_COMPILER to CMake.

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/docs/resources/build.rst
lldb/trunk/docs/resources/test.rst

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=369435&r1=369434&r2=369435&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue Aug 20 13:20:20 2019
@@ -70,8 +70,6 @@ add_subdirectory(tools)
 add_subdirectory(docs)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
-option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via 
LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)
-option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via 
LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)
 if(LLDB_INCLUDE_TESTS)
 
   # Set the path to the default lldb test executable.
@@ -81,15 +79,11 @@ if(LLDB_INCLUDE_TESTS)
   set(LLDB_DEFAULT_TEST_DSYMUTIL 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
   set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
-  if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang)
+  if (TARGET clang)
 set(LLDB_DEFAULT_TEST_C_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
-  else()
-set(LLDB_DEFAULT_TEST_C_COMPILER "")
-  endif()
-
-  if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER AND TARGET clang)
 set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
   else()
+set(LLDB_DEFAULT_TEST_C_COMPILER "")
 set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
   endif()
 
@@ -101,7 +95,7 @@ if(LLDB_INCLUDE_TESTS)
 
   if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
   ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
-message(FATAL_ERROR "LLDB test compilers not specified.  Tests will not 
run")
+message(FATAL_ERROR "LLDB test compilers not specified. Tests will not 
run.")
   endif()
 
   set(LLDB_TEST_DEPS lldb)

Modified: lldb/trunk/docs/resources/build.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=369435&r1=369434&r2=369435&view=diff
==
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Tue Aug 20 13:20:20 2019
@@ -185,8 +185,6 @@ suite.
 ::
 
   > cmake -G Ninja \
-  -DLLDB_TEST_USE_CUSTOM_C_COMPILER=On \
-  -DLLDB_TEST_USE_CUSTOM_CXX_COMPILER=On \
   -DLLDB_TEST_C_COMPILER= \
   -DLLDB_TEST_CXX_COMPILER= \
   
@@ -228,7 +226,6 @@ Sample command line:
   > cmake -G Ninja^
   -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
   -DPYTHON_HOME=C:\Python35^
-  -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON^
   -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 

Modified: lldb/trunk/docs/resources/test.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/test.rst?rev=369435&r1=369434&r2=369435&view=diff
==
--- lldb/trunk/docs/resources/test.rst (original)
+++ lldb/trunk/docs/resources/test.rst Tue Aug 20 13:20:20 2019
@@ -30,9 +30,7 @@ target.
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a different
 compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables. These variables are ignored unless
-the respective ``LLDB_TEST_USE_CUSTOM_C_COMPILER`` and
-``LLDB_TEST_USE_CUSTOM_CXX_COMPILER`` are set to ``ON``.
+``LLDB_TEST_CXX_COMPILER`` CMake variables.
 
 It is possible to customize the architecture of the test binaries and compiler
 used by appending ``-A`` and ``-C`` options respectively to the CMake variable


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


[Lldb-commits] [PATCH] D66429: [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER

2019-08-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369435: [CMake] Remove LLDB_TEST_USE_CUSTOM_C(XX)_COMPILER 
(authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66429?vs=215944&id=216228#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66429

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/docs/resources/build.rst
  lldb/trunk/docs/resources/test.rst


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -70,8 +70,6 @@
 add_subdirectory(docs)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
-option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via 
LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)
-option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via 
LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)
 if(LLDB_INCLUDE_TESTS)
 
   # Set the path to the default lldb test executable.
@@ -81,15 +79,11 @@
   set(LLDB_DEFAULT_TEST_DSYMUTIL 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
   set(LLDB_DEFAULT_TEST_FILECHECK 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
-  if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang)
+  if (TARGET clang)
 set(LLDB_DEFAULT_TEST_C_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
-  else()
-set(LLDB_DEFAULT_TEST_C_COMPILER "")
-  endif()
-
-  if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER AND TARGET clang)
 set(LLDB_DEFAULT_TEST_CXX_COMPILER 
"${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
   else()
+set(LLDB_DEFAULT_TEST_C_COMPILER "")
 set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
   endif()
 
@@ -101,7 +95,7 @@
 
   if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
   ("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
-message(FATAL_ERROR "LLDB test compilers not specified.  Tests will not 
run")
+message(FATAL_ERROR "LLDB test compilers not specified. Tests will not 
run.")
   endif()
 
   set(LLDB_TEST_DEPS lldb)
Index: lldb/trunk/docs/resources/test.rst
===
--- lldb/trunk/docs/resources/test.rst
+++ lldb/trunk/docs/resources/test.rst
@@ -30,9 +30,7 @@
 By default, the ``check-lldb`` target builds the test programs with the same
 compiler that was used to build LLDB. To build the tests with a different
 compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
-``LLDB_TEST_CXX_COMPILER`` CMake variables. These variables are ignored unless
-the respective ``LLDB_TEST_USE_CUSTOM_C_COMPILER`` and
-``LLDB_TEST_USE_CUSTOM_CXX_COMPILER`` are set to ``ON``.
+``LLDB_TEST_CXX_COMPILER`` CMake variables.
 
 It is possible to customize the architecture of the test binaries and compiler
 used by appending ``-A`` and ``-C`` options respectively to the CMake variable
Index: lldb/trunk/docs/resources/build.rst
===
--- lldb/trunk/docs/resources/build.rst
+++ lldb/trunk/docs/resources/build.rst
@@ -185,8 +185,6 @@
 ::
 
   > cmake -G Ninja \
-  -DLLDB_TEST_USE_CUSTOM_C_COMPILER=On \
-  -DLLDB_TEST_USE_CUSTOM_CXX_COMPILER=On \
   -DLLDB_TEST_C_COMPILER= \
   -DLLDB_TEST_CXX_COMPILER= \
   
@@ -228,7 +226,6 @@
   > cmake -G Ninja^
   -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
   -DPYTHON_HOME=C:\Python35^
-  -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON^
   -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
   
 


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -70,8 +70,6 @@
 add_subdirectory(docs)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
-option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
-option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
 if(LLDB_INCLUDE_TESTS)
 
   # Set the path to the default lldb test executable.
@@ -81,15 +79,11 @@
   set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
   set(LLDB_DEFAULT_TEST_FILECHECK "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
 
-  if (NOT LLDB_TE

[Lldb-commits] [lldb] r369436 - [Symbol][NFC] Remove references to clang in TypeMap

2019-08-20 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Aug 20 13:44:36 2019
New Revision: 369436

URL: http://llvm.org/viewvc/llvm-project?rev=369436&view=rev
Log:
[Symbol][NFC] Remove references to clang in TypeMap

Modified:
lldb/trunk/source/Symbol/TypeMap.cpp

Modified: lldb/trunk/source/Symbol/TypeMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeMap.cpp?rev=369436&r1=369435&r2=369436&view=diff
==
--- lldb/trunk/source/Symbol/TypeMap.cpp (original)
+++ lldb/trunk/source/Symbol/TypeMap.cpp Tue Aug 20 13:44:36 2019
@@ -8,18 +8,6 @@
 
 #include 
 
-#include "clang/AST/ASTConsumer.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/DeclGroup.h"
-
-#include "clang/Basic/Builtins.h"
-#include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/LangOptions.h"
-#include "clang/Basic/SourceManager.h"
-#include "clang/Basic/TargetInfo.h"
-
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -30,7 +18,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace clang;
 
 TypeMap::TypeMap() : m_types() {}
 


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


[Lldb-commits] [PATCH] D66499: [LLDB][Test] Remove `skipIfWindows` for conditional breakpoint test (NFC)

2019-08-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added reviewers: stella.stamenova, jingham.
Herald added a project: LLDB.

The test for conditional breakpoints on Windows was skipped because
there was no expression evaluation support at the time it was written.

After removing the annotation and testing it again, the test is passing.
http://lists.llvm.org/pipermail/lldb-dev/2019-August/015405.html

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66499

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py


Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -15,30 +15,22 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_and_run_command(self):
 """Exercise breakpoint condition with 'breakpoint modify -c  
id'."""
 self.build()
 self.breakpoint_conditions()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_inline_and_run_command(self):
 """Exercise breakpoint condition inline with 'breakpoint set'."""
 self.build()
 self.breakpoint_conditions(inline=True)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""
 self.build()
 self.breakpoint_conditions_python()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_invalid_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""


Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -15,30 +15,22 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_and_run_command(self):
 """Exercise breakpoint condition with 'breakpoint modify -c  id'."""
 self.build()
 self.breakpoint_conditions()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_inline_and_run_command(self):
 """Exercise breakpoint condition inline with 'breakpoint set'."""
 self.build()
 self.breakpoint_conditions(inline=True)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""
 self.build()
 self.breakpoint_conditions_python()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_invalid_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66499: [LLDB][Test] Remove `skipIfWindows` for conditional breakpoint test (NFC)

2019-08-20 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova accepted this revision.
stella.stamenova added a comment.
This revision is now accepted and ready to land.

LGTM. Please monitor the windows Buildbot to make sure it still passes after 
your commit though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66499



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


[Lldb-commits] [lldb] r369452 - [NFC] Update RegularExpression documentation

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 14:56:49 2019
New Revision: 369452

URL: http://llvm.org/viewvc/llvm-project?rev=369452&view=rev
Log:
[NFC] Update RegularExpression documentation

Modified:
lldb/trunk/include/lldb/Utility/RegularExpression.h

Modified: lldb/trunk/include/lldb/Utility/RegularExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/RegularExpression.h?rev=369452&r1=369451&r2=369452&view=diff
==
--- lldb/trunk/include/lldb/Utility/RegularExpression.h (original)
+++ lldb/trunk/include/lldb/Utility/RegularExpression.h Tue Aug 20 14:56:49 2019
@@ -17,8 +17,6 @@ namespace lldb_private {
 
 class RegularExpression {
 public:
-  /// Default constructor.
-  ///
   /// The default constructor that initializes the object state such that it
   /// contains no compiled regular expression.
   RegularExpression() = default;
@@ -43,46 +41,41 @@ public:
   RegularExpression &operator=(RegularExpression &&rhs) = default;
   RegularExpression &operator=(const RegularExpression &rhs) = default;
 
-  /// Executes a regular expression.
-  ///
   /// Execute a regular expression match using the compiled regular expression
-  /// that is already in this object against the match string \a s. If any
-  /// parens are used for regular expression matches \a match_count should
-  /// indicate the number of regmatch_t values that are present in \a
-  /// match_ptr.
+  /// that is already in this object against the given \a string. If any parens
+  /// are used for regular expression matches.
   ///
   /// \param[in] string
   /// The string to match against the compile regular expression.
   ///
-  /// \param[in] match
-  /// A pointer to a RegularExpression::Match structure that was
-  /// properly initialized with the desired number of maximum
-  /// matches, or nullptr if no parenthesized matching is needed.
+  /// \param[out] matches
+  /// A pointer to a SmallVector to hold the matches.
   ///
-  /// \return \b true if \a string matches the compiled regular expression, \b
-  /// false otherwise incl. the case regular exression failed to compile.
+  /// \return
+  /// true if \a string matches the compiled regular expression, false
+  /// otherwise incl. the case regular exression failed to compile.
   bool Execute(llvm::StringRef string,
llvm::SmallVectorImpl *matches = nullptr) 
const;
 
   /// Access the regular expression text.
   ///
-  /// Returns the text that was used to compile the current regular
-  /// expression.
-  ///
   /// \return
   /// The NULL terminated C string that was used to compile the
   /// current regular expression
   llvm::StringRef GetText() const;
 
-  /// Test if valid.
-  ///
   /// Test if this object contains a valid regular expression.
   ///
-  /// \return \b true if the regular expression compiled and is ready for
-  /// execution, \b false otherwise.
+  /// \return
+  /// true if the regular expression compiled and is ready for execution,
+  /// false otherwise.
   bool IsValid() const;
 
   /// Return an error if the regular expression failed to compile.
+  ///
+  /// \return
+  /// A string error if the regular expression failed to compile, success
+  /// otherwise.
   llvm::Error GetError() const;
 
 private:


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


[Lldb-commits] [PATCH] D66499: [LLDB][Test] Remove `skipIfWindows` for conditional breakpoint test (NFC)

2019-08-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added a comment.

In D66499#1638269 , @stella.stamenova 
wrote:

> LGTM. Please monitor the windows Buildbot to make sure it still passes after 
> your commit though.


Will do!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66499



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


[Lldb-commits] [PATCH] D66499: [LLDB][Test] Remove `skipIfWindows` for conditional breakpoint test (NFC)

2019-08-20 Thread Med Ismail Bennani via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369453: [LLDB][Test] Remove `skipIfWindows` for conditional 
breakpoint test (NFC) (authored by mib, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66499?vs=216257&id=216259#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66499

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py


Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -15,30 +15,22 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_and_run_command(self):
 """Exercise breakpoint condition with 'breakpoint modify -c  
id'."""
 self.build()
 self.breakpoint_conditions()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_inline_and_run_command(self):
 """Exercise breakpoint condition inline with 'breakpoint set'."""
 self.build()
 self.breakpoint_conditions(inline=True)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""
 self.build()
 self.breakpoint_conditions_python()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_invalid_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -15,30 +15,22 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_and_run_command(self):
 """Exercise breakpoint condition with 'breakpoint modify -c  id'."""
 self.build()
 self.breakpoint_conditions()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 def test_breakpoint_condition_inline_and_run_command(self):
 """Exercise breakpoint condition inline with 'breakpoint set'."""
 self.build()
 self.breakpoint_conditions(inline=True)
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""
 self.build()
 self.breakpoint_conditions_python()
 
-# Requires EE to support COFF on Windows (http://llvm.org/pr22232)
-@skipIfWindows
 @add_test_categories(['pyapi'])
 def test_breakpoint_invalid_condition_and_python_api(self):
 """Use Python APIs to set breakpoint conditions."""
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r369456 - [Symbol] Move VerifyDecl to ClangASTContext

2019-08-20 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Aug 20 15:06:13 2019
New Revision: 369456

URL: http://llvm.org/viewvc/llvm-project?rev=369456&view=rev
Log:
[Symbol] Move VerifyDecl to ClangASTContext

VerifyDecl is specific to clang and is only used in ClangASTContext.

Removed:
lldb/trunk/include/lldb/Symbol/VerifyDecl.h
lldb/trunk/source/Symbol/VerifyDecl.cpp
Modified:
lldb/trunk/source/Symbol/CMakeLists.txt
lldb/trunk/source/Symbol/ClangASTContext.cpp

Removed: lldb/trunk/include/lldb/Symbol/VerifyDecl.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/VerifyDecl.h?rev=369455&view=auto
==
--- lldb/trunk/include/lldb/Symbol/VerifyDecl.h (original)
+++ lldb/trunk/include/lldb/Symbol/VerifyDecl.h (removed)
@@ -1,18 +0,0 @@
-//===-- VerifyDecl.h *- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef lldb_VariableList_h_
-#define lldb_VariableList_h_
-
-#include "lldb/Core/ClangForward.h"
-
-namespace lldb_private {
-void VerifyDecl(clang::Decl *decl);
-}
-
-#endif

Modified: lldb/trunk/source/Symbol/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CMakeLists.txt?rev=369456&r1=369455&r2=369456&view=diff
==
--- lldb/trunk/source/Symbol/CMakeLists.txt (original)
+++ lldb/trunk/source/Symbol/CMakeLists.txt Tue Aug 20 15:06:13 2019
@@ -42,7 +42,6 @@ add_lldb_library(lldbSymbol
   UnwindTable.cpp
   Variable.cpp
   VariableList.cpp
-  VerifyDecl.cpp
 
   ${PLATFORM_SOURCES}
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=369456&r1=369455&r2=369456&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Aug 20 15:06:13 2019
@@ -82,7 +82,6 @@
 #include "lldb/Symbol/ClangUtil.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolFile.h"
-#include "lldb/Symbol/VerifyDecl.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/Process.h"
@@ -107,6 +106,11 @@ using namespace llvm;
 using namespace clang;
 
 namespace {
+static void VerifyDecl(clang::Decl *decl) {
+  assert(decl && "VerifyDecl called with nullptr?");
+  decl->getAccess();
+}
+
 static inline bool
 ClangASTContextSupportsLanguage(lldb::LanguageType language) {
   return language == eLanguageTypeUnknown || // Clang is the default type 
system

Removed: lldb/trunk/source/Symbol/VerifyDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/VerifyDecl.cpp?rev=369455&view=auto
==
--- lldb/trunk/source/Symbol/VerifyDecl.cpp (original)
+++ lldb/trunk/source/Symbol/VerifyDecl.cpp (removed)
@@ -1,15 +0,0 @@
-//===-- VerifyDecl.cpp --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "lldb/Symbol/VerifyDecl.h"
-#include "clang/AST/DeclBase.h"
-
-void lldb_private::VerifyDecl(clang::Decl *decl) {
-  assert(decl && "VerifyDecl called with nullptr?");
-  decl->getAccess();
-}


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


[Lldb-commits] [lldb] r369461 - [NFC] Fix -Wdocumentation warnings in Utility.

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 15:20:46 2019
New Revision: 369461

URL: http://llvm.org/viewvc/llvm-project?rev=369461&view=rev
Log:
[NFC] Fix -Wdocumentation warnings in Utility.

This patch fixes a bunch of -Wdocumentation warnings in Utility. I'm
sure there are still a bunch outdated comments left, but this fixes the
most flagrant inconsistencies that the compiler understands.

Modified:
lldb/trunk/include/lldb/Utility/Args.h
lldb/trunk/include/lldb/Utility/DataEncoder.h
lldb/trunk/include/lldb/Utility/DataExtractor.h
lldb/trunk/include/lldb/Utility/Predicate.h
lldb/trunk/include/lldb/Utility/Status.h
lldb/trunk/include/lldb/Utility/Stream.h
lldb/trunk/include/lldb/Utility/UUID.h

Modified: lldb/trunk/include/lldb/Utility/Args.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Args.h?rev=369461&r1=369460&r2=369461&view=diff
==
--- lldb/trunk/include/lldb/Utility/Args.h (original)
+++ lldb/trunk/include/lldb/Utility/Args.h Tue Aug 20 15:20:46 2019
@@ -168,8 +168,8 @@ public:
 
   /// Appends a new argument to the end of the list argument list.
   ///
-  /// \param[in] arg_cstr
-  /// The new argument as a NULL terminated C string.
+  /// \param[in] arg_str
+  /// The new argument.
   ///
   /// \param[in] quote_char
   /// If the argument was originally quoted, put in the quote char here.
@@ -179,30 +179,27 @@ public:
 
   void AppendArguments(const char **argv);
 
-  /// Insert the argument value at index \a idx to \a arg_cstr.
+  /// Insert the argument value at index \a idx to \a arg_str.
   ///
   /// \param[in] idx
   /// The index of where to insert the argument.
   ///
-  /// \param[in] arg_cstr
-  /// The new argument as a NULL terminated C string.
+  /// \param[in] arg_str
+  /// The new argument.
   ///
   /// \param[in] quote_char
   /// If the argument was originally quoted, put in the quote char here.
-  ///
-  /// \return
-  /// The NULL terminated C string of the copy of \a arg_cstr.
   void InsertArgumentAtIndex(size_t idx, llvm::StringRef arg_str,
  char quote_char = '\0');
 
-  /// Replaces the argument value at index \a idx to \a arg_cstr if \a idx is
+  /// Replaces the argument value at index \a idx to \a arg_str if \a idx is
   /// a valid argument index.
   ///
   /// \param[in] idx
   /// The index of the argument that will have its value replaced.
   ///
-  /// \param[in] arg_cstr
-  /// The new argument as a NULL terminated C string.
+  /// \param[in] arg_str
+  /// The new argument.
   ///
   /// \param[in] quote_char
   /// If the argument was originally quoted, put in the quote char here.
@@ -238,12 +235,12 @@ public:
   /// \see Args::GetArgumentAtIndex (size_t) const
   void Shift();
 
-  /// Inserts a class owned copy of \a arg_cstr at the beginning of the
+  /// Inserts a class owned copy of \a arg_str at the beginning of the
   /// argument vector.
   ///
-  /// A copy \a arg_cstr will be made.
+  /// A copy \a arg_str will be made.
   ///
-  /// \param[in] arg_cstr
+  /// \param[in] arg_str
   /// The argument to push on the front of the argument stack.
   ///
   /// \param[in] quote_char

Modified: lldb/trunk/include/lldb/Utility/DataEncoder.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataEncoder.h?rev=369461&r1=369460&r2=369461&view=diff
==
--- lldb/trunk/include/lldb/Utility/DataEncoder.h (original)
+++ lldb/trunk/include/lldb/Utility/DataEncoder.h Tue Aug 20 15:20:46 2019
@@ -204,12 +204,11 @@ public:
   /// m_addr_size member variable and should be set correctly prior to
   /// extracting any address values.
   ///
-  /// \param[in,out] offset_ptr
-  /// A pointer to an offset within the data that will be advanced
-  /// by the appropriate number of bytes if the value is extracted
-  /// correctly. If the offset is out of bounds or there are not
-  /// enough bytes to extract this value, the offset will be left
-  /// unmodified.
+  /// \param[in] offset
+  /// The offset where to encode the address.
+  ///
+  /// \param[in] addr
+  /// The address to encode.
   ///
   /// \return
   /// The next valid offset within data if the put operation
@@ -220,19 +219,18 @@ public:
   ///
   /// Encodes a C string into the existing data including the terminating
   ///
-  /// \param[in,out] offset_ptr
-  /// A pointer to an offset within the data that will be advanced
-  /// by the appropriate number of bytes if the value is extracted
-  /// correctly. If the offset is out of bounds or there are not
-  /// enough bytes to extract this value, the offset will be left
-  /// unmodified.
+  /// \param[in] offset
+  /// The offset where to encode the string.
+  ///
+  /// \param[in] cstr
+  /// The strin

[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

2019-08-20 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

In D66250#1633455 , @clayborg wrote:

> Why are we not just using ObjectFileJIT? I am guessing these breakpoint 
> expressions create one of these by compiling the breakpoint expression and 
> JIT'ing it just like any other expression. If this is the case, then why do 
> we need to create a ObjectFileTrampoline? Seems like we could add .cfi 
> directives to the assembly we use for the breakpoint condition function so 
> that we can unwind out of it?


I hadn't looked at ObjectFileJIT, we should look at whether we can that 
existing plugin.  I agree they're conceptually doing the same thing, but one 
difference is that the trampoline is only a function, it's not a mach-o binary 
that we've written into memory.  I think it would be possible to represent the 
trampoline unwind plan in eh_frame using a DW_OP_addr encoding for the caller's 
pc value, but we would have to manually write out the bytes of the eh_frame 
header, CIE and FDE entries, then the DW_OP_addr.  I think it's easier to stuff 
in an UnwindPlan with this unwind rule added manually.  Using the existing 
eh_frame format is laudable but I think it hand-writing the binary format into 
memory and then reading it back out again would be less maintainable IMO.




Comment at: lldb/source/Commands/CommandObjectTarget.cpp:3561
 
+  if (UnwindPlanSP plan_sp = func_unwinders_sp->GetTrampolineUnwindPlan()) 
{
+result.GetOutputStream().Printf("Trampoline UnwindPlan:\n");

mib wrote:
> shafik wrote:
> > Curious I noticed you stuck this in the middle someplace, does the order 
> > matter?
> Not in the `CommandObjectTarget` class but it does in the `FuncUnwinders`.
Yeah, in FuncUnwinders we don't want to give one of the traditional unwind 
techniques to try to provide an UnwindPlan (e.g. assembly language instruction 
scanning); they will not succeed.  We must use an unwind plan that hardcodes 
the return address.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66250



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


[Lldb-commits] [PATCH] D66102: [Symbol] Decouple clang from CompilerType

2019-08-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Should we add some sort of convenience function or a ClangCompilerType subclass 
of CompilerType that reduces the amount of boilerplate needed on the RHS?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66102



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


[Lldb-commits] [PATCH] D66102: [Symbol] Decouple clang from CompilerType

2019-08-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

... or a method ClangASTContext::wrapClangType()?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66102



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


[Lldb-commits] [PATCH] D66102: [Symbol] Decouple clang from CompilerType

2019-08-20 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

I wouldn't mind adding something to reduce boilerplate, but I'm not sure it 
would actually look too different. A wrapper function or subclass constructor 
would need to take a ClangASTContext and a clang::QualType so we could avoid 
calls to `getAsOpaquePtr()` everywhere but that's about it I think?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66102



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


[Lldb-commits] [PATCH] D66102: [Symbol] Decouple clang from CompilerType

2019-08-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Let's pick some random examples:

`CompilerType(ClangASTContext::GetASTContext(m_ast_source.m_ast_context), 
generic_function_type.getAsOpaquePtr())`
-> 
`ClangASTContext::GetASTContext(m_ast_source.m_ast_context).GetCompilerType(generic_function_type)`

or

`CompilerType(this, 
llvm::cast(qual_type)->getDeducedType().getAsOpaquePtr())`
->
`GetCompilerType(llvm::cast(qual_type)->getDeducedType())`

Perhaps it really doesn't matter too much.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66102



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


[Lldb-commits] [PATCH] D66507: Generalize FindTypes with CompilerContext to support fuzzy lookup

2019-08-20 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: JDevlieghere, clayborg, jasonmolenda, labath.

This patch generalizes the FindTypes with CompilerContext interface to support 
looking up a type of unknown kind by name, as well as looking up a type inside 
an unspecified submodule. These features are motivated by the Swift branch, but 
are fully tested via unit tests and lldb-test on llvm.org.
Specifically, this patch adds an AnyModule and an AnyType CompilerContext kind.


https://reviews.llvm.org/D66507

Files:
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/Type.h
  lldb/include/lldb/lldb-private-enumerations.h
  lldb/lit/SymbolFile/DWARF/compilercontext.ll
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  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
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/SymbolFile.cpp
  lldb/source/Symbol/Type.cpp
  lldb/tools/lldb-test/lldb-test.cpp
  lldb/unittests/Symbol/TestType.cpp

Index: lldb/unittests/Symbol/TestType.cpp
===
--- lldb/unittests/Symbol/TestType.cpp
+++ lldb/unittests/Symbol/TestType.cpp
@@ -48,3 +48,47 @@
   "std::set>::iterator", true,
   "std::set>::", "iterator");
 }
+
+TEST(Type, CompilerContextPattern) {
+  std::vector mms = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Module, ConstString("B")},
+  {CompilerContextKind::Struct, ConstString("S")}};
+  EXPECT_TRUE(CompilerContextPattern(mms).matches({mms}));
+  std::vector mmc = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Module, ConstString("B")},
+  {CompilerContextKind::Class, ConstString("S")}};
+  EXPECT_FALSE(CompilerContextPattern(mms).matches({mmc}));
+  std::vector ms = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Struct, ConstString("S")}};
+  std::vector mas = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::AnyModule, ConstString("*")},
+  {CompilerContextKind::Struct, ConstString("S")}};
+  EXPECT_TRUE(CompilerContextPattern(mas).matches({mms}));
+  EXPECT_TRUE(CompilerContextPattern(mas).matches({ms}));
+  EXPECT_FALSE(CompilerContextPattern(ms).matches({mas}));
+  std::vector mmms = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Module, ConstString("B")},
+  {CompilerContextKind::Module, ConstString("C")},
+  {CompilerContextKind::Struct, ConstString("S")}};
+  EXPECT_TRUE(CompilerContextPattern(mas).matches({mmms}));
+  std::vector mme = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Module, ConstString("B")},
+  {CompilerContextKind::Enum, ConstString("S")}};
+  std::vector mma = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Module, ConstString("B")},
+  {CompilerContextKind::AnyType, ConstString("S")}};
+  EXPECT_TRUE(CompilerContextPattern(mma).matches({mme}));
+  EXPECT_TRUE(CompilerContextPattern(mma).matches({mms}));
+  std::vector mme2 = {
+  {CompilerContextKind::Module, ConstString("A")},
+  {CompilerContextKind::Module, ConstString("B")},
+  {CompilerContextKind::Enum, ConstString("S2")}};
+  EXPECT_FALSE(CompilerContextPattern(mma).matches({mme2}));
+}
Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -242,12 +242,14 @@
 .Case("Module", CompilerContextKind::Module)
 .Case("Namespace", CompilerContextKind::Namespace)
 .Case("Class", CompilerContextKind::Class)
-.Case("Structure", CompilerContextKind::Structure)
+.Case("Struct", CompilerContextKind::Struct)
 .Case("Union", CompilerContextKind::Union)
 .Case("Function", CompilerContextKind::Function)
 .Case("Variable", CompilerContextKind::Variable)
-.Case("Enumeration", CompilerContextKind::Enumeration)
+.Case("Enum", CompilerContextKind::Enum)
 .Case("Typedef", CompilerContextKind::Typedef)
+.Case("AnyModule", CompilerContextKind::AnyModule)
+.Case("AnyType", CompilerContextKind::AnyType)
 .Default(CompilerContextKind::Invalid);
 if (value.empty()) {
   WithColor::error() << "compil

[Lldb-commits] [lldb] r369477 - [dotest] Don't set the DWARF version override in CFLAGS_EXTRA.

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 16:56:32 2019
New Revision: 369477

URL: http://llvm.org/viewvc/llvm-project?rev=369477&view=rev
Log:
[dotest] Don't set the DWARF version override in CFLAGS_EXTRA.

We cannot override the DWARF version in the CFLAGS_EXTRA because they
are used by tests that explicitly build without debug info. Instead, we
pass them through the regular CFLAGS.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=369477&r1=369476&r2=369477&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue Aug 20 16:56:32 2019
@@ -342,15 +342,14 @@ def parseOptionsAndInitTestdirs():
 configuration.skipCategories += test_categories.validate(
 args.skipCategories, False)
 
-cflags_extras = ""
 if args.E:
-cflags_extras += args.E
+os.environ['CFLAGS_EXTRAS'] = args.E
 
 if args.dwarf_version:
 configuration.dwarf_version = args.dwarf_version
-cflags_extras += '-gdwarf-{}'.format(args.dwarf_version)
-
-os.environ['CFLAGS_EXTRAS'] = cflags_extras
+# We cannot modify CFLAGS_EXTRAS because they're used in test cases
+# that explicitly require no debug info.
+os.environ['CFLAGS'] = '-gdwarf-{}'.format(configuration.dwarf_version)
 
 if args.d:
 sys.stdout.write(

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py?rev=369477&r1=369476&r2=369477&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py Tue Aug 
20 16:56:32 2019
@@ -116,7 +116,7 @@ def getCmdLine(d):
 pattern = '%s="%s"' if "win32" in sys.platform else "%s='%s'"
 
 def setOrAppendVariable(k, v):
-append_vars = ["CFLAGS_EXTRAS", "LD_EXTRAS"]
+append_vars = ["CFLAGS", "CFLAGS_EXTRAS", "LD_EXTRAS"]
 if k in append_vars and k in os.environ:
 v = os.environ[k] + " " + v
 return pattern % (k, v)


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


[Lldb-commits] [lldb] r369479 - [Doxygen] Document private class members.

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 17:10:19 2019
New Revision: 369479

URL: http://llvm.org/viewvc/llvm-project?rev=369479&view=rev
Log:
[Doxygen] Document private class members.

Given that the C++ documentation is meant for LLDB developers it makes
sense to include private class members in the output.

Modified:
lldb/trunk/docs/doxygen.cfg.in

Modified: lldb/trunk/docs/doxygen.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/doxygen.cfg.in?rev=369479&r1=369478&r2=369479&view=diff
==
--- lldb/trunk/docs/doxygen.cfg.in (original)
+++ lldb/trunk/docs/doxygen.cfg.in Tue Aug 20 17:10:19 2019
@@ -303,7 +303,7 @@ EXTRACT_ALL= YES
 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
 # will be included in the documentation.
 
-EXTRACT_PRIVATE= NO
+EXTRACT_PRIVATE= YES
 
 # If the EXTRACT_STATIC tag is set to YES all static members of a file
 # will be included in the documentation.


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


[Lldb-commits] [lldb] r369484 - Update a few tests that may change the platform to save & restore

2019-08-20 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Aug 20 17:27:30 2019
New Revision: 369484

URL: http://llvm.org/viewvc/llvm-project?rev=369484&view=rev
Log:
Update a few tests that may change the platform to save & restore
the platform in the setUp/tearDown methods.  I want to migrate the
re-instatement of the correct plaform to the setUp base method but
haven't had time to look at that yet, so I want to land this handful
of fixes until I get to it.

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


Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py?rev=369484&r1=369483&r2=369484&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
 Tue Aug 20 17:27:30 2019
@@ -13,6 +13,14 @@ class TestWriteMemory(GDBRemoteTestBase)
 def setBreakpoint(self, packet):
 return "OK"
 
+def setUp(self):
+super(TestWriteMemory, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(TestWriteMemory, self).tearDown()
+
 self.server.responder = MyResponder()
 target = self.dbg.CreateTargetWithFileAndTargetTriple('', 
'x86_64-pc-linux')
 process = self.connect(target)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py?rev=369484&r1=369483&r2=369484&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
 Tue Aug 20 17:27:30 2019
@@ -15,7 +15,13 @@ class GCoreTestCase(TestBase):
 NO_DEBUG_INFO_TESTCASE = True
 
 mydir = TestBase.compute_mydir(__file__)
-_initial_platform = lldb.DBG.GetSelectedPlatform()
+def setUp(self):
+super(GCoreTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(GCoreTestCase, self).tearDown()
 
 _i386_pid = 5586
 _x86_64_pid = 5669
@@ -47,4 +53,3 @@ class GCoreTestCase(TestBase):
 self.assertEqual(signal, 19)
 
 self.dbg.DeleteTarget(target)
-lldb.DBG.SetSelectedPlatform(self._initial_platform)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py?rev=369484&r1=369483&r2=369484&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
 Tue Aug 20 17:27:30 2019
@@ -15,7 +15,14 @@ class LinuxCoreThreadsTestCase(TestBase)
 NO_DEBUG_INFO_TESTCASE = True
 
 mydir = TestBase.compute_mydir(__file__)
-_initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def setUp(self):
+super(LinuxCoreThreadsTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(LinuxCoreThreadsTestCase, self).tearDown()
 
 _i386_pid = 5193
 _x86_64_pid = 5222
@@ -56,4 +63,3 @@ class LinuxCoreThreadsTestCase(TestBase)
 self.assertEqual(signal, 0)
 
 self.dbg.DeleteTarget(target)
-lldb.DBG.SetSelectedPlatform(self._initial_platform)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
URL: 
ht

[Lldb-commits] [PATCH] D66331: Save / restore selected platform in tests that may change it

2019-08-20 Thread Phabricator via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369484: Update a few tests that may change the platform to 
save & restore (authored by jmolenda, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66331?vs=215529&id=216297#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66331

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py


Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
@@ -15,7 +15,13 @@
 NO_DEBUG_INFO_TESTCASE = True
 
 mydir = TestBase.compute_mydir(__file__)
-_initial_platform = lldb.DBG.GetSelectedPlatform()
+def setUp(self):
+super(GCoreTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(GCoreTestCase, self).tearDown()
 
 _i386_pid = 5586
 _x86_64_pid = 5669
@@ -47,4 +53,3 @@
 self.assertEqual(signal, 19)
 
 self.dbg.DeleteTarget(target)
-lldb.DBG.SetSelectedPlatform(self._initial_platform)
Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
@@ -15,7 +15,14 @@
 NO_DEBUG_INFO_TESTCASE = True
 
 mydir = TestBase.compute_mydir(__file__)
-_initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def setUp(self):
+super(LinuxCoreThreadsTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(LinuxCoreThreadsTestCase, self).tearDown()
 
 _i386_pid = 5193
 _x86_64_pid = 5222
@@ -56,4 +63,3 @@
 self.assertEqual(signal, 0)
 
 self.dbg.DeleteTarget(target)
-lldb.DBG.SetSelectedPlatform(self._initial_platform)
Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
@@ -13,6 +13,14 @@
 def setBreakpoint(self, packet):
 return "OK"
 
+def setUp(self):
+super(TestWriteMemory, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(TestWriteMemory, self).tearDown()
+
 self.server.responder = MyResponder()
 target = self.dbg.CreateTargetWithFileAndTargetTriple('', 
'x86_64-pc-linux')
 process = self.connect(target)
Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
@@ -11,6 +11,14 @@
 class TestPlatformProcessConnect(gdbremote_testcase.GdbRemoteTestCaseBase):
 mydir = TestBase.compute_mydir(__file__)
 
+def setUp(self):
+super(TestPlatformProcessConnect, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(TestPlatformProcessConnect, self).tearDown()
+
 @llgs_test
 @no_debug_info_test
 @skipIf(remote=False)


Index: lldb/trunk/packages/

[Lldb-commits] [lldb] r369485 - [NFC] Remove lldb_utility namespace.

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 17:50:46 2019
New Revision: 369485

URL: http://llvm.org/viewvc/llvm-project?rev=369485&view=rev
Log:
[NFC] Remove lldb_utility namespace.

While generating the Doxygen I noticed this lone namespace that has one
class and one function in it. This moves them into lldb_private.

Modified:
lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
lldb/trunk/include/lldb/Utility/AnsiTerminal.h
lldb/trunk/include/lldb/Utility/StringLexer.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Highlighter.cpp
lldb/trunk/source/Core/ValueObject.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
lldb/trunk/source/Utility/StringLexer.cpp
lldb/trunk/unittests/Utility/AnsiTerminalTest.cpp
lldb/trunk/unittests/Utility/StringLexerTest.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h?rev=369485&r1=369484&r2=369485&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h Tue Aug 20 
17:50:46 2019
@@ -47,7 +47,7 @@ static inline ConstString GetValidTypeNa
 return type;
 
   std::string type_cstr(type.AsCString());
-  lldb_utility::StringLexer type_lexer(type_cstr);
+  StringLexer type_lexer(type_cstr);
 
   type_lexer.AdvanceIf("class ");
   type_lexer.AdvanceIf("enum ");

Modified: lldb/trunk/include/lldb/Utility/AnsiTerminal.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/AnsiTerminal.h?rev=369485&r1=369484&r2=369485&view=diff
==
--- lldb/trunk/include/lldb/Utility/AnsiTerminal.h (original)
+++ lldb/trunk/include/lldb/Utility/AnsiTerminal.h Tue Aug 20 17:50:46 2019
@@ -55,7 +55,7 @@
 
 #include 
 
-namespace lldb_utility {
+namespace lldb_private {
 
 namespace ansi {
 
@@ -137,4 +137,4 @@ inline std::string FormatAnsiTerminalCod
   return fmt;
 }
 }
-}
+} // namespace lldb_private

Modified: lldb/trunk/include/lldb/Utility/StringLexer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringLexer.h?rev=369485&r1=369484&r2=369485&view=diff
==
--- lldb/trunk/include/lldb/Utility/StringLexer.h (original)
+++ lldb/trunk/include/lldb/Utility/StringLexer.h Tue Aug 20 17:50:46 2019
@@ -1,4 +1,4 @@
-//===- StringLexer.h *- C++ 
-*-===//
+//===-- StringLexer.h ---*- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -13,7 +13,7 @@
 #include 
 #include 
 
-namespace lldb_utility {
+namespace lldb_private {
 
 class StringLexer {
 public:

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=369485&r1=369484&r2=369485&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Aug 20 17:50:46 2019
@@ -270,7 +270,7 @@ Status Debugger::SetPropertyValue(const
 // FIXME it would be nice to have "on-change" callbacks for properties
 if (property_path == g_debugger_properties[ePropertyPrompt].name) {
   llvm::StringRef new_prompt = GetPrompt();
-  std::string str = lldb_utility::ansi::FormatAnsiTerminalCodes(
+  std::string str = lldb_private::ansi::FormatAnsiTerminalCodes(
   new_prompt, GetUseColor());
   if (str.length())
 new_prompt = str;
@@ -345,7 +345,7 @@ void Debugger::SetPrompt(llvm::StringRef
   m_collection_sp->SetPropertyAtIndexAsString(nullptr, idx, p);
   llvm::StringRef new_prompt = GetPrompt();
   std::string str =
-  lldb_utility::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor());
+  lldb_private::ansi::FormatAnsiTerminalCodes(new_prompt, GetUseColor());
   if (str.length())
 new_prompt = str;
   GetCommandInterpreter().UpdatePrompt(new_prompt);

Modified: lldb/trunk/source/Core/Highlighter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Highlighter.cpp?rev=369485&r1=369484&r2=369485&view=diff
==
--- lldb/trunk/source/Core/Highlighter.cpp (original)
+++ lldb/trunk/source/Core/Highlighter.cpp Tue Aug 20 17:50:46 2019
@@ -13,6 +13,7 @@
 #include "lldb/Utility/StreamString.h"
 
 using namespace lldb_private;
+using namespace lldb_private::ansi;

Re: [Lldb-commits] [lldb] r369374 - unittests: Use yaml2obj as a library instead of an external process

2019-08-20 Thread Davide Italiano via lldb-commits
Hi Pavel,
looks like this broke the lldb-standalone macOS bot.

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-standalone/151/console

FAILED: 
unittests/TestingSupport/CMakeFiles/lldbUtilityHelpers.dir/TestUtilities.cpp.o

[trim]

 
/Users/buildslave/jenkins/workspace/lldb-cmake-standalone/llvm-project/lldb/unittests/TestingSupport/TestUtilities.cpp:16:10:
fatal error: 'gtest/gtest.h' file not found

Can you please take a look?

On Tue, Aug 20, 2019 at 5:27 AM Pavel Labath via lldb-commits
 wrote:
>
> Author: labath
> Date: Tue Aug 20 05:28:36 2019
> New Revision: 369374
>
> URL: http://llvm.org/viewvc/llvm-project?rev=369374&view=rev
> Log:
> unittests: Use yaml2obj as a library instead of an external process
>
> Summary:
> Recently, yaml2obj has been turned into a library. This means we can use
> it from our unit tests directly, instead of shelling out to an external
> process. This patch does just that.
>
> Reviewers: JDevlieghere, aadsm, espindola, jdoerfert
>
> Subscribers: emaste, mgorny, arichardson, MaskRay, jhenderson, abrachet, 
> lldb-commits
>
> Differential Revision: https://reviews.llvm.org/D65949
>
> Removed:
> lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml
> 
> lldb/trunk/unittests/ObjectFile/ELF/Inputs/sections-resolve-consistently.yaml
> lldb/trunk/unittests/Symbol/Inputs/basic-call-frame-info.yaml
> Modified:
> lldb/trunk/unittests/Core/CMakeLists.txt
> lldb/trunk/unittests/Core/MangledTest.cpp
> lldb/trunk/unittests/ObjectFile/ELF/CMakeLists.txt
> lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
> lldb/trunk/unittests/Symbol/CMakeLists.txt
> lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
> lldb/trunk/unittests/Symbol/TestLineEntry.cpp
> lldb/trunk/unittests/TestingSupport/CMakeLists.txt
> lldb/trunk/unittests/TestingSupport/TestUtilities.cpp
> lldb/trunk/unittests/TestingSupport/TestUtilities.h
>
> Modified: lldb/trunk/unittests/Core/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/CMakeLists.txt?rev=369374&r1=369373&r2=369374&view=diff
> ==
> --- lldb/trunk/unittests/Core/CMakeLists.txt (original)
> +++ lldb/trunk/unittests/Core/CMakeLists.txt Tue Aug 20 05:28:36 2019
> @@ -15,8 +15,3 @@ add_lldb_unittest(LLDBCoreTests
>LINK_COMPONENTS
>  Support
>)
> -
> -set(test_inputs
> -  mangled-function-names.yaml
> -  )
> -add_unittest_inputs(LLDBCoreTests "${test_inputs}")
>
> Removed: lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml?rev=369373&view=auto
> ==
> --- lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml (original)
> +++ lldb/trunk/unittests/Core/Inputs/mangled-function-names.yaml (removed)
> @@ -1,129 +0,0 @@
>  !ELF
> -FileHeader:
> -  Class:   ELFCLASS64
> -  Data:ELFDATA2LSB
> -  Type:ET_EXEC
> -  Machine: EM_X86_64
> -Sections:
> -  - Name:.text
> -Type:SHT_PROGBITS
> -Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
> -AddressAlign:0x0010
> -Content: 554889E58B0425A8005DC30F1F00
> -  - Name:.anothertext
> -Type:SHT_PROGBITS
> -Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
> -Address: 0x0010
> -AddressAlign:0x0010
> -Content: 
> 554889E54883EC20488D0425A800C745FC488945F0488B45F08B08894DECE8C7FF8B4DEC01C189C84883C4205D746573742073747200C3
> -  - Name:.eh_frame
> -Type:SHT_PROGBITS
> -Flags:   [ SHF_ALLOC ]
> -Address: 0x0050
> -AddressAlign:0x0008
> -Content: 
> 1400017A5200017810011B0C070890011C001C0090FF0D410E108602430D06001C003C0080FF3F410E108602430D0600
> -  - Name:.data
> -Type:SHT_PROGBITS
> -Flags:   [ SHF_WRITE, SHF_ALLOC ]
> -Address: 0x00A8
> -AddressAlign:0x0004
> -Content: '0100'
> -  - Name:.comment
> -Type:SHT_PROGBITS
> -Flags:   [ SHF_MERGE, SHF_STRINGS ]
> -AddressAlign:0x0001
> -Content: 
> 5562756E747520636C616E672076657273696F6E20332E352D317562756E74753120287472756E6B2920286261736564206F6E204C4C564D20332E352900
> -Symbols:
> -  - Type:STT_SECTION
> -Section: .text
> -  - Type:STT_SECTION
> -Section: .anothertext
> -Value:   0x0010
> -  - Type:STT_SECTION
> -Section: .eh_frame
> -Value: 

[Lldb-commits] [lldb] r369493 - [NFC] Return llvm::StringRef from StringExtractor::GetStringRef.

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 21:55:56 2019
New Revision: 369493

URL: http://llvm.org/viewvc/llvm-project?rev=369493&view=rev
Log:
[NFC] Return llvm::StringRef from StringExtractor::GetStringRef.

This patch removes the two variant of StringExtractor::GetStringRef that
return (non-)const references to std::string. The non-const one was
being abused to reinitialize the StringExtractor and its uses are
replaced by calls to the copy asignment operator. The const variant was
refactored to return an actual llvm::StringRef.

Modified:
lldb/trunk/include/lldb/Utility/StringExtractor.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/tools/debugserver/source/StdStringExtractor.h
lldb/trunk/unittests/Utility/StringExtractorTest.cpp

Modified: lldb/trunk/include/lldb/Utility/StringExtractor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringExtractor.h?rev=369493&r1=369492&r2=369493&view=diff
==
--- lldb/trunk/include/lldb/Utility/StringExtractor.h (original)
+++ lldb/trunk/include/lldb/Utility/StringExtractor.h Tue Aug 20 21:55:56 2019
@@ -45,9 +45,7 @@ public:
 
   void SkipSpaces();
 
-  std::string &GetStringRef() { return m_packet; }
-
-  const std::string &GetStringRef() const { return m_packet; }
+  llvm::StringRef GetStringRef() const { return m_packet; }
 
   bool Empty() { return m_packet.empty(); }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp?rev=369493&r1=369492&r2=369493&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp Tue 
Aug 20 21:55:56 2019
@@ -72,7 +72,7 @@ StateType GDBRemoteClientBase::SendConti
 
 const char stop_type = response.GetChar();
 LLDB_LOGF(log, "GDBRemoteClientBase::%s () got packet: %s", __FUNCTION__,
-  response.GetStringRef().c_str());
+  response.GetStringRef().data());
 
 switch (stop_type) {
 case 'W':
@@ -214,7 +214,7 @@ GDBRemoteClientBase::SendPacketAndWaitFo
 LLDB_LOGF(
 log,
 "error: packet with payload \"%.*s\" got invalid response \"%s\": %s",
-int(payload.size()), payload.data(), response.GetStringRef().c_str(),
+int(payload.size()), payload.data(), response.GetStringRef().data(),
 (i == (max_response_retries - 1))
 ? "using invalid response and giving up"
 : "ignoring response and waiting for another");

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=369493&r1=369492&r2=369493&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue 
Aug 20 21:55:56 2019
@@ -751,7 +751,6 @@ GDBRemoteCommunication::CheckForPacket(c
   size_t content_end = content_start + content_length;
 
   bool success = true;
-  std::string &packet_str = packet.GetStringRef();
   if (log) {
 // If logging was just enabled and we have history, then dump out what
 // we have to the log so we get the historical context. The Dump() call
@@ -813,11 +812,10 @@ GDBRemoteCommunication::CheckForPacket(c
   GDBRemoteCommunicationHistory::ePacketTypeRecv,
   total_length);
 
-  // Clear packet_str in case there is some existing data in it.
-  packet_str.clear();
   // Copy the packet from m_bytes to packet_str expanding the run-length
   // encoding in the process. Reserve enough byte for the most common case
   // (no RLE used)
+  std ::string packet_str;
   packet_str.reserve(m_bytes.length());
   for (std::string::const_iterator c = m_bytes.begin() + content_start;
c != m_bytes.begin() + content_end; ++c) {
@@ -840,6 +838,7 @@ GDBRemoteCommunication::CheckForPacket(c
   packet_str.push_back(*c);
 }
   }
+  packet = StringExtractorGDBRemote(packet_str);
 
   if (m_bytes[0] == '$' || m_bytes[0] == '%') {
 asser

[Lldb-commits] [lldb] r369491 - [NFC] Simplify code

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 21:55:50 2019
New Revision: 369491

URL: http://llvm.org/viewvc/llvm-project?rev=369491&view=rev
Log:
[NFC] Simplify code

This simplifies the code and updates the comments.

Modified:
lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=369491&r1=369490&r2=369491&view=diff
==
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Tue Aug 20 21:55:50 
2019
@@ -456,7 +456,7 @@ bool ValueObjectPrinter::PrintObjectDesc
 if (object_desc[object_end] == '\n')
 m_stream->Printf("%s", object_desc);
 else
-m_stream->Printf("%s\n", object_desc);
+m_stream->Printf("%s\n", object_desc);
 return true;
   } else if (!value_printed && !summary_printed)
 return true;
@@ -751,34 +751,30 @@ bool ValueObjectPrinter::PrintChildrenOn
 
 void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
bool summary_printed) {
-  // this flag controls whether we tried to display a description for this
-  // object and failed if that happens, we want to display the children, if any
+  // This flag controls whether we tried to display a description for this
+  // object and failed if that happens, we want to display the children if any.
   bool is_failed_description =
   !PrintObjectDescriptionIfNeeded(value_printed, summary_printed);
 
-  auto curr_ptr_depth = m_ptr_depth;
-  bool print_children =
+  DumpValueObjectOptions::PointerDepth curr_ptr_depth = m_ptr_depth;
+  const bool print_children =
   ShouldPrintChildren(is_failed_description, curr_ptr_depth);
-  bool print_oneline =
+  const bool print_oneline =
   (curr_ptr_depth.CanAllowExpansion() || m_options.m_show_types ||
!m_options.m_allow_oneliner_mode || m_options.m_flat_output ||
(m_options.m_pointer_as_array) || m_options.m_show_location)
   ? false
   : DataVisualization::ShouldPrintAsOneLiner(*m_valobj);
-  bool is_instance_ptr = IsInstancePointer();
-  uint64_t instance_ptr_value = LLDB_INVALID_ADDRESS;
-
-  if (print_children && is_instance_ptr) {
-instance_ptr_value = m_valobj->GetValueAsUnsigned(0);
+  if (print_children && IsInstancePointer()) {
+uint64_t instance_ptr_value = m_valobj->GetValueAsUnsigned(0);
 if (m_printed_instance_pointers->count(instance_ptr_value)) {
-  // we already printed this instance-is-pointer thing, so don't expand it
+  // We already printed this instance-is-pointer thing, so don't expand it.
   m_stream->PutCString(" {...}\n");
-
-  // we're done here - get out fast
   return;
-} else
-  m_printed_instance_pointers->emplace(
-  instance_ptr_value); // remember this guy for future reference
+} else {
+  // Remember this guy for future reference.
+  m_printed_instance_pointers->emplace(instance_ptr_value);
+}
   }
 
   if (print_children) {


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


[Lldb-commits] [lldb] r369492 - [NFC] Remove unused function GetHexWithFixedSize

2019-08-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Aug 20 21:55:53 2019
New Revision: 369492

URL: http://llvm.org/viewvc/llvm-project?rev=369492&view=rev
Log:
[NFC] Remove unused function GetHexWithFixedSize

The implementation of this function was obviously incorrect, as the
result variable was never used. This led me to check if it was actually
used anywhere, which came back negative.

Modified:
lldb/trunk/include/lldb/Utility/StringExtractor.h
lldb/trunk/source/Utility/StringExtractor.cpp
lldb/trunk/tools/debugserver/source/StdStringExtractor.cpp
lldb/trunk/tools/debugserver/source/StdStringExtractor.h

Modified: lldb/trunk/include/lldb/Utility/StringExtractor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/StringExtractor.h?rev=369492&r1=369491&r2=369492&view=diff
==
--- lldb/trunk/include/lldb/Utility/StringExtractor.h (original)
+++ lldb/trunk/include/lldb/Utility/StringExtractor.h Tue Aug 20 21:55:53 2019
@@ -91,9 +91,6 @@ public:
 
   size_t GetHexBytesAvail(llvm::MutableArrayRef dest);
 
-  uint64_t GetHexWithFixedSize(uint32_t byte_size, bool little_endian,
-   uint64_t fail_value);
-
   size_t GetHexByteString(std::string &str);
 
   size_t GetHexByteStringFixedLength(std::string &str, uint32_t nibble_length);
@@ -113,12 +110,14 @@ protected:
 m_index = UINT64_MAX;
 return false;
   }
-  // For StringExtractor only
-  std::string m_packet; // The string in which to extract data.
-  uint64_t m_index; // When extracting data from a packet, this index
-// will march along as things get extracted. If set to
-// UINT64_MAX the end of the packet data was reached
-// when decoding information
+
+  /// The string in which to extract data.
+  std::string m_packet;
+
+  /// When extracting data from a packet, this index will march along as things
+  /// get extracted. If set to UINT64_MAX the end of the packet data was
+  /// reached when decoding information.
+  uint64_t m_index;
 };
 
 #endif // utility_StringExtractor_h_

Modified: lldb/trunk/source/Utility/StringExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.cpp?rev=369492&r1=369491&r2=369492&view=diff
==
--- lldb/trunk/source/Utility/StringExtractor.cpp (original)
+++ lldb/trunk/source/Utility/StringExtractor.cpp Tue Aug 20 21:55:53 2019
@@ -296,34 +296,6 @@ size_t StringExtractor::GetHexBytesAvail
   return bytes_extracted;
 }
 
-// Consume ASCII hex nibble character pairs until we have decoded byte_size
-// bytes of data.
-
-uint64_t StringExtractor::GetHexWithFixedSize(uint32_t byte_size,
-  bool little_endian,
-  uint64_t fail_value) {
-  if (byte_size <= 8 && GetBytesLeft() >= byte_size * 2) {
-uint64_t result = 0;
-uint32_t i;
-if (little_endian) {
-  // Little Endian
-  uint32_t shift_amount;
-  for (i = 0, shift_amount = 0; i < byte_size && IsGood();
-   ++i, shift_amount += 8) {
-result |= (static_cast(GetHexU8()) << shift_amount);
-  }
-} else {
-  // Big Endian
-  for (i = 0; i < byte_size && IsGood(); ++i) {
-result <<= 8;
-result |= GetHexU8();
-  }
-}
-  }
-  m_index = UINT64_MAX;
-  return fail_value;
-}
-
 size_t StringExtractor::GetHexByteString(std::string &str) {
   str.clear();
   str.reserve(GetBytesLeft() / 2);

Modified: lldb/trunk/tools/debugserver/source/StdStringExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/StdStringExtractor.cpp?rev=369492&r1=369491&r2=369492&view=diff
==
--- lldb/trunk/tools/debugserver/source/StdStringExtractor.cpp (original)
+++ lldb/trunk/tools/debugserver/source/StdStringExtractor.cpp Tue Aug 20 
21:55:53 2019
@@ -281,34 +281,6 @@ size_t StdStringExtractor::GetHexBytesAv
   return bytes_extracted;
 }
 
-// Consume ASCII hex nibble character pairs until we have decoded byte_size
-// bytes of data.
-
-uint64_t StdStringExtractor::GetHexWithFixedSize(uint32_t byte_size,
- bool little_endian,
- uint64_t fail_value) {
-  if (byte_size <= 8 && GetBytesLeft() >= byte_size * 2) {
-uint64_t result = 0;
-uint32_t i;
-if (little_endian) {
-  // Little Endian
-  uint32_t shift_amount;
-  for (i = 0, shift_amount = 0; i < byte_size && IsGood();
-   ++i, shift_amount += 8) {
-result |= ((uint64_t)GetHexU8() << shift_amount);
-  }
-} else {
-  // Big Endian
-  for (i = 0; i < byte_size && IsGood(); ++i) {
-result <<= 8;
-result |= Get

[Lldb-commits] [lldb] r369494 - [Symbol] Remove unused clang headers from Type

2019-08-20 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Aug 20 21:56:23 2019
New Revision: 369494

URL: http://llvm.org/viewvc/llvm-project?rev=369494&view=rev
Log:
[Symbol] Remove unused clang headers from Type

Modified:
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/source/Symbol/Type.cpp

Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=369494&r1=369493&r2=369494&view=diff
==
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Tue Aug 20 21:56:23 2019
@@ -9,7 +9,6 @@
 #ifndef liblldb_Type_h_
 #define liblldb_Type_h_
 
-#include "lldb/Core/ClangForward.h"
 #include "lldb/Symbol/CompilerDecl.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Declaration.h"

Modified: lldb/trunk/source/Symbol/Type.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=369494&r1=369493&r2=369494&view=diff
==
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Tue Aug 20 21:56:23 2019
@@ -30,9 +30,6 @@
 
 #include "llvm/ADT/StringRef.h"
 
-#include "clang/AST/Decl.h"
-#include "clang/AST/DeclObjC.h"
-
 using namespace lldb;
 using namespace lldb_private;
 


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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-20 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D66447#1638047 , @JDevlieghere 
wrote:

> In D66447#1637640 , @labath wrote:
>
> > This looks good to me, but why are we using a nul character to test utf8 
> > support? Shouldn't we insert some funnier characters too? I mean, one of 
> > the advantages of unicode is that it should not be affected by the system 
> > code pages and such, so hopefully this would not cause problems even on 
> > some more exotic setups. (And I am pretty sure I remember already seeing 
> > some chinese chars in some of our data formatter tests)
>
>
> I only glanced at the proposal, but unless I misunderstand the type only fits 
> UTF-8 characters representable in 1 byte, which are basically just ASCII.


I have now too glanced at the proposal (just the cppreference page, really :) 
). I think I understand where you got this impression from, but I don't think 
that is fully correct. It is true that a *single* char8_t variable can hold 
only 8 bit UTF8 code units (*not* characters), but that is not surprising since 
UTF8 is a variable length encoding, so you can't have a type that matches one 
character exactly. However, an *array* of char8_t is a completely different 
thing, and I am pretty sure that these are intended to hold utf8 strings 
containing any utf8 characters (otherwise, it wouldn't really deserve to call 
itself a utf8 type), and so we should print (and test) it as regular utf8.

However, this actually surfaces the question of how should we format single 
char8_t variables. It makes sense to display the character value if the value 
happens to be ASCII, but I guess we shouldn't print something like "invalid 
utf8 character" if it does contain one unit of the multibyte characters.


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

https://reviews.llvm.org/D66447



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