[Lldb-commits] [lldb] b30dabf - [lldb] Don't enable expression log in TestEmptyStdModule.py

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-22T08:34:08+01:00
New Revision: b30dabfe905b714b9161422b58199e2aa8938481

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

LOG: [lldb] Don't enable expression log in TestEmptyStdModule.py

Thanks for pointing this out Jason!

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
index 7df275d5badd..76e79df5cd1c 100644
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/import-std-module/empty-module/TestEmptyStdModule.py
@@ -28,7 +28,6 @@ def test(self):
 "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
 
 self.runCmd("settings set target.import-std-module true")
-self.runCmd("log enable lldb expr")
 
 # Use the typedef that is only defined in our 'empty' module. If this 
fails, then LLDB
 # somehow figured out the correct define for the header and compiled 
the right



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


[Lldb-commits] [PATCH] D70580: Register Objective-C property accessors with their property decls.

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

This is a correctness fix for the Clang DWARF parser that primarily matters for 
swift-lldb's ability to import Clang types that were reconstructed from DWARF 
into Swift.

Thanks to Shafik for implementing `lldb-test --dump-clang-ast`!

  

rdar://problem/55025799


https://reviews.llvm.org/D70580

Files:
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-objc-property.m
  
lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
  lldb/test/Shell/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
@@ -623,7 +623,7 @@
 return make_string_error("Module has no symbol file.");
 
   llvm::Expected type_system_or_err =
-  symfile->GetTypeSystemForLanguage(eLanguageTypeC_plus_plus);
+  symfile->GetTypeSystemForLanguage(eLanguageTypeObjC_plus_plus);
   if (!type_system_or_err)
 return make_string_error("Can't retrieve ClangASTContext");
 
Index: lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
===
--- lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
+++ lldb/test/Shell/SymbolFile/DWARF/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.cpp', '.s', '.test', '.ll']
+config.suffixes = ['.cpp', '.m', '.s', '.test', '.ll']
Index: lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
===
--- lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
+++ lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp
@@ -1,6 +1,6 @@
 // UNSUPPORTED: system-windows
 //
-// Test to verify we are corectly generating anonymous flags when parsing
+// Test to verify we are correctly generating anonymous flags when parsing
 // anonymous class and unnamed structs from DWARF to the a clang AST node.
 
 // RUN: %clangxx_host -g -c -o %t.o %s
Index: lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-objc-property.m
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/clang-ast-from-dwarf-objc-property.m
@@ -0,0 +1,29 @@
+// REQUIRES: system-darwin
+//
+// RUN: %clang_host -g -c -o %t.o %s
+// RUN: lldb-test symbols -dump-clang-ast %t.o | FileCheck %s
+
+__attribute__((objc_root_class))
+@interface Root
+@property (readonly) int ro_number;
+@property int rw_number;
+@property (readonly, getter=custom_getter) int manual;
+- (int)custom_getter;
+@property (class, readonly) int class_property;
+@end
+
+Root *obj;
+
+// CHECK: |-ObjCPropertyDecl {{.*}} ro_number 'int' readonly
+// CHECK: | `-getter ObjCMethod [[READONLY:0x[0-9a-f]+]] 'ro_number'
+// CHECK: |-ObjCMethodDecl [[READONLY]] {{.*}} implicit - ro_number 'int'
+// CHECK: |-ObjCPropertyDecl {{.*}} rw_number 'int' assign readwrite
+// CHECK: | |-getter ObjCMethod {{.*}} 'rw_number'
+// CHECK: | `-setter ObjCMethod {{.*}} 'setRw_number:'
+// CHECK: |-ObjCPropertyDecl {{.*}} manual 'int' readonly
+// CHECK: | `-getter ObjCMethod [[CUSTOM:0x[0-9a-f]+]] 'custom_getter'
+// CHECK: |-ObjCMethodDecl [[CUSTOM]] {{.*}} - custom_getter 'int'
+// CHECK: |-ObjCPropertyDecl {{.*}} class_property 'int' readonly class
+// CHECK: | `-getter ObjCMethod [[CLASS:0x[0-9a-f]+]] 'class_property'
+// CHECK: `-ObjCMethodDecl [[CLASS]] {{.*}} + class_property 'int'
+
Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -8435,9 +8435,11 @@
   const bool isInstance =
   (property_attributes & ObjCPropertyDecl::OBJC_PR_class) == 0;
 
-  if (!getter_sel.isNull() &&
-  !(isInstance ? class_interface_decl->lookupInstanceMethod(getter_sel)
-   : class_interface_decl->lookupClassMethod(getter_sel))) {
+  clang::ObjCMethodDecl *getter = nullptr;
+  if (!getter_sel.isNull())
+getter = isInstance ? class_interface_decl->lookupInstanceMethod(getter_sel)
+: class_interface_decl->lookupClassMethod(getter_sel);
+  if (!getter_sel.isNull() && !getter) {
 const bool isVariadic = false;
 const bool isPropertyAccessor = false;
 const bool isSynthesizedAccessorStub = false;
@@ -8447,28 +8449,31 @@
 clang::ObjCMethodDecl::None;
 const bool HasRelatedResultType = false;
 
-clang::ObjCMethodDecl *getter = clang::ObjCMethodDecl::Create(
+getter = clang::ObjCMethodDecl::Create(
 *clang_ast, clang::SourceLocation(), clang::SourceLocation(),
 getter_sel, ClangUtil::GetQualType(property_clang_type_to_access),
 nullptr, 

[Lldb-commits] [PATCH] D69880: [lldb] Fix exception breakpoint not being resolved when set on dummy target

2019-11-21 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Ack, sorry about that!  This looks fine, thanks for chasing it down.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69880



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


[Lldb-commits] [PATCH] D69880: [lldb] Fix exception breakpoint not being resolved when set on dummy target

2019-11-21 Thread Martin Svensson via Phabricator via lldb-commits
poya added a comment.

@jingham I think this might have slipped through the cracks, do you think 
you'll have time to help me review and commit this one, or advice on a suitable 
alternate reviewer?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D69880



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


[Lldb-commits] [PATCH] D70574: [lldb-server] Verify 'g' is supported before relying on them

2019-11-21 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Hi, sorry I haven't had time to get back to this one.  I wanted to look into 
the m_avoid_g_packets ivar in GDBRemoteCommunicationClient and 
GDBRemoteCommunicationClient::AvoidGPackets.  It looks like it was written to 
specifically avoid the g packet with arm64 devices, and I think it's trying to 
avoid the g packet for older debugservers.

The last time we enabled this, the macos bots immediately started getting 
failures -- I suspect there is a bug with debugserver's g packet right now, 
which we hadn't noticed because we don't use the g packet on this platform (we 
pre-seed all of the GPR values so it's not a perf problem).  I need to spend a 
little time looking into what's going on there --- but we'll probably need to 
make sure GDBRemoteCommunicationClient::AvoidGPackets is called / used, and 
that it is updated to avoid some more debugservers. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70574



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


[Lldb-commits] [PATCH] D70574: [lldb-server] Verify 'g' is supported before relying on them

2019-11-21 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade created this revision.
guiandrade added reviewers: jasonmolenda, labath.
guiandrade added a project: LLDB.
Herald added a subscriber: lldb-commits.

This ensures that 'g' packets are only used if the config
plugin.process.gdb-remote.use-g-packet-for-reading = true and
we get a normal packet in response to a 'g' packet.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70574

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoGPacketSupported.py
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp


Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -304,7 +304,9 @@
   bool pSupported =
   gdb_process->GetGDBRemote().GetpPacketSupported(GetID());
   bool read_all_registers_at_once =
-  !pSupported || gdb_process->m_use_g_packet_for_reading;
+  !pSupported ||
+  (gdb_process->m_use_g_packet_for_reading &&
+   gdb_process->GetGDBRemote().GetgPacketSupported(GetID()));
   bool write_all_registers_at_once = !pSupported;
   reg_ctx_sp = std::make_shared(
   *this, concrete_frame_idx, gdb_process->m_register_info,
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -235,6 +235,8 @@
 
   bool GetpPacketSupported(lldb::tid_t tid);
 
+  bool GetgPacketSupported(lldb::tid_t tid);
+
   bool GetxPacketSupported();
 
   bool GetVAttachOrWaitSupported();
@@ -516,6 +518,7 @@
   LazyBool m_attach_or_wait_reply;
   LazyBool m_prepare_for_reg_writing_reply;
   LazyBool m_supports_p;
+  LazyBool m_supports_g;
   LazyBool m_supports_x;
   LazyBool m_avoid_g_packets;
   LazyBool m_supports_QSaveRegisterState;
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -68,8 +68,8 @@
   m_watchpoints_trigger_after_instruction(eLazyBoolCalculate),
   m_attach_or_wait_reply(eLazyBoolCalculate),
   m_prepare_for_reg_writing_reply(eLazyBoolCalculate),
-  m_supports_p(eLazyBoolCalculate), m_supports_x(eLazyBoolCalculate),
-  m_avoid_g_packets(eLazyBoolCalculate),
+  m_supports_p(eLazyBoolCalculate), m_supports_g(eLazyBoolCalculate),
+  m_supports_x(eLazyBoolCalculate), m_avoid_g_packets(eLazyBoolCalculate),
   m_supports_QSaveRegisterState(eLazyBoolCalculate),
   m_supports_qXfer_auxv_read(eLazyBoolCalculate),
   m_supports_qXfer_libraries_read(eLazyBoolCalculate),
@@ -548,6 +548,12 @@
   return m_supports_p;
 }
 
+bool GDBRemoteCommunicationClient::GetgPacketSupported(lldb::tid_t tid) {
+  if (m_supports_g == eLazyBoolCalculate)
+m_supports_g = GetThreadPacketSupported(tid, "g");
+  return m_supports_g;
+}
+
 LazyBool GDBRemoteCommunicationClient::GetThreadPacketSupported(
 lldb::tid_t tid, llvm::StringRef packetStr) {
   StreamString payload;
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoGPacketSupported.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoGPacketSupported.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoGPacketSupported.py
@@ -70,9 +70,12 @@
 else:
 return None, False
 
+self.dbg.HandleCommand(
+"settings set 
plugin.process.gdb-remote.use-g-packet-for-reading true")
+self.addTearDownHook(lambda:
+self.runCmd("settings set 
plugin.process.gdb-remote.use-g-packet-for-reading false"))
 self.server.responder = MyResponder()
 target = self.dbg.CreateTarget('')
-self.runCmd("log enable gdb-remote packets")
 if self.TraceOn():
   self.runCmd("log enable gdb-remote packets")
   self.addTearDownHook(
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ 

[Lldb-commits] [lldb] bc8e88e - Early-exitify ClangASTContext::AddObjCClassProperty() (NFC)

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

Author: Adrian Prantl
Date: 2019-11-21T15:41:22-08:00
New Revision: bc8e88e974550dc7a8000d526df6dadb12b54bc0

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

LOG: Early-exitify ClangASTContext::AddObjCClassProperty() (NFC)

Added: 


Modified: 
lldb/source/Symbol/ClangASTContext.cpp

Removed: 




diff  --git a/lldb/source/Symbol/ClangASTContext.cpp 
b/lldb/source/Symbol/ClangASTContext.cpp
index b35d264ceb9d..b01bd38d4ea4 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -8339,189 +8339,173 @@ bool ClangASTContext::AddObjCClassProperty(
   clang::ASTContext *clang_ast = ast->getASTContext();
 
   clang::ObjCInterfaceDecl *class_interface_decl = 
GetAsObjCInterfaceDecl(type);
+  if (!class_interface_decl)
+return false;
 
-  if (class_interface_decl) {
-CompilerType property_clang_type_to_access;
-
-if (property_clang_type.IsValid())
-  property_clang_type_to_access = property_clang_type;
-else if (ivar_decl)
-  property_clang_type_to_access =
-  CompilerType(ast, ivar_decl->getType().getAsOpaquePtr());
-
-if (class_interface_decl && property_clang_type_to_access.IsValid()) {
-  clang::TypeSourceInfo *prop_type_source;
-  if (ivar_decl)
-prop_type_source =
-clang_ast->getTrivialTypeSourceInfo(ivar_decl->getType());
-  else
-prop_type_source = clang_ast->getTrivialTypeSourceInfo(
-ClangUtil::GetQualType(property_clang_type));
-
-  clang::ObjCPropertyDecl *property_decl = clang::ObjCPropertyDecl::Create(
-  *clang_ast, class_interface_decl,
-  clang::SourceLocation(), // Source Location
-  _ast->Idents.get(property_name),
-  clang::SourceLocation(), // Source Location for AT
-  clang::SourceLocation(), // Source location for (
-  ivar_decl ? ivar_decl->getType()
-: ClangUtil::GetQualType(property_clang_type),
-  prop_type_source);
-
-  if (property_decl) {
-if (metadata)
-  ClangASTContext::SetMetadata(clang_ast, property_decl, *metadata);
-
-class_interface_decl->addDecl(property_decl);
-
-clang::Selector setter_sel, getter_sel;
-
-if (property_setter_name != nullptr) {
-  std::string property_setter_no_colon(
-  property_setter_name, strlen(property_setter_name) - 1);
-  clang::IdentifierInfo *setter_ident =
-  _ast->Idents.get(property_setter_no_colon);
-  setter_sel = clang_ast->Selectors.getSelector(1, _ident);
-} else if (!(property_attributes & DW_APPLE_PROPERTY_readonly)) {
-  std::string setter_sel_string("set");
-  setter_sel_string.push_back(::toupper(property_name[0]));
-  setter_sel_string.append(_name[1]);
-  clang::IdentifierInfo *setter_ident =
-  _ast->Idents.get(setter_sel_string);
-  setter_sel = clang_ast->Selectors.getSelector(1, _ident);
-}
-property_decl->setSetterName(setter_sel);
-property_decl->setPropertyAttributes(
-clang::ObjCPropertyDecl::OBJC_PR_setter);
-
-if (property_getter_name != nullptr) {
-  clang::IdentifierInfo *getter_ident =
-  _ast->Idents.get(property_getter_name);
-  getter_sel = clang_ast->Selectors.getSelector(0, _ident);
-} else {
-  clang::IdentifierInfo *getter_ident =
-  _ast->Idents.get(property_name);
-  getter_sel = clang_ast->Selectors.getSelector(0, _ident);
-}
-property_decl->setGetterName(getter_sel);
-property_decl->setPropertyAttributes(
-clang::ObjCPropertyDecl::OBJC_PR_getter);
-
-if (ivar_decl)
-  property_decl->setPropertyIvarDecl(ivar_decl);
-
-if (property_attributes & DW_APPLE_PROPERTY_readonly)
-  property_decl->setPropertyAttributes(
-  clang::ObjCPropertyDecl::OBJC_PR_readonly);
-if (property_attributes & DW_APPLE_PROPERTY_readwrite)
-  property_decl->setPropertyAttributes(
-  clang::ObjCPropertyDecl::OBJC_PR_readwrite);
-if (property_attributes & DW_APPLE_PROPERTY_assign)
-  property_decl->setPropertyAttributes(
-  clang::ObjCPropertyDecl::OBJC_PR_assign);
-if (property_attributes & DW_APPLE_PROPERTY_retain)
-  property_decl->setPropertyAttributes(
-  clang::ObjCPropertyDecl::OBJC_PR_retain);
-if (property_attributes & DW_APPLE_PROPERTY_copy)
-  property_decl->setPropertyAttributes(
-  clang::ObjCPropertyDecl::OBJC_PR_copy);
-if (property_attributes & DW_APPLE_PROPERTY_nonatomic)
-  property_decl->setPropertyAttributes(
-  

[Lldb-commits] [lldb] b26d9e4 - [Reproducer] Instruct users to replay reproducer

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

Author: Jonas Devlieghere
Date: 2019-11-21T13:25:53-08:00
New Revision: b26d9e417d2d4dbb47f6e967926dbb31f6d7a4b4

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

LOG: [Reproducer] Instruct users to replay reproducer

Improve the message printed when LLDB crashes by asking the user to
replay the reproducer before attaching it to a bugreport..


Crash reproducer for lldb version 10.0.0 (g...@github.com:llvm/llvm-project.git 
revision ...)
  clang revision ...
  llvm revision ...

Reproducer written to '/path/to/reproducer'

Before attaching the reproducer to a bug report:
 - Look at the directory to ensure you're willing to share its content.
 - Make sure the reproducer works by replaying the reproducer.

Replay the reproducer with the following command:
./bin/lldb -replay /path/to/reproducer


Added: 


Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index 806922bc860f..465ccdb95393 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -732,16 +732,24 @@ void sigcont_handler(int signo) {
   signal(signo, sigcont_handler);
 }
 
-void reproducer_handler(void *) {
+void reproducer_handler(void *argv0) {
   if (SBReproducer::Generate()) {
+auto exe = static_cast(argv0);
 llvm::outs() << "\n";
 llvm::outs() << "Crash reproducer for ";
 llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+llvm::outs() << '\n';
 llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
  << "'\n";
+llvm::outs() << '\n';
+llvm::outs() << "Before attaching the reproducer to a bug report:\n";
+llvm::outs() << " - Look at the directory to ensure you're willing to "
+"share its content.\n";
 llvm::outs()
-<< "Please have a look at the directory to assess if you're willing to 
"
-   "share the contained information.\n";
+<< " - Make sure the reproducer works by replaying the reproducer.\n";
+llvm::outs() << '\n';
+llvm::outs() << "Replay the reproducer with the following command:\n";
+llvm::outs() << exe << " -replay " << SBReproducer::GetPath() << "\n";
 llvm::outs() << "\n";
   }
 }
@@ -847,7 +855,7 @@ int main(int argc, char const *argv[]) {
   }
 
   // Register the reproducer signal handler.
-  llvm::sys::AddSignalHandler(reproducer_handler, nullptr);
+  llvm::sys::AddSignalHandler(reproducer_handler, (void *)(argv[0]));
 
   SBError error = SBDebugger::InitializeWithErrorHandling();
   if (error.Fail()) {



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


[Lldb-commits] [lldb] bb090bb - [Reproducer] Make 'reproducer xcrash' behave the same during capture & replay

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

Author: Jonas Devlieghere
Date: 2019-11-21T13:34:04-08:00
New Revision: bb090bb1cad28cef1ad74c8ca986f3f5643eb6d9

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

LOG: [Reproducer] Make 'reproducer xcrash' behave the same during capture & 
replay

There's no point in preventing this command from running during replay.
We should simulate the same crash as during capture.

Added: 


Modified: 
lldb/source/Commands/CommandObjectReproducer.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectReproducer.cpp 
b/lldb/source/Commands/CommandObjectReproducer.cpp
index 2797f3c0a9f0..a4c69db492da 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -122,7 +122,7 @@ class CommandObjectReproducerGenerate : public 
CommandObjectParsed {
 if (auto generator = r.GetGenerator()) {
   generator->Keep();
 } else if (r.IsReplaying()) {
-  // Make this operation a NOP in replay mode.
+  // Make this operation a NO-OP in replay mode.
   result.SetStatus(eReturnStatusSuccessFinishNoResult);
   return result.Succeeded();
 } else {
@@ -202,7 +202,8 @@ class CommandObjectReproducerXCrash : public 
CommandObjectParsed {
 }
 
 auto  = Reproducer::Instance();
-if (!r.IsCapturing()) {
+
+if (!r.IsCapturing() && !r.IsReplaying()) {
   result.SetError(
   "forcing a crash is only supported when capturing a reproducer.");
   result.SetStatus(eReturnStatusSuccessFinishNoResult);



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


[Lldb-commits] [PATCH] D70100: [DWARF] Handle call sites with indirect call targets

2019-11-21 Thread Vedant Kumar via Phabricator via lldb-commits
vsk marked an inline comment as done.
vsk added inline comments.



Comment at: lldb/include/lldb/Symbol/Function.h:453
   /// PC addresses (in increasing order).
-  llvm::MutableArrayRef GetCallEdges();
+  llvm::ArrayRef> GetCallEdges();
 

aprantl wrote:
> Since DWARFExpression has a copy constructer, perhaps we should get rid of 
> the unique_ptr to make it faster to allocate/deconstruct?
I don't think it's possible to store CallEdge directly, as it's unsized 
(CallEdge::GetCallee is pure virtual).


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

https://reviews.llvm.org/D70100



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


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

2019-11-21 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D70324#1755704 , @labath wrote:

> [This is probably not the right patch, as the last run on that bot still 
> doesn't have this commit.]
>
> My understanding is that all pexpect tests are failing on that bot and are 
> skipped with `@skipIfAsan`. Probably this one needs to be skipped too. 
> @teemperor was trying to reproduce some of those failures locally and 
> failed... Maybe that bot is cursed...


Fair.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324



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


[Lldb-commits] [lldb] 44fe1f0 - [test] Mark TestEditline as skipped with ASan.

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

Author: Jonas Devlieghere
Date: 2019-11-21T13:09:40-08:00
New Revision: 44fe1f024d542bb7d286f9dd03ef35ad474399bd

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

LOG: [test] Mark TestEditline as skipped with ASan.

As discussed in https://reviews.llvm.org/D70324.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py 
b/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
index df622820028b..01671041ba4b 100644
--- a/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
+++ b/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -16,6 +16,7 @@ class EditlineTest(PExpectTest):
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIfAsan
 def test_left_right_arrow(self):
 """Test that ctrl+left/right arrow navigates words correctly.
 



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


[Lldb-commits] [PATCH] D70100: [DWARF] Handle call sites with indirect call targets

2019-11-21 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/include/lldb/Symbol/Function.h:453
   /// PC addresses (in increasing order).
-  llvm::MutableArrayRef GetCallEdges();
+  llvm::ArrayRef> GetCallEdges();
 

Since DWARFExpression has a copy constructer, perhaps we should get rid of the 
unique_ptr to make it faster to allocate/deconstruct?


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

https://reviews.llvm.org/D70100



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


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

2019-11-21 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: teemperor.
labath added a comment.

[This is probably not the right patch, as the last run on that bot still 
doesn't have this commit.]

My understanding is that all pexpect tests are failing on that bot and are 
skipped with `@skipIfAsan`. Probably this one needs to be skipped too. 
@teemperor was trying to reproduce some of those failures locally and failed... 
Maybe that bot is cursed...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324



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


[Lldb-commits] [PATCH] D70100: [DWARF] Handle call sites with indirect call targets

2019-11-21 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

Ping.


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

https://reviews.llvm.org/D70100



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


[Lldb-commits] [lldb] f5759d5 - [Test] Split up TestIntegerTypes.py

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

Author: Jonas Devlieghere
Date: 2019-11-21T11:24:14-08:00
New Revision: f5759d5dbc441f1fe956757408f46e65611b94e5

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

LOG: [Test] Split up TestIntegerTypes.py

The unsplit test is timing out on GreenDragon's sanitized bot. By
splitting the test we avoid this issue and increase parallelism.

Added: 
lldb/packages/Python/lldbsuite/test/types/TestCharType.py
lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
lldb/packages/Python/lldbsuite/test/types/TestIntegerTypeExpr.py
lldb/packages/Python/lldbsuite/test/types/TestLongTypes.py
lldb/packages/Python/lldbsuite/test/types/TestLongTypesExpr.py
lldb/packages/Python/lldbsuite/test/types/TestShortType.py
lldb/packages/Python/lldbsuite/test/types/TestShortTypeExpr.py

Modified: 


Removed: 
lldb/packages/Python/lldbsuite/test/types/TestIntegerTypes.py
lldb/packages/Python/lldbsuite/test/types/TestIntegerTypesExpr.py



diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestCharType.py 
b/lldb/packages/Python/lldbsuite/test/types/TestCharType.py
new file mode 100644
index ..bc568702c669
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/types/TestCharType.py
@@ -0,0 +1,32 @@
+"""
+Test that variables of type char are displayed correctly.
+"""
+
+import AbstractBase
+
+from lldbsuite.test.decorators import *
+
+
+class CharTypeTestCase(AbstractBase.GenericTester):
+
+mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+def test_char_type(self):
+"""Test that char-type variables are displayed correctly."""
+self.build_and_run('char.cpp', set(['char']), qd=True)
+
+@skipUnlessDarwin
+def test_char_type_from_block(self):
+"""Test that char-type variables are displayed correctly from a 
block."""
+self.build_and_run('char.cpp', set(['char']), bc=True, qd=True)
+
+def test_unsigned_char_type(self):
+"""Test that 'unsigned_char'-type variables are displayed correctly."""
+self.build_and_run(
+'unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+
+@skipUnlessDarwin
+def test_unsigned_char_type_from_block(self):
+"""Test that 'unsigned char'-type variables are displayed correctly 
from a block."""
+self.build_and_run(
+'unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py 
b/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
new file mode 100644
index ..63ddc1451b95
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/types/TestCharTypeExpr.py
@@ -0,0 +1,32 @@
+"""
+Test that variable expressions of type char are evaluated correctly.
+"""
+
+import AbstractBase
+
+from lldbsuite.test.decorators import *
+
+
+class CharTypeExprTestCase(AbstractBase.GenericTester):
+
+mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+def test_char_type(self):
+"""Test that char-type variable expressions are evaluated correctly."""
+self.build_and_run_expr('char.cpp', set(['char']), qd=True)
+
+@skipUnlessDarwin
+def test_char_type_from_block(self):
+"""Test that char-type variables are displayed correctly from a 
block."""
+self.build_and_run_expr('char.cpp', set(['char']), bc=True, qd=True)
+
+def test_unsigned_char_type(self):
+"""Test that 'unsigned_char'-type variable expressions are evaluated 
correctly."""
+self.build_and_run_expr(
+'unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+
+@skipUnlessDarwin
+def test_unsigned_char_type_from_block(self):
+"""Test that 'unsigned char'-type variables are displayed correctly 
from a block."""
+self.build_and_run_expr(
+'unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)

diff  --git a/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py 
b/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
new file mode 100644
index ..549b37af3e8c
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/types/TestIntegerType.py
@@ -0,0 +1,31 @@
+"""
+Test that variables of type integer are displayed correctly.
+"""
+
+import AbstractBase
+
+from lldbsuite.test.decorators import *
+
+
+class IntegerTypesTestCase(AbstractBase.GenericTester):
+
+mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+def test_int_type(self):
+"""Test that int-type variables are displayed correctly."""
+self.build_and_run('int.cpp', set(['int']))
+
+@skipUnlessDarwin
+def test_int_type_from_block(self):
+"""Test that int-type 

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

2019-11-21 Thread Jordan Rupprecht via lldb-commits
I'm not at a computer right now, so feel free to revert this commit now and
I'll take a look at then failures later. Thanks!

On Thu, Nov 21, 2019, 11:09 AM Jonas Devlieghere via Phabricator <
revi...@reviews.llvm.org> wrote:

> JDevlieghere added a comment.
>
> Looks like we happened to be looking at this at the same time :D
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D70324/new/
>
> https://reviews.llvm.org/D70324
>
>
>
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2019-11-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Looks like we happened to be looking at this at the same time :D


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324



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


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

2019-11-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Hey Jordan, the test is failing on the sanitized bot on GreenDragon. The error 
is `Could not terminate the child`. Could you have a look?

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-sanitized/541/console


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324



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


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

2019-11-21 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Hey Jordan, it looks like some of the changes to TestEditLine [or adjacent to 
it] broke the sanitized build on macOS.
Can I ask you to take a look? Thanks

http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-sanitized/539/console


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324



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


[Lldb-commits] [PATCH] D70415: Complete complete types early when importing types from Clang module DWARF.

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



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:236
+  if (pcm_type.IsDefined())
+GetClangASTImporter().RequireCompleteType(ClangUtil::GetQualType(type));
+

vsk wrote:
> AIUI, when RequireCompleteType returns false, type completion has failed and 
> a diagnostic is emitted. When that happens, should `ParseTypeFromClangModule` 
> still proceed to create the type?
I believe yes, because even the forward declaration alone will be of (limited) 
usefulness to represent pointer types.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70415



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


[Lldb-commits] [PATCH] D70415: Complete complete types early when importing types from Clang module DWARF.

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



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:236
+  if (pcm_type.IsDefined())
+GetClangASTImporter().RequireCompleteType(ClangUtil::GetQualType(type));
+

aprantl wrote:
> vsk wrote:
> > AIUI, when RequireCompleteType returns false, type completion has failed 
> > and a diagnostic is emitted. When that happens, should 
> > `ParseTypeFromClangModule` still proceed to create the type?
> I believe yes, because even the forward declaration alone will be of 
> (limited) usefulness to represent pointer types.
That said, `pcm_type.IsDefined()` already tells us that the type has been 
completed successfully once, so this would be a hard situation to get into.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70415



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


[Lldb-commits] [PATCH] D70448: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-21 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Looks right, thanks for catching this.


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

https://reviews.llvm.org/D70448



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


[Lldb-commits] [PATCH] D70415: Complete complete types early when importing types from Clang module DWARF.

2019-11-21 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:236
+  if (pcm_type.IsDefined())
+GetClangASTImporter().RequireCompleteType(ClangUtil::GetQualType(type));
+

AIUI, when RequireCompleteType returns false, type completion has failed and a 
diagnostic is emitted. When that happens, should `ParseTypeFromClangModule` 
still proceed to create the type?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70415



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


[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb775bee2125: [Docs] Generate the LLDB man page with Sphinx 
(authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70514

Files:
  lldb/docs/CMakeLists.txt
  lldb/docs/conf.py
  lldb/docs/lldb.1
  lldb/docs/man/lldb.rst
  lldb/tools/driver/Options.td

Index: lldb/tools/driver/Options.td
===
--- lldb/tools/driver/Options.td
+++ lldb/tools/driver/Options.td
@@ -5,6 +5,8 @@
 class R prefixes, string name>
   : Option;
 
+// Please keep this in sync with the man page in docs/man/lldb.rst
+
 // Attaching options.
 def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
 
@@ -117,7 +119,7 @@
 
 def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
   MetaVarName<"">,
-  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  HelpText<"When in batch mode, tells the debugger to run this one-line lldb command if the target crashes.">,
   Group;
 def: Separate<["-"], "k">,
   Alias,
Index: lldb/docs/man/lldb.rst
===
--- /dev/null
+++ lldb/docs/man/lldb.rst
@@ -0,0 +1,316 @@
+:orphan:
+
+lldb -- The Debugger
+
+
+.. program:: lldb
+
+SYNOPSIS
+
+
+| :program:`lldb` [*options*] *executable*
+
+DESCRIPTION
+---
+
+:program:`lldb` is a fully featured debugger. It is a command line interface to
+the LLDB debugger library.
+
+ATTACHING
+-
+
+.. option:: --attach-name 
+
+ Tells the debugger to attach to a process with the given name.
+
+.. option:: --attach-pid 
+
+ Tells the debugger to attach to a process with the given pid.
+
+.. option:: -n 
+
+ Alias for --attach-name
+
+.. option:: -p 
+
+ Alias for --attach-pid
+
+.. option:: --wait-for
+
+ Tells the debugger to wait for a process with the given pid or name to launch before attaching.
+
+.. option:: -w
+
+ Alias for --wait-for
+
+COMMANDS
+
+
+.. option:: --batch
+
+ Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.
+
+.. option:: -b
+
+ Alias for --batch
+
+.. option:: -K 
+
+ Alias for --source-on-crash
+
+.. option:: -k 
+
+ Alias for --one-line-on-crash
+
+.. option:: --local-lldbinit
+
+ Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.
+
+.. option:: --no-lldbinit
+
+ Do not automatically parse any '.lldbinit' files.
+
+.. option:: --one-line-before-file 
+
+ Tells the debugger to execute this one-line lldb command before any file provided on the command line has been loaded.
+
+.. option::  --one-line-on-crash 
+
+ When in batch mode, tells the debugger to run this one-line lldb command if the target crashes.
+
+.. option:: --one-line 
+
+ Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.
+
+.. option:: -O 
+
+ Alias for --one-line-before-file
+
+.. option:: -o 
+
+ Alias for --one-line
+
+.. option:: -Q
+
+ Alias for --source-quietly
+
+.. option:: --source-before-file 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.
+
+.. option:: --source-on-crash 
+
+ When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.
+
+.. option:: --source-quietly
+
+ Tells the debugger to execute this one-line lldb command before any file has been loaded.
+
+.. option:: --source 
+
+ Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.
+
+.. option:: -S 
+
+ Alias for --source-before-file
+
+.. option:: -s 
+
+ Alias for --source
+
+.. option:: -x
+
+ Alias for --no-lldbinit
+
+OPTIONS
+---
+
+.. option:: --arch 
+
+ Tells the debugger to use the specified architecture when starting and running the program.
+
+.. option:: -a 
+
+ Alias for --arch
+
+.. option:: --capture-path 
+
+ Tells the debugger to use the given filename for the reproducer.
+
+.. option:: --capture
+
+ Tells the debugger to capture a reproducer.
+
+.. option:: --core 
+
+ Tells the debugger to use the full path to  as the core file.
+
+.. option:: -c 
+
+ Alias for --core
+
+.. option:: --debug
+
+ Tells the debugger to print out extra information for debugging itself.
+
+.. option:: -d
+
+ Alias for --debug
+
+.. option:: --editor
+
+ Tells the debugger to open source files using the host's "external editor" mechanism.
+
+.. option:: -e
+
+ Alias for --editor
+
+.. option:: --file 
+
+ Tells the debugger to use the file  as the program to be debugged.
+
+.. option:: -f 
+
+ Alias for --file
+
+.. option:: --help
+
+ Prints out the usage information for the LLDB debugger.
+
+.. option:: -h
+
+ Alias for --help
+
+.. option:: 

[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

2019-11-21 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D70514#1754690 , @labath wrote:

> LGTM. Unless you're interested in tablegening the command line option list, 
> that is. :)


I considered it, but maybe that's something for the thanksgiving break ;-)


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

https://reviews.llvm.org/D70514



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


[Lldb-commits] [lldb] 3b69f0c - [NFC] Refactor and improve comments in CommandObjectTarget

2019-11-21 Thread Adrian McCarthy via lldb-commits

Author: Adrian McCarthy
Date: 2019-11-21T08:37:35-08:00
New Revision: 3b69f0c5550a229dd6d39e361182cdd7cecc36a4

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

LOG: [NFC] Refactor and improve comments in CommandObjectTarget

Made small improvements while debugging through
CommandObjectTarget::AddModuleSymbols.

1.  Refactored error case for an early out, reducing the indentation of
the rest of this long function.
2.  Clarified some comments by correcting spelling and punctuation.
3.  Reduced duplicate code at the end of the function.

Tested with `ninja check-lldb`

Differential Review: https://reviews.llvm.org/D70458

Added: 


Modified: 
lldb/source/Commands/CommandObjectTarget.cpp

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 64e7e691cf82..90578d2b0092 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -4044,169 +4044,165 @@ class CommandObjectTargetSymbolsAdd : public 
CommandObjectParsed {
   bool AddModuleSymbols(Target *target, ModuleSpec _spec, bool ,
 CommandReturnObject ) {
 const FileSpec _fspec = module_spec.GetSymbolFileSpec();
-if (symbol_fspec) {
-  char symfile_path[PATH_MAX];
-  symbol_fspec.GetPath(symfile_path, sizeof(symfile_path));
+if (!symbol_fspec) {
+  result.AppendError(
+  "one or more executable image paths must be specified");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
 
-  if (!module_spec.GetUUID().IsValid()) {
-if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
-  module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
-  }
-  // We now have a module that represents a symbol file that can be used
-  // for a module that might exist in the current target, so we need to
-  // find that module in the target
-  ModuleList matching_module_list;
-
-  size_t num_matches = 0;
-  // First extract all module specs from the symbol file
-  lldb_private::ModuleSpecList symfile_module_specs;
-  if (ObjectFile::GetModuleSpecifications(module_spec.GetSymbolFileSpec(),
-  0, 0, symfile_module_specs)) {
-// Now extract the module spec that matches the target architecture
-ModuleSpec target_arch_module_spec;
-ModuleSpec symfile_module_spec;
-target_arch_module_spec.GetArchitecture() = target->GetArchitecture();
-if 
(symfile_module_specs.FindMatchingModuleSpec(target_arch_module_spec,
-symfile_module_spec)) {
-  // See if it has a UUID?
-  if (symfile_module_spec.GetUUID().IsValid()) {
-// It has a UUID, look for this UUID in the target modules
-ModuleSpec symfile_uuid_module_spec;
-symfile_uuid_module_spec.GetUUID() = symfile_module_spec.GetUUID();
-target->GetImages().FindModules(symfile_uuid_module_spec,
-matching_module_list);
-num_matches = matching_module_list.GetSize();
-  }
+char symfile_path[PATH_MAX];
+symbol_fspec.GetPath(symfile_path, sizeof(symfile_path));
+
+if (!module_spec.GetUUID().IsValid()) {
+  if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
+module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
+}
+
+// We now have a module that represents a symbol file that can be used
+// for a module that might exist in the current target, so we need to
+// find that module in the target
+ModuleList matching_module_list;
+
+size_t num_matches = 0;
+// First extract all module specs from the symbol file
+lldb_private::ModuleSpecList symfile_module_specs;
+if (ObjectFile::GetModuleSpecifications(module_spec.GetSymbolFileSpec(),
+0, 0, symfile_module_specs)) {
+  // Now extract the module spec that matches the target architecture
+  ModuleSpec target_arch_module_spec;
+  ModuleSpec symfile_module_spec;
+  target_arch_module_spec.GetArchitecture() = target->GetArchitecture();
+  if (symfile_module_specs.FindMatchingModuleSpec(target_arch_module_spec,
+  symfile_module_spec)) {
+// See if it has a UUID?
+if (symfile_module_spec.GetUUID().IsValid()) {
+  // It has a UUID, look for this UUID in the target modules
+  ModuleSpec symfile_uuid_module_spec;
+  symfile_uuid_module_spec.GetUUID() = symfile_module_spec.GetUUID();
+  

[Lldb-commits] [PATCH] D70022: [lldb] [Process/NetBSD] Improve threading support

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

@labath, finally implemented the new tests. Covered two good (signal to one 
thread and to all threads) and two bad cases (signal to 1https://reviews.llvm.org/D70022/new/

https://reviews.llvm.org/D70022

Files:
  
lldb/packages/Python/lldbsuite/test/commands/watchpoints/hello_watchlocation/TestWatchLocation.py
  
lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_set_command/TestWatchLocationWithWatchSet.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointOneDelayBreakpointThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
  
lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
  
lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vContThreads.py
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h

Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -48,11 +48,16 @@
 private:
   // Interface for friend classes
 
+  Status Resume();
+  Status SingleStep();
+  Status Suspend();
+
   void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
   void SetStoppedByBreakpoint();
   void SetStoppedByTrace();
   void SetStoppedByExec();
   void SetStoppedByWatchpoint(uint32_t wp_index);
+  void SetStoppedWithNoReason();
   void SetStopped();
   void SetRunning();
   void SetStepping();
Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -18,6 +18,11 @@
 #include "lldb/Utility/State.h"
 #include "llvm/Support/Errno.h"
 
+// clang-format off
+#include 
+#include 
+// clang-format on
+
 #include 
 
 // clang-format off
@@ -36,6 +41,38 @@
 NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(process.GetArchitecture(), *this)
 ), m_stop_description() {}
 
+Status NativeThreadNetBSD::Resume() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_CLEARSTEP, m_process.GetID(),
+   nullptr, GetID());
+  if (ret.Success())
+SetRunning();
+  return ret;
+}
+
+Status NativeThreadNetBSD::SingleStep() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = 

[Lldb-commits] [PATCH] D70448: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-21 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea added a comment.

This is a trivial change, unless you have any objections, I'll go forward with 
this.


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

https://reviews.llvm.org/D70448



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


[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

2019-11-21 Thread Frederic Riss via Phabricator via lldb-commits
friss added a comment.

In D69309#1754659 , @labath wrote:

> In D69309#1754593 , @jarin wrote:
>
> > In D69309#1752738 , @friss wrote:
> >
> > > Sorry that I haven't reviewed the patch, but there's something I'd like 
> > > to point out before anyone invests a lot of time into plugin holes in our 
> > > current template support code.
> > >
> > > It would be great to fix the way templates are represented, because 
> > > currently the debug info doesn't allow us to answer Clang's requests 
> > > correctly. There is the beginning of a discussion here: 
> > > http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
> > >
> > > Basically, today the debug info will describe an entity named "Foo". 
> > > The accelerator tables all reference this name. So when Clang asks us if 
> > > we know "Foo" (which is what happens when instantiating), we fail to find 
> > > the right instantiations. The consensus of the above discussion was that 
> > > we should change the debug info to have "Foo" as the name of any 
> > > instantiation, with a child DIE describing the template arguments. Just 
> > > doing this in the compiler causes test failures in LLDB, so there's some 
> > > work to do in LLDB to support this.
> >
> >
> > Having an entity for the template itself would be great. However, that 
> > would require compiler changes, so only the code compiled with new 
> > compilers would benefit, no? I am afraid we need a story for older 
> > toolchains, too.
>


Finding a way to handle older toolchains would be great, but not essential IMO. 
I would hope that when most people upgrade their LLDB, they also get a Clang 
update. We need to be careful not to break what is already working with older 
compilers though.


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

https://reviews.llvm.org/D69309



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


[Lldb-commits] [lldb] 8cf8ec4 - [lldb][NFC] Modernize string handling in ClangExpressionDeclMap::FindExternalVisibleDecl

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T14:59:47+01:00
New Revision: 8cf8ec40a1fee9706237d30385e78e1de214d8f7

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

LOG: [lldb][NFC] Modernize string handling in 
ClangExpressionDeclMap::FindExternalVisibleDecl

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index c6cb63407f70..418a90614cd1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1453,20 +1453,17 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   if (!namespace_decl)
 SearchPersistenDecls(context, name, current_id);
 
-  if (name.GetCString()[0] == '$' && !namespace_decl) {
-static ConstString g_lldb_class_name("$__lldb_class");
-
-if (name == g_lldb_class_name) {
+  if (name.GetStringRef().startswith("$") && !namespace_decl) {
+if (name == "$__lldb_class") {
   LookUpLldbClass(context, current_id);
   return;
 }
 
-static ConstString g_lldb_objc_class_name("$__lldb_objc_class");
-if (name == g_lldb_objc_class_name) {
+if (name == "$__lldb_objc_class") {
   LookUpLldbObjCClass(context, current_id);
   return;
 }
-if (name == ConstString(g_lldb_local_vars_namespace_cstr)) {
+if (name == g_lldb_local_vars_namespace_cstr) {
   LookupLocalVarNamespace(sym_ctx, context);
   return;
 }
@@ -1483,7 +1480,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   return;
 }
 
-const char *reg_name(()[1]);
+assert(name.GetStringRef().startswith("$"));
+llvm::StringRef reg_name = name.GetStringRef().substr(1);
 
 if (m_parser_vars->m_exe_ctx.GetRegisterContext()) {
   const RegisterInfo *reg_info(
@@ -1500,9 +1498,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
 return;
   }
 
-  bool local_var_lookup =
-  !namespace_decl || (namespace_decl.GetName() ==
-  ConstString(g_lldb_local_vars_namespace_cstr));
+  bool local_var_lookup = !namespace_decl || (namespace_decl.GetName() ==
+  
g_lldb_local_vars_namespace_cstr);
   if (frame && local_var_lookup)
 if (LookupLocalVariable(context, name, current_id, sym_ctx, 
namespace_decl))
   return;



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


[Lldb-commits] [PATCH] D70458: [NFC] Refactor and improve comments in CommandObjectTarget

2019-11-21 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/Commands/CommandObjectTarget.cpp:4059
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
-  module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
+module_spec.GetFileSpec() = symbol_fspec;
 }

amccarth wrote:
> labath wrote:
> > This does change behavior because previously the symbol file directory 
> > wasn't being copied. I think that was intentional because the comment on 
> > line 4112 says "match up the file by basename" (and it also makes sense 
> > because if you're adding symbols in an external file, then the main module 
> > file cannot be the exact same path as the symbol file).
> Oops.  Thanks for catching that.
> 
> ModuleSpec seems weird:  It exposes an internal members to be tweaked in 
> arbitrary ways.  I would have expected that it would have to react to certain 
> kinds of changes to keep itself consistent.  If it has no invariants to 
> enforce, it could have been a plain struct with a bunch of public member 
> variables.
This isn't really a matter of internal consistency. Both things make sense -- 
sometimes you want to match an actual full path, and sometimes only the 
basename.

That said, module spec does not have any internal consistency checks, and I 
don't think any are needed, so I think that replacing all the getters with 
public members would be a good idea.


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

https://reviews.llvm.org/D70458



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


[Lldb-commits] [lldb] 5fb7dd8 - [lldb][NFC] Move searching functions in ClangExpressionDeclMap to own function

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T14:31:31+01:00
New Revision: 5fb7dd8a40d2f35eea47b9c280722bd735e387a0

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

LOG: [lldb][NFC] Move searching functions in ClangExpressionDeclMap to own 
function

Added: 


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

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 0fdc5e266a0f..c6cb63407f70 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1216,97 +1216,13 @@ bool ClangExpressionDeclMap::LookupLocalVariable(
   return false;
 }
 
-void ClangExpressionDeclMap::FindExternalVisibleDecls(
-NameSearchContext , lldb::ModuleSP module_sp,
-CompilerDeclContext _decl, unsigned int current_id) {
-  assert(m_ast_context);
-
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
+void ClangExpressionDeclMap::LookupFunction(NameSearchContext ,
+lldb::ModuleSP module_sp,
+ConstString name,
+CompilerDeclContext 
_decl,
+unsigned current_id) {
 
-  const ConstString name(context.m_decl_name.getAsString().c_str());
-  if (IgnoreName(name, false))
-return;
-
-  // Only look for functions by name out in our symbols if the function doesn't
-  // start with our phony prefix of '$'
   Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-  StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
-  SymbolContext sym_ctx;
-  if (frame != nullptr)
-sym_ctx = frame->GetSymbolContext(lldb::eSymbolContextFunction |
-  lldb::eSymbolContextBlock);
-
-  // Try the persistent decls, which take precedence over all else.
-  if (!namespace_decl)
-SearchPersistenDecls(context, name, current_id);
-
-  if (name.GetCString()[0] == '$' && !namespace_decl) {
-static ConstString g_lldb_class_name("$__lldb_class");
-
-if (name == g_lldb_class_name) {
-  LookUpLldbClass(context, current_id);
-  return;
-}
-
-static ConstString g_lldb_objc_class_name("$__lldb_objc_class");
-if (name == g_lldb_objc_class_name) {
-  LookUpLldbObjCClass(context, current_id);
-  return;
-}
-if (name == ConstString(g_lldb_local_vars_namespace_cstr)) {
-  LookupLocalVarNamespace(sym_ctx, context);
-  return;
-}
-
-// any other $__lldb names should be weeded out now
-if (name.GetStringRef().startswith("$__lldb"))
-  return;
-
-ExpressionVariableSP pvar_sp(
-m_parser_vars->m_persistent_vars->GetVariable(name));
-
-if (pvar_sp) {
-  AddOneVariable(context, pvar_sp, current_id);
-  return;
-}
-
-const char *reg_name(()[1]);
-
-if (m_parser_vars->m_exe_ctx.GetRegisterContext()) {
-  const RegisterInfo *reg_info(
-  m_parser_vars->m_exe_ctx.GetRegisterContext()->GetRegisterInfoByName(
-  reg_name));
-
-  if (reg_info) {
-LLDB_LOGF(log, "  CEDM::FEVD[%u] Found register %s", current_id,
-  reg_info->name);
-
-AddOneRegister(context, reg_info, current_id);
-  }
-}
-return;
-  }
-
-  bool local_var_lookup =
-  !namespace_decl || (namespace_decl.GetName() ==
-  ConstString(g_lldb_local_vars_namespace_cstr));
-  if (frame && local_var_lookup)
-if (LookupLocalVariable(context, name, current_id, sym_ctx, 
namespace_decl))
-  return;
-
-  if (target) {
-ValueObjectSP valobj;
-VariableSP var;
-var = FindGlobalVariable(*target, module_sp, name, _decl,
- nullptr);
-
-if (var) {
-  valobj = ValueObjectVariable::Create(target, var);
-  AddOneVariable(context, var, valobj, current_id);
-  context.m_found.variable = true;
-  return;
-}
-  }
 
   std::vector decls_from_modules;
 
@@ -1511,6 +1427,101 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   }
 }
   }
+}
+
+void ClangExpressionDeclMap::FindExternalVisibleDecls(
+NameSearchContext , lldb::ModuleSP module_sp,
+CompilerDeclContext _decl, unsigned int current_id) {
+  assert(m_ast_context);
+
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
+
+  const ConstString name(context.m_decl_name.getAsString().c_str());
+  if (IgnoreName(name, false))
+return;
+
+  // Only look for functions by name out 

[Lldb-commits] [lldb] 24e9886 - [lldb][NFC] Reduce scope of some variables in ClangExpressionDeclMap::FindExternalVisibleDecls

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T13:43:48+01:00
New Revision: 24e98867937d5bb89605fd7be7e9ebdd3d5fb935

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

LOG: [lldb][NFC] Reduce scope of some variables in 
ClangExpressionDeclMap::FindExternalVisibleDecls

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 50e76be8f31b..0fdc5e266a0f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1223,8 +1223,6 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  SymbolContextList sc_list;
-
   const ConstString name(context.m_decl_name.getAsString().c_str());
   if (IgnoreName(name, false))
 return;
@@ -1288,8 +1286,6 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
 }
 return;
   }
-  ValueObjectSP valobj;
-  VariableSP var;
 
   bool local_var_lookup =
   !namespace_decl || (namespace_decl.GetName() ==
@@ -1299,6 +1295,8 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   return;
 
   if (target) {
+ValueObjectSP valobj;
+VariableSP var;
 var = FindGlobalVariable(*target, module_sp, name, _decl,
  nullptr);
 
@@ -1320,7 +1318,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   }
 
   const bool include_inlines = false;
-  sc_list.Clear();
+  SymbolContextList sc_list;
   if (namespace_decl && module_sp) {
 const bool include_symbols = false;
 



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


[Lldb-commits] [PATCH] D70532: [lldb] Improve/fix base address selection in location lists

2019-11-21 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, aprantl, clayborg.
Herald added a project: LLDB.

Lldb support base address selection entries in location lists was broken
for a long time. This wasn't noticed until llvm started producing these
kinds of entries more frequently with r374600.

In r374769, I made a quick patch which added sufficient support for them
to get the test suite to pass. However, I did not fully understand how
this code operates, and so the fix was not complete. Specifically, what
was lacking was the ability to handle modules which were not loaded at
their preferred load address (for instance, due to ASLR).

Now that I better understand how this code works, I've come to the
conclusion that the current setup does not provide enough information
to correctly process these entries. In the current setup the location
lists were parameterized by two addresses:

- the distance of the function start from the start of the compile unit. The 
purpose of this was to make the location ranges relative to the start of the 
function.
- the actual address where the function was loaded at. With this the 
function-start-relative ranges can be translated to actual memory locations.

The reason for the two values, instead of just one (the load bias) is (I
think) MachO, where the debug info in the object files will appear to be
relative to the address zero, but the actual code it refers to
can be moved and reordered by the linker. This means that the location
lists need to be "linked" to reflect the locations in the actual linked
file.

These two bits of information were enough to correctly process location
lists which do not contain base address selection entries (and so all
entries are relative to the CU base). However, they don't work with
them because, in theory two base address can be completely unrelated (as
can happen for instace with hot/cold function splitting, where the
linker can reorder the two pars arbitrarily).

To fix that, I split the first parameter into two:

- the compile unit base address
- the function start address, as is known in the object file

The new algorithm becomes:

- the location lists are processed as they were meant to be processed. The CU 
base address is used as the initial base address value. Base address selection 
entries can set a new base.
- the difference between the "file" and "load" function start addresses is used 
to compute the load bias. This value is added to the final ranges to get the 
actual memory location.

This algorithm is correct for non-MachO debug info, as there the
location lists correctly describe the code in the final executable, and
the dynamic linker can just move the entire module, not pieces of it. It
will also be correct for MachO if the static linker preserves relative
positions of the various parts of the location lists -- I don't know
whether it actually does that, but judging by the lack of base address
selection support in dsymutil and lldb, this isn't something that has
come up in the past.

I add a test case which simulates the ASLR scenario and demonstrates
that base address selection entries now work correctly here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70532

Files:
  lldb/include/lldb/Expression/DWARFExpression.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/Shell/SymbolFile/DWARF/Inputs/debug_loc-aslr.yaml
  lldb/test/Shell/SymbolFile/DWARF/debug_loc-aslr.s

Index: lldb/test/Shell/SymbolFile/DWARF/debug_loc-aslr.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/debug_loc-aslr.s
@@ -0,0 +1,129 @@
+# This test checks the handling of location lists in the case when the module is
+# not loaded at the address at which it was linked (as happens with ASLR for
+# instance).
+
+# REQUIRES: x86
+
+# RUN: yaml2obj %S/Inputs/debug_loc-aslr.yaml >%t.dmp
+# RUN: llvm-mc --triple=x86_64-pc-linux --filetype=obj %s >%t.o
+# RUN: %lldb -c %t.dmp -o "image add %t.o" \
+# RUN:   -o "image load --file %t.o --slide 0x47" \
+# RUN:   -o "thread info" -o "frame variable" -o exit | FileCheck %s
+
+# CHECK: thread #1: tid = 16001, 0x00470001 {{.*}}`_start
+# CHECK: (int) x = 47
+# CHECK: (int) y = 74
+
+.text
+.globl _start
+_start:
+nop
+retq
+.Lstart_end:
+
+.section.debug_loc,"",@progbits
+# This location list implicitly uses the base address of the compile unit.
+.Ldebug_loc0:
+.quad   _start-_start
+.quad   .Lstart_end-_start
+.short  3   # Loc expr size
+.byte   8   # DW_OP_const1u
+.byte   47
+.byte   159 # DW_OP_stack_value
+.quad   0
+.quad   0
+
+# This is an equivalent location list to the first one, but here the 

[Lldb-commits] [lldb] ffc4ff8 - [lldb][NFC] Remove test directory completely

2019-11-21 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2019-11-21T15:03:37+03:00
New Revision: ffc4ff868fcca29080dcc90e223b582c4ccfc574

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

LOG: [lldb][NFC] Remove test directory completely

The test was moved to "completion-in-lambda-and-unnamed-class" by D66175.

+ Fix typo in the directory name.

Added: 

lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnamed-class/TestCompletionInLambdaAndUnnamedClass.py

lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnamed-class/main.cpp

Modified: 


Removed: 

lldb/packages/Python/lldbsuite/test/commands/expression/completion-crash-lambda/Makefile

lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py

lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnnamed-class/main.cpp



diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/completion-crash-lambda/Makefile
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/completion-crash-lambda/Makefile
deleted file mode 100644
index 3d0b98f13f3d..
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/completion-crash-lambda/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-CXX_SOURCES := main.cpp
-include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnamed-class/TestCompletionInLambdaAndUnnamedClass.py
similarity index 100%
rename from 
lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnnamed-class/TestCompletionInLambdaAndUnnamedClass.py
rename to 
lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnamed-class/TestCompletionInLambdaAndUnnamedClass.py

diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnnamed-class/main.cpp
 
b/lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnamed-class/main.cpp
similarity index 100%
rename from 
lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnnamed-class/main.cpp
rename to 
lldb/packages/Python/lldbsuite/test/commands/expression/completion-in-lambda-and-unnamed-class/main.cpp



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


[Lldb-commits] [lldb] 7fa976d - [lldb][NFC] Move searching local variables into own function

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T12:45:38+01:00
New Revision: 7fa976d57a1e2ab735212e5d9fc13cc38c4c81e9

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

LOG: [lldb][NFC] Move searching local variables into own function

Added: 


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

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index a4ca7cb6cc7b..50e76be8f31b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1169,6 +1169,53 @@ void ClangExpressionDeclMap::LookupInModulesDeclVendor(
   }
 }
 
+bool ClangExpressionDeclMap::LookupLocalVariable(
+NameSearchContext , ConstString name, unsigned current_id,
+SymbolContext _ctx, CompilerDeclContext _decl) {
+  ValueObjectSP valobj;
+  VariableSP var;
+
+  StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr();
+  CompilerDeclContext compiler_decl_context =
+  sym_ctx.block != nullptr ? sym_ctx.block->GetDeclContext()
+   : CompilerDeclContext();
+
+  if (compiler_decl_context) {
+// Make sure that the variables are parsed so that we have the
+// declarations.
+VariableListSP vars = frame->GetInScopeVariableList(true);
+for (size_t i = 0; i < vars->GetSize(); i++)
+  vars->GetVariableAtIndex(i)->GetDecl();
+
+// Search for declarations matching the name. Do not include imported
+// decls in the search if we are looking for decls in the artificial
+// namespace $__lldb_local_vars.
+std::vector found_decls =
+compiler_decl_context.FindDeclByName(name, namespace_decl.IsValid());
+
+bool variable_found = false;
+for (CompilerDecl decl : found_decls) {
+  for (size_t vi = 0, ve = vars->GetSize(); vi != ve; ++vi) {
+VariableSP candidate_var = vars->GetVariableAtIndex(vi);
+if (candidate_var->GetDecl() == decl) {
+  var = candidate_var;
+  break;
+}
+  }
+
+  if (var && !variable_found) {
+variable_found = true;
+valobj = ValueObjectVariable::Create(frame, var);
+AddOneVariable(context, var, valobj, current_id);
+context.m_found.variable = true;
+  }
+}
+if (variable_found)
+  return true;
+  }
+  return false;
+}
+
 void ClangExpressionDeclMap::FindExternalVisibleDecls(
 NameSearchContext , lldb::ModuleSP module_sp,
 CompilerDeclContext _decl, unsigned int current_id) {
@@ -1247,46 +1294,10 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   bool local_var_lookup =
   !namespace_decl || (namespace_decl.GetName() ==
   ConstString(g_lldb_local_vars_namespace_cstr));
-  if (frame && local_var_lookup) {
-CompilerDeclContext compiler_decl_context =
-sym_ctx.block != nullptr ? sym_ctx.block->GetDeclContext()
- : CompilerDeclContext();
-
-if (compiler_decl_context) {
-  // Make sure that the variables are parsed so that we have the
-  // declarations.
-  VariableListSP vars = frame->GetInScopeVariableList(true);
-  for (size_t i = 0; i < vars->GetSize(); i++)
-vars->GetVariableAtIndex(i)->GetDecl();
-
-  // Search for declarations matching the name. Do not include imported
-  // decls in the search if we are looking for decls in the artificial
-  // namespace $__lldb_local_vars.
-  std::vector found_decls =
-  compiler_decl_context.FindDeclByName(name,
-   namespace_decl.IsValid());
-
-  bool variable_found = false;
-  for (CompilerDecl decl : found_decls) {
-for (size_t vi = 0, ve = vars->GetSize(); vi != ve; ++vi) {
-  VariableSP candidate_var = vars->GetVariableAtIndex(vi);
-  if (candidate_var->GetDecl() == decl) {
-var = candidate_var;
-break;
-  }
-}
+  if (frame && local_var_lookup)
+if (LookupLocalVariable(context, name, current_id, sym_ctx, 
namespace_decl))
+  return;
 
-if (var && !variable_found) {
-  variable_found = true;
-  valobj = ValueObjectVariable::Create(frame, var);
-  AddOneVariable(context, var, valobj, current_id);
-  context.m_found.variable = true;
-}
-  }
-  if (variable_found)
-return;
-}
-  }
   if (target) {
 var = FindGlobalVariable(*target, module_sp, name, _decl,
  nullptr);

diff  --git 

[Lldb-commits] [lldb] a0408ab - [lldb][NFC] Move searching the ClangModulesDeclVendor into own function

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T12:04:43+01:00
New Revision: a0408ab7f9863954b9d978d78761ed7b893f13b1

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

LOG: [lldb][NFC] Move searching the ClangModulesDeclVendor into own function

Added: 


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

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index f2d5ded7d98f..a4ca7cb6cc7b 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1099,6 +1099,76 @@ void ClangExpressionDeclMap::LookupLocalVarNamespace(
   }
 }
 
+void ClangExpressionDeclMap::LookupInModulesDeclVendor(
+NameSearchContext , ConstString name, unsigned current_id) {
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
+
+  if (ClangModulesDeclVendor *modules_decl_vendor =
+  m_target->GetClangModulesDeclVendor()) {
+bool append = false;
+uint32_t max_matches = 1;
+std::vector decls;
+
+if (!modules_decl_vendor->FindDecls(name, append, max_matches, decls))
+  return;
+
+clang::NamedDecl *const decl_from_modules = decls[0];
+
+if (llvm::isa(decl_from_modules)) {
+  if (log) {
+LLDB_LOGF(log,
+  "  CAS::FEVD[%u] Matching function found for "
+  "\"%s\" in the modules",
+  current_id, name.GetCString());
+  }
+
+  clang::Decl *copied_decl = CopyDecl(decl_from_modules);
+  clang::FunctionDecl *copied_function_decl =
+  copied_decl ? dyn_cast(copied_decl) : nullptr;
+
+  if (!copied_function_decl) {
+LLDB_LOGF(log,
+  "  CAS::FEVD[%u] - Couldn't export a function "
+  "declaration from the modules",
+  current_id);
+
+return;
+  }
+
+  MaybeRegisterFunctionBody(copied_function_decl);
+
+  context.AddNamedDecl(copied_function_decl);
+
+  context.m_found.function_with_type_info = true;
+  context.m_found.function = true;
+} else if (llvm::isa(decl_from_modules)) {
+  if (log) {
+LLDB_LOGF(log,
+  "  CAS::FEVD[%u] Matching variable found for "
+  "\"%s\" in the modules",
+  current_id, name.GetCString());
+  }
+
+  clang::Decl *copied_decl = CopyDecl(decl_from_modules);
+  clang::VarDecl *copied_var_decl =
+  copied_decl ? dyn_cast_or_null(copied_decl) : 
nullptr;
+
+  if (!copied_var_decl) {
+LLDB_LOGF(log,
+  "  CAS::FEVD[%u] - Couldn't export a variable "
+  "declaration from the modules",
+  current_id);
+
+return;
+  }
+
+  context.AddNamedDecl(copied_var_decl);
+
+  context.m_found.variable = true;
+}
+  }
+}
+
 void ClangExpressionDeclMap::FindExternalVisibleDecls(
 NameSearchContext , lldb::ModuleSP module_sp,
 CompilerDeclContext _decl, unsigned int current_id) {
@@ -1433,78 +1503,9 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
 }
   }
 
-  if (!context.m_found.function_with_type_info) {
-// Try the modules next.
-
-do {
-  if (ClangModulesDeclVendor *modules_decl_vendor =
-  m_target->GetClangModulesDeclVendor()) {
-bool append = false;
-uint32_t max_matches = 1;
-std::vector decls;
-
-if (!modules_decl_vendor->FindDecls(name, append, max_matches, decls))
-  break;
-
-clang::NamedDecl *const decl_from_modules = decls[0];
-
-if (llvm::isa(decl_from_modules)) {
-  if (log) {
-LLDB_LOGF(log,
-  "  CAS::FEVD[%u] Matching function found for "
-  "\"%s\" in the modules",
-  current_id, name.GetCString());
-  }
-
-  clang::Decl *copied_decl = CopyDecl(decl_from_modules);
-  clang::FunctionDecl *copied_function_decl =
-  copied_decl ? dyn_cast(copied_decl)
-  : nullptr;
-
-  if (!copied_function_decl) {
-LLDB_LOGF(log,
-  "  CAS::FEVD[%u] - Couldn't export a function "
-  "declaration from the modules",
-  current_id);
-
-break;
-  }
-
-  MaybeRegisterFunctionBody(copied_function_decl);
-
-  context.AddNamedDecl(copied_function_decl);
-
-  context.m_found.function_with_type_info = true;
-  context.m_found.function = true;
-   

[Lldb-commits] [lldb] 337151f - [lldb][NFC] Move searching for the local variable namespace into own function

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T11:03:24+01:00
New Revision: 337151f41e78f42df1eedbb86479888a2c5d0a04

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

LOG: [lldb][NFC] Move searching for the local variable namespace into own 
function

Added: 


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

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 31bf55ca4af4..f2d5ded7d98f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1073,6 +1073,32 @@ void 
ClangExpressionDeclMap::LookUpLldbObjCClass(NameSearchContext ,
   }
 }
 
+void ClangExpressionDeclMap::LookupLocalVarNamespace(
+SymbolContext _ctx, NameSearchContext ) {
+  CompilerDeclContext frame_decl_context = sym_ctx.block != nullptr
+   ? 
sym_ctx.block->GetDeclContext()
+   : CompilerDeclContext();
+
+  if (frame_decl_context) {
+ClangASTContext *frame_ast = llvm::dyn_cast_or_null(
+frame_decl_context.GetTypeSystem());
+
+ClangASTContext *map_ast = ClangASTContext::GetASTContext(m_ast_context);
+if (frame_ast && map_ast) {
+  clang::NamespaceDecl *namespace_decl =
+  map_ast->GetUniqueNamespaceDeclaration(
+  g_lldb_local_vars_namespace_cstr, nullptr);
+  if (namespace_decl) {
+context.AddNamedDecl(namespace_decl);
+clang::DeclContext *clang_decl_ctx =
+clang::Decl::castToDeclContext(namespace_decl);
+clang_decl_ctx->setHasExternalVisibleStorage(true);
+context.m_found.local_vars_nsp = true;
+  }
+}
+  }
+}
+
 void ClangExpressionDeclMap::FindExternalVisibleDecls(
 NameSearchContext , lldb::ModuleSP module_sp,
 CompilerDeclContext _decl, unsigned int current_id) {
@@ -1113,30 +1139,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   return;
 }
 if (name == ConstString(g_lldb_local_vars_namespace_cstr)) {
-  CompilerDeclContext frame_decl_context =
-  sym_ctx.block != nullptr ? sym_ctx.block->GetDeclContext()
-   : CompilerDeclContext();
-
-  if (frame_decl_context) {
-ClangASTContext *frame_ast = llvm::dyn_cast_or_null(
-frame_decl_context.GetTypeSystem());
-
-ClangASTContext *map_ast =
-ClangASTContext::GetASTContext(m_ast_context);
-if (frame_ast && map_ast) {
-  clang::NamespaceDecl *namespace_decl =
-  map_ast->GetUniqueNamespaceDeclaration(name.GetCString(),
- nullptr);
-  if (namespace_decl) {
-context.AddNamedDecl(namespace_decl);
-clang::DeclContext *clang_decl_ctx =
-clang::Decl::castToDeclContext(namespace_decl);
-clang_decl_ctx->setHasExternalVisibleStorage(true);
-context.m_found.local_vars_nsp = true;
-  }
-}
-  }
-
+  LookupLocalVarNamespace(sym_ctx, context);
   return;
 }
 

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index 93342dace77e..b599e2802d14 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -410,6 +410,17 @@ class ClangExpressionDeclMap : public ClangASTSource {
   /// for logging purposes.
   void LookUpLldbObjCClass(NameSearchContext , unsigned int 
current_id);
 
+  /// Handles looking up the synthetic namespace that contains our local
+  /// variables for the current frame.
+  ///
+  /// \param[in] sym_ctx
+  /// The current SymbolContext of this frame.
+  ///
+  /// \param[in] context
+  /// The NameSearchContext that can construct Decls for this name.
+  void LookupLocalVarNamespace(SymbolContext _ctx,
+   NameSearchContext );
+
   /// Given a target, find a variable that matches the given name and type.
   ///
   /// \param[in] target



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


[Lldb-commits] [PATCH] D70514: [Docs] Generate the LLDB man page with Sphinx

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

LGTM. Unless you're interested in tablegening the command line option list, 
that is. :)


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

https://reviews.llvm.org/D70514



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


[Lldb-commits] [lldb] 2cada1e - [lldb][NFC] Early exit in ClangExpressionDeclMap::FindExternalVisibleDecls

2019-11-21 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-21T10:29:50+01:00
New Revision: 2cada1e4da9d55b54a06b240cc061605729d50f4

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

LOG: [lldb][NFC] Early exit in ClangExpressionDeclMap::FindExternalVisibleDecls

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 7b8456257c62..31bf55ca4af4 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1166,367 +1166,367 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
 AddOneRegister(context, reg_info, current_id);
   }
 }
-  } else {
-ValueObjectSP valobj;
-VariableSP var;
-
-bool local_var_lookup =
-!namespace_decl || (namespace_decl.GetName() ==
-ConstString(g_lldb_local_vars_namespace_cstr));
-if (frame && local_var_lookup) {
-  CompilerDeclContext compiler_decl_context =
-  sym_ctx.block != nullptr ? sym_ctx.block->GetDeclContext()
-   : CompilerDeclContext();
-
-  if (compiler_decl_context) {
-// Make sure that the variables are parsed so that we have the
-// declarations.
-VariableListSP vars = frame->GetInScopeVariableList(true);
-for (size_t i = 0; i < vars->GetSize(); i++)
-  vars->GetVariableAtIndex(i)->GetDecl();
-
-// Search for declarations matching the name. Do not include imported
-// decls in the search if we are looking for decls in the artificial
-// namespace $__lldb_local_vars.
-std::vector found_decls =
-compiler_decl_context.FindDeclByName(name,
- namespace_decl.IsValid());
-
-bool variable_found = false;
-for (CompilerDecl decl : found_decls) {
-  for (size_t vi = 0, ve = vars->GetSize(); vi != ve; ++vi) {
-VariableSP candidate_var = vars->GetVariableAtIndex(vi);
-if (candidate_var->GetDecl() == decl) {
-  var = candidate_var;
-  break;
-}
+return;
+  }
+  ValueObjectSP valobj;
+  VariableSP var;
+
+  bool local_var_lookup =
+  !namespace_decl || (namespace_decl.GetName() ==
+  ConstString(g_lldb_local_vars_namespace_cstr));
+  if (frame && local_var_lookup) {
+CompilerDeclContext compiler_decl_context =
+sym_ctx.block != nullptr ? sym_ctx.block->GetDeclContext()
+ : CompilerDeclContext();
+
+if (compiler_decl_context) {
+  // Make sure that the variables are parsed so that we have the
+  // declarations.
+  VariableListSP vars = frame->GetInScopeVariableList(true);
+  for (size_t i = 0; i < vars->GetSize(); i++)
+vars->GetVariableAtIndex(i)->GetDecl();
+
+  // Search for declarations matching the name. Do not include imported
+  // decls in the search if we are looking for decls in the artificial
+  // namespace $__lldb_local_vars.
+  std::vector found_decls =
+  compiler_decl_context.FindDeclByName(name,
+   namespace_decl.IsValid());
+
+  bool variable_found = false;
+  for (CompilerDecl decl : found_decls) {
+for (size_t vi = 0, ve = vars->GetSize(); vi != ve; ++vi) {
+  VariableSP candidate_var = vars->GetVariableAtIndex(vi);
+  if (candidate_var->GetDecl() == decl) {
+var = candidate_var;
+break;
   }
+}
 
-  if (var && !variable_found) {
-variable_found = true;
-valobj = ValueObjectVariable::Create(frame, var);
-AddOneVariable(context, var, valobj, current_id);
-context.m_found.variable = true;
-  }
+if (var && !variable_found) {
+  variable_found = true;
+  valobj = ValueObjectVariable::Create(frame, var);
+  AddOneVariable(context, var, valobj, current_id);
+  context.m_found.variable = true;
 }
-if (variable_found)
-  return;
   }
+  if (variable_found)
+return;
 }
-if (target) {
-  var = FindGlobalVariable(*target, module_sp, name, _decl,
-   nullptr);
+  }
+  if (target) {
+var = FindGlobalVariable(*target, module_sp, name, _decl,
+ nullptr);
 
-  if (var) {
-valobj = ValueObjectVariable::Create(target, var);
-AddOneVariable(context, var, 

[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

2019-11-21 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added reviewers: rsmith, v.g.vassilev.
teemperor added a comment.

I think this approach looks already much more feasible than the last iteration.

+Richard because he knows better how `FindClassTemplateSpecialization` should 
look like to fit into the other lookup mechanisms we have in the 
ExternalASTSource (and I guess there is some more work needed to not violate 
some AST invariants and do this lookup in the right places). And +Vassil 
because he is probably also interested in having something like this for 
Modules at some point.


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

https://reviews.llvm.org/D69309



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


[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

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

In D69309#1754593 , @jarin wrote:

> In D69309#1752738 , @friss wrote:
>
> > Sorry that I haven't reviewed the patch, but there's something I'd like to 
> > point out before anyone invests a lot of time into plugin holes in our 
> > current template support code.
> >
> > It would be great to fix the way templates are represented, because 
> > currently the debug info doesn't allow us to answer Clang's requests 
> > correctly. There is the beginning of a discussion here: 
> > http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
> >
> > Basically, today the debug info will describe an entity named "Foo". 
> > The accelerator tables all reference this name. So when Clang asks us if we 
> > know "Foo" (which is what happens when instantiating), we fail to find the 
> > right instantiations. The consensus of the above discussion was that we 
> > should change the debug info to have "Foo" as the name of any 
> > instantiation, with a child DIE describing the template arguments. Just 
> > doing this in the compiler causes test failures in LLDB, so there's some 
> > work to do in LLDB to support this.
>
>
> Having an entity for the template itself would be great. However, that would 
> require compiler changes, so only the code compiled with new compilers would 
> benefit, no? I am afraid we need a story for older toolchains, too.


Well, I think that's a question of tradeoffs -- i.e., how many hoops you would 
need to jump through to support the old compiler. Since the "manual" index 
needs to scan the debug info anyway, I think that the cost of supporting this 
flow (both in terms of runtime and code complexity) would be sufficiently low 
to enable that. However, for the apple/dwarf5 indexes the cost (both kinds) 
might be prohibitively high...

I don't think that supporting this only in the "manual" case would be that bad, 
but would still probably want to consider the problem as a whole, and come up 
with an accelerator story too, so that they can eventually catch up in terms of 
functionality...


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

https://reviews.llvm.org/D69309



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


[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

2019-11-21 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added a comment.

In D69309#1752738 , @friss wrote:

> Sorry that I haven't reviewed the patch, but there's something I'd like to 
> point out before anyone invests a lot of time into plugin holes in our 
> current template support code.
>
> It would be great to fix the way templates are represented, because currently 
> the debug info doesn't allow us to answer Clang's requests correctly. There 
> is the beginning of a discussion here: 
> http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
>
> Basically, today the debug info will describe an entity named "Foo". The 
> accelerator tables all reference this name. So when Clang asks us if we know 
> "Foo" (which is what happens when instantiating), we fail to find the right 
> instantiations. The consensus of the above discussion was that we should 
> change the debug info to have "Foo" as the name of any instantiation, with a 
> child DIE describing the template arguments. Just doing this in the compiler 
> causes test failures in LLDB, so there's some work to do in LLDB to support 
> this.


Having an entity for the template itself would be great. However, that would 
require compiler changes, so only the code compiled with new compilers would 
benefit, no? I am afraid we need a story for older toolchains, too.

In this patch, I do it in a really hacky way that does not work with 
accelerator tables, it only works with ManualDWARFIndex by extracting template 
names from instantiated templates.


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

https://reviews.llvm.org/D69309



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


[Lldb-commits] [PATCH] D70517: [lldb][DataFormatters] Support pretty printing std::string when built with -funsigned-char.

2019-11-21 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.

Adding a basic_string formatter seems reasonable, though I have 
to say that I was very surprised that adding -funsinged-char should cause the 
type name of the variable to come out different. I tried building the example 
program with -funsigned-char and without, and literally the only difference was 
the value of the DW_AT_encoding attribute on the "char" type -- everything else 
(including the names of all types) remained the same.

Overall, I am not sure that support for non-native char signedness is really 
sound in lldb. I wouldn't be surprised if we run into other problems with these 
kinds of binaries. The first thing that comes to mind is expression evaluation 
not being able to find the correct function (because it's searching for the 
wrong char), or it selecting the wrong overload.  Unfortunately, making it 
"sound" could be tricky because of the impedance mismatch between what DWARF 
provides vs. what clang expects.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70517



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