[Lldb-commits] [PATCH] D74607: [lldb][NFC] Make all CompilerDeclContext parameters references instead of pointers

2020-02-17 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 244921.
teemperor added a comment.

- Readded some `parent_decl_context.IsValid()` checks to SymbolFilePDB


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

https://reviews.llvm.org/D74607

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/source/API/SBModule.cpp
  lldb/source/Breakpoint/BreakpointResolverName.cpp
  lldb/source/Commands/CommandObjectTarget.cpp
  lldb/source/Core/AddressResolverName.cpp
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/Module.cpp
  lldb/source/Core/ModuleList.cpp
  lldb/source/Core/SourceManager.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
  
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/SymbolFile.cpp
  lldb/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
@@ -395,7 +395,8 @@
   if (Context.empty())
 return CompilerDeclContext();
   VariableList List;
-  Symfile.FindGlobalVariables(ConstString(Context), nullptr, UINT32_MAX, List);
+  Symfile.FindGlobalVariables(ConstString(Context), CompilerDeclContext(),
+  UINT32_MAX, List);
   if (List.Empty())
 return make_string_error("Context search didn't find a match.");
   if (List.GetSize() > 1)
@@ -442,8 +443,8 @@
 Expected ContextOr = getDeclContext(Symfile);
 if (!ContextOr)
   return ContextOr.takeError();
-CompilerDeclContext *ContextPtr =
-ContextOr->IsValid() ? &*ContextOr : nullptr;
+const CompilerDeclContext &ContextPtr =
+ContextOr->IsValid() ? *ContextOr : CompilerDeclContext();
 
 List.Clear();
 Symfile.FindFunctions(ConstString(Name), ContextPtr, getFunctionNameFlags(),
@@ -498,8 +499,8 @@
   Expected ContextOr = getDeclContext(Symfile);
   if (!ContextOr)
 return ContextOr.takeError();
-  CompilerDeclContext *ContextPtr =
-  ContextOr->IsValid() ? &*ContextOr : nullptr;
+  const CompilerDeclContext &ContextPtr =
+  ContextOr->IsValid() ? *ContextOr : CompilerDeclContext();
 
   CompilerDeclContext Result =
   Symfile.FindNamespace(ConstString(Name), ContextPtr);
@@ -516,8 +517,8 @@
   Expected ContextOr = getDeclContext(Symfile);
   if (!ContextOr)
 return ContextOr.takeError();
-  CompilerDeclContext *ContextPtr =
-  ContextOr->IsValid() ? &*ContextOr : nullptr;
+  const CompilerDeclContext &ContextPtr =
+  ContextOr->IsValid() ? *ContextOr : CompilerDeclContext();
 
   LanguageSet languages;
   if (!Language.empty())
@@ -566,8 +567,8 @@
 Expected ContextOr = getDeclContext(Symfile);
 if (!ContextOr)
   return ContextOr.takeError();
-CompilerDeclContext *ContextPtr =
-ContextOr->IsValid() ? &*ContextOr : nullptr;
+const CompilerDeclContext &ContextPtr =
+ContextOr->IsValid() ? *ContextOr : CompilerDeclContext();
 
 Symfile.FindGlobalVariables(ConstString(Name), ContextPtr, UINT32_MAX, List);
   }
Index: lldb/source/Symbol/SymbolFile.cpp
===
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -105,7 +105,7 @@
 }
 
 void SymbolFile::FindGlobalVariables(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
+ const CompilerDeclContext &parent_decl_ctx,
  uint32_t max_matches,
  VariableList &variables) {}
 
@@ -114,7 +114,7 @@
  VariableList &variables) {}
 
 void SymbolFile::FindFunctions(ConstString name,
-   const CompilerDeclContext *parent_decl_ctx,
+   const CompilerDeclContext &parent_decl_ctx,
lldb::FunctionNameType name_type_mask,
   

[Lldb-commits] [lldb] cfb29e4 - [lldb] Fix some tests failing with gmodules after change to stdlib.h

2020-02-17 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-17T09:39:09+01:00
New Revision: cfb29e4a54b051c888cbff8ed100c7dff5e33d58

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

LOG: [lldb] Fix some tests failing with gmodules after change to stdlib.h

Commit 82b47b2978405f802a33b00d046e6f18ef6a47be changes the way the stdlib.h
header is structured which seems to cause strange lookup failures in the modules
build. This updates a few failing tests so that they pass with the new
behavior of stdlib.h.

See the discussion in 
https://reviews.llvm.org/rG82b47b2978405f802a33b00d046e6f18ef6a47be

Added: 


Modified: 
lldb/test/API/commands/expression/import-std-module/conflicts/main.cpp
lldb/test/API/commands/expression/static-initializers/main.cpp
lldb/test/API/lang/cpp/operators/main.cpp

Removed: 




diff  --git 
a/lldb/test/API/commands/expression/import-std-module/conflicts/main.cpp 
b/lldb/test/API/commands/expression/import-std-module/conflicts/main.cpp
index e49b862a36c6..ea48c73bc9d5 100644
--- a/lldb/test/API/commands/expression/import-std-module/conflicts/main.cpp
+++ b/lldb/test/API/commands/expression/import-std-module/conflicts/main.cpp
@@ -1,5 +1,6 @@
 #include 
 #include 
+#include 
 
 int main(int argc, char **argv) {
   std::size_t f = argc;

diff  --git a/lldb/test/API/commands/expression/static-initializers/main.cpp 
b/lldb/test/API/commands/expression/static-initializers/main.cpp
index 0bcf1eb3edaf..4b0a082d296e 100644
--- a/lldb/test/API/commands/expression/static-initializers/main.cpp
+++ b/lldb/test/API/commands/expression/static-initializers/main.cpp
@@ -4,7 +4,7 @@ int counter = 0;
 
 void inc_counter() { ++counter; }
 
-void do_abort() { abort(); }
+void do_abort() { std::abort(); }
 
 int main() {
   return 0; // break here

diff  --git a/lldb/test/API/lang/cpp/operators/main.cpp 
b/lldb/test/API/lang/cpp/operators/main.cpp
index 892d0bae42af..ed1161952bf2 100644
--- a/lldb/test/API/lang/cpp/operators/main.cpp
+++ b/lldb/test/API/lang/cpp/operators/main.cpp
@@ -4,8 +4,8 @@ int side_effect = 0;
 
 struct B { int dummy = 2324; };
 struct C {
-  void *operator new(size_t size) { C* r = ::new C; r->custom_new = true; 
return r; }
-  void *operator new[](size_t size) { C* r = 
static_cast(std::malloc(size)); r->custom_new = true; return r; }
+  void *operator new(std::size_t size) { C* r = ::new C; r->custom_new = true; 
return r; }
+  void *operator new[](std::size_t size) { C* r = 
static_cast(std::malloc(size)); r->custom_new = true; return r; }
   void operator delete(void *p) { std::free(p); side_effect = 1; }
   void operator delete[](void *p) { std::free(p); side_effect = 2; }
 



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


[Lldb-commits] [PATCH] D74660: WIP: [lldb/FileSystem] Add & use CreateReadonlyDataBuffer where possible

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a reviewer: labath.
labath added a comment.

Before you get too carried away with this, I'd like us to clarify something. 
Your comment seems to imply that `FileSystem::CreateDataBuffer` does not use 
mmap. That doesn't sound right, and it's not what I see happening on linux now 
(and I don't see why macos would be different):

  $ strace -e trace=file,desc bin/lldb bin/lldb -o "image dump sections" -b
  ...
  openat(AT_FDCWD, "bin/lldb", O_RDONLY|O_CLOEXEC) = 4
  fstat(4, {st_mode=S_IFREG|0770, st_size=414096, ...}) = 0
  mmap(NULL, 414096, PROT_READ|PROT_WRITE, MAP_PRIVATE, 4, 0) = 0x7f94160d7000

What this does is create a mapping, where unmodified pages are backed by the 
file on disk, and memory is allocated for any modified pages in the usual 
copy-on-write fashion. So, if you don't modify any pages -- you get no 
allocations.

It is true that `FileSystem::CreateDataBuffer` can sometimes use a heap 
allocation (malloc) to fulfill the request, but this has nothing to do with the 
writability of that buffer. What happens is that if we detect that the file we 
are about to read comes from a "remote" system (NFS, etc.), then we will fall 
back to malloc+read, because mmaps of volatile files are somewhat precarious.

For this reason, I am somewhat doubtful that this patch will solve the memory 
problems with memory usage, except maybe by playing some accounting tricks, 
where a read-only mapping would get reported in a different bucket than a 
read-write COW one. So, I gotta ask: How sure are you that this patch will 
solve the problems reported by your users? Is it possible that these two users 
have some kinds of remote mounts or something similar that could be throwing us 
off track?

Regardless of the answers to the questions above, I think that this patch, in 
principle, is a good idea, but I think we should encode the mutability of the 
DataBuffer in the type system. If we can ensure that `CreateReadonlyDataBuffer` 
returns a `const DataBuffer`, then we can have the compiler check for us that 
noone writes to these buffers, instead of us trying to guess.

As for ObjectFileELF, relocating the data inside `RelocateDebugSections` would 
basically reimplement what the COW mmap gives us for free. So, I think a 
simpler solution is to just make sure ObjectFileELF always creates a read-write 
mapping for the object file.


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

https://reviews.llvm.org/D74660



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


[Lldb-commits] [PATCH] D74657: [lldb/Target] Add process crash-info command

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

All of this code you're adding to Process.cpp is extremely specific to one 
platform's notion of "crash info". This should be factored out so that 
macos-specific details live inside some macos class. (In the current setup, 
it's probably easiest to put it in PlatformDarwin, or some subclass thereof).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [lldb] 516ba15 - [lldb] [nfc] Simplify user_id_t -> size_t

2020-02-17 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-17T10:24:19+01:00
New Revision: 516ba158b6890bbcca71527ae0719de151b9de5f

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

LOG: [lldb] [nfc] Simplify user_id_t -> size_t

As discussed in https://reviews.llvm.org/D73206#1871895> simplifying
usage of `user_id_t`.

There is even written:
  // The compile unit ID is the index of the DWARF unit.
  DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID());

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

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 4cb27e971775..8ca1a8fc311c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -109,7 +109,7 @@ size_t DWARFDebugInfo::GetNumUnits() {
   return m_units.size();
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(user_id_t idx) {
+DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(size_t idx) {
   DWARFUnit *cu = nullptr;
   if (idx < GetNumUnits())
 cu = m_units[idx].get();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index 056cf33a202f..db6a0f80ff45 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -35,7 +35,7 @@ class DWARFDebugInfo {
   lldb_private::DWARFContext &context);
 
   size_t GetNumUnits();
-  DWARFUnit *GetUnitAtIndex(lldb::user_id_t idx);
+  DWARFUnit *GetUnitAtIndex(size_t idx);
   DWARFUnit *GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset,
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,



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


[Lldb-commits] [PATCH] D74670: Simplify user_id_t -> size_t

2020-02-17 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG516ba158b689: [lldb] [nfc] Simplify user_id_t -> size_t 
(authored by jankratochvil).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74670

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -35,7 +35,7 @@
   lldb_private::DWARFContext &context);
 
   size_t GetNumUnits();
-  DWARFUnit *GetUnitAtIndex(lldb::user_id_t idx);
+  DWARFUnit *GetUnitAtIndex(size_t idx);
   DWARFUnit *GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset,
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -109,7 +109,7 @@
   return m_units.size();
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(user_id_t idx) {
+DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(size_t idx) {
   DWARFUnit *cu = nullptr;
   if (idx < GetNumUnits())
 cu = m_units[idx].get();


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -35,7 +35,7 @@
   lldb_private::DWARFContext &context);
 
   size_t GetNumUnits();
-  DWARFUnit *GetUnitAtIndex(lldb::user_id_t idx);
+  DWARFUnit *GetUnitAtIndex(size_t idx);
   DWARFUnit *GetUnitAtOffset(DIERef::Section section, dw_offset_t cu_offset,
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -109,7 +109,7 @@
   return m_units.size();
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(user_id_t idx) {
+DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(size_t idx) {
   DWARFUnit *cu = nullptr;
   if (idx < GetNumUnits())
 cu = m_units[idx].get();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74637: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: JDevlieghere.
labath added a comment.

+ @JDevlieghere for a reason why it would be nice to have cross platform "debug 
map" test(s).

> I have also noticed DIERef and user_id_t in fact contain the same information 
> which can be seen in SymbolFileDWARF::GetUID.

I am afraid the situation is not that simple. Your statement is true for all 
"elf" forms of dwarf (regular, dwo, dwp, type units, etc.), and also for mac 
dSYM files, but it is not true in case of mac "debug map" scenario. In this 
case, a user_id_t also encodes the symbol file / module ID. You can best see 
this in the function doing the opposite transformation 
(`SymbolFileDWARF::DecodeUID`), which returns a SymbolFileDWARF in addition to 
a DIERef.

The macos debug map works by creating multiple modules for each .o file, and 
them mangling them so that they appear to come from a single module. From five 
miles up, this is pretty similar to what "split dwarf" does, but it has one 
important distinction -- in split dwarf, the dwo files can only be interpreted 
together with the main executable file, which contains the linked portions of 
the debug info (addresses, mainly), while in case of a debug map, the .o files 
contain fully standalone dwarf, and the "relinking" that we do is outside of 
the scope of the dwarf spec and works by the linker leaving breadcrumbs about 
what it has done in a custom format.

For this reason the debug map, and the split dwarf features were implemented on 
different levels inside SymbolFileDWARF, and one of them is included in DIERef, 
while the other isn't. The main confusing part about this is that split dwarf 
creates multiple SymbolFile objects (SymbolFileDWARFDwo, SymbolFileDWARFDwp, 
SymbolFileDWARFDwoDwp :/), even though all of these things are really a part of 
a single SymbolFile object that happens to be spread across multiple files  -- 
this is something I am working on fixing (first by removing the Dwp flavours), 
and why want to use your MainCU concept for split dwarf too (hopefully that 
would rid us of SymbolFileDWARFDwo).

The reason I am saying all of this is to illustrate why I think you can't make 
user_id_t and DIERef the same thing -- the former needs to be globally unique, 
whereas the latter is local to a single "symbol file dwarf" (with big quotes).

However, I am not sure what all of this says about this patch. In principle, I 
don't see a big problem with changing the type of this field. In fact, this 
field used to hold a DIERef until I changed that in D63322 
. However, there wasn't a strong reason for 
that -- I did it because it was a) convenient; b) more memory-efficient. We can 
change it back if it helps you in achieving your goal (and btw, thank you for 
doing this in small steps). It's just that currently it's not at all clear to 
me what that goal is. Maybe you could give a rough outline of where are you 
going with this. For example, how will the user_id_t decoding process look like 
in the end?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74637



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


[Lldb-commits] [PATCH] D74690: Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The thing I said on the other patch about DIERef vs user_id_t still applies. 
Let's continue the discussion there...




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DIERef.h:37
 
+  DIERef() {}
+

I'd very much like to avoid a default-constructed DIERef -- in the previous 
refactoring, I've deleted that concept and tried to use Optional in 
contexts, where the object can be empty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74690



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


[Lldb-commits] [PATCH] D74637: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D74637#1878655 , @labath wrote:

> In fact, this field used to hold a DIERef until I changed that in D63322 
> .


I did not expect that. OK, this D74637  + my 
D74690  try to just revert D63322 
.

> I did it because it was
>  b) more memory-efficient.

Why? Both `DIERef` and `user_id_t` sizeof is 8.

> Maybe you could give a rough outline of where are you going with this.

I am trying to reduce `user_id_t` usage as much as possible.  And then to add 
MainCU to `user_id_t` (but no longer to `DIERef`). As construction of 
`user_id_t` with MainCU needs additional information no longer contained in 
`DIERef` it will need some additional parameter in the caller chain like I did 
in D73206 . As the new parameter is used only 
for DWZ its addition is not much popular so it should be limited to as few 
cases as possible.

> For example, how will the user_id_t decoding process look like in the end?

In my dwz branch  the 
MainCU encoding is now combined for both `DIERef` and `user_id_t` but the plan 
is to encode it only into `user_id_t`. It still fits into 64-bits reusing the 
DWO field (which is never used together with DWZ). Current implementation:

- `DIERef`->`user_id_t` 

- `user_id_`->`DecodedUID` 

- `DWARFDIE`->`DIERef` 

- `DIERef`->`DWARFUnit *` 

 wrt DWZ common file
- `DIERef`->`DWARFUnit *` 

 for MainCU


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74637



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


[Lldb-commits] [PATCH] D74637: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D74637#1878704 , @jankratochvil 
wrote:

> > I did it because it was
> >  b) more memory-efficient.
>
> Why? Both `DIERef` and `user_id_t` sizeof is 8.


Ah, sorry, I misremembered that (and confused DIERef with DWARFDIE). I think 
what happened is that at the time I was writing that patch, I was planning to 
increase the size of DIERef. But in the end, that did not materialize (we chose 
to drop the somewhat redundant cu_offset field instead).

> 
> 
>> Maybe you could give a rough outline of where are you going with this.
> 
> I am trying to reduce `user_id_t` usage as much as possible.  And then to add 
> MainCU to `user_id_t` (but no longer to `DIERef`). As construction of 
> `user_id_t` with MainCU needs additional information no longer contained in 
> `DIERef` it will need some additional parameter in the caller chain like I 
> did in D73206 .

Ok, this part makes sense. It's hard for me to evaluate the rest, as the code 
your linking to still assumes that the MainCU is stored in the DIERef, which 
you now say you want to change. Suppose these patches are accepted (let's call 
them tentatively accepted). What would be the next steps?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74637



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


[Lldb-commits] [lldb] aedc196 - [lldb/lldb-server] Add target.xml support for qXfer request.

2020-02-17 Thread Pavel Labath via lldb-commits

Author: Levon Ter-Grigoryan
Date: 2020-02-17T12:05:28+01:00
New Revision: aedc196101e33bd58f7443c5b93398418ce55edf

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

LOG: [lldb/lldb-server] Add target.xml support for qXfer request.

Summary:
Synthesize target.xml in lldb-server to avoid a long chain of
qRegisterInfo packets, which can be slow over low-latency links.

Reviewers: jarin, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

Added: 

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp

Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Removed: 




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

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
new file mode 100644
index ..530e2ce80023
--- /dev/null
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
@@ -0,0 +1,69 @@
+
+
+import gdbremote_testcase
+import textwrap
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import re
+import xml.etree.ElementTree as ET
+
+class TestGdbRemoteTargetXmlPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@expectedFailureNetBSD
+@llgs_test
+def test_g_target_xml_returns_correct_data(self):
+self.init_llgs_test()
+self.build()
+self.set_inferior_startup_launch()
+
+procs = self.prep_debug_monitor_and_inferior()
+
+OFFSET = 0
+LENGTH = 0x10
+self.test_sequence.add_log_lines([
+"read packet: $qXfer:features:read:target.xml:{:x},{:x}#00".format(
+OFFSET,
+LENGTH),
+{   
+"direction": "send", 
+"regex": re.compile("^\$l(.+)#[0-9a-fA-F]{2}$"), 
+"capture": {1: "target_xml"}
+}],
+True)
+context = self.expect_gdbremote_sequence()
+
+target_xml = context.get("target_xml")
+
+root = ET.fromstring(target_xml)
+self.assertIsNotNone(root)
+self.assertEqual(root.tag, "target")
+
+architecture = root.find("architecture")
+self.assertIsNotNone(architecture)
+self.assertEqual(architecture.text, self.getArchitecture())
+
+feature = root.find("feature")
+self.assertIsNotNone(feature)
+
+target_xml_registers = feature.findall("reg")
+self.assertTrue(len(target_xml_registers) > 0)
+
+# registers info collected by qRegisterInfo
+self.add_register_info_collection_packets()
+context = self.expect_gdbremote_sequence()
+self.assertIsNotNone(context)
+q_info_registers = self.parse_register_info_packets(context)
+
+self.assertTrue(len(target_xml_registers) == len(q_info_registers))
+for register in zip(target_xml_registers, q_info_registers):
+xml_info_reg = register[0]
+q_info_reg = register[1]
+self.assertEqual(q_info_reg["name"], xml_info_reg.get("name"))
+self.assertEqual(q_info_reg["set"], xml_info_reg.get("group"))
+self.assertEqual(q_info_reg["format"], xml_info_reg.get("format"))
+self.assertEqual(q_info_reg["bitsize"], 
xml_info_reg.get("bitsize"))
+self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
+self.assertEqual(q_info_reg["encoding"], 
xml_info_reg.get("encoding"))
\ No newline at end of file

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
 
b/lldb/packages/Python/lldbsuite/

[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaedc196101e3: [lldb/lldb-server] Add target.xml support for 
qXfer request. (authored by PatriosTheGreat, committed by labath).

Changed prior to commit:
  https://reviews.llvm.org/D74217?vs=244152&id=244934#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -199,6 +199,8 @@
   static std::string XMLEncodeAttributeValue(llvm::StringRef value);
 
 private:
+  llvm::Expected> BuildTargetXml();
+
   void HandleInferiorState_Exited(NativeProcessProtocol *process);
 
   void HandleInferiorState_Stopped(NativeProcessProtocol *process);
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -377,6 +377,95 @@
   }
 }
 
+static llvm::StringRef GetEncodingNameOrEmpty(const RegisterInfo ®_info) {
+  switch (reg_info.encoding) {
+  case eEncodingUint:
+return "uint";
+  case eEncodingSint:
+return "sint";
+  case eEncodingIEEE754:
+return "ieee754";
+  case eEncodingVector:
+return "vector";
+  default:
+return "";
+  }
+}
+
+static llvm::StringRef GetFormatNameOrEmpty(const RegisterInfo ®_info) {
+  switch (reg_info.format) {
+  case eFormatBinary:
+return "binary";
+  case eFormatDecimal:
+return "decimal";
+  case eFormatHex:
+return "hex";
+  case eFormatFloat:
+return "float";
+  case eFormatVectorOfSInt8:
+return "vector-sint8";
+  case eFormatVectorOfUInt8:
+return "vector-uint8";
+  case eFormatVectorOfSInt16:
+return "vector-sint16";
+  case eFormatVectorOfUInt16:
+return "vector-uint16";
+  case eFormatVectorOfSInt32:
+return "vector-sint32";
+  case eFormatVectorOfUInt32:
+return "vector-uint32";
+  case eFormatVectorOfFloat32:
+return "vector-float32";
+  case eFormatVectorOfUInt64:
+return "vector-uint64";
+  case eFormatVectorOfUInt128:
+return "vector-uint128";
+  default:
+return "";
+  };
+}
+
+static llvm::StringRef GetKindGenericOrEmpty(const RegisterInfo ®_info) {
+  switch (reg_info.kinds[RegisterKind::eRegisterKindGeneric]) {
+  case LLDB_REGNUM_GENERIC_PC:
+return "pc";
+  case LLDB_REGNUM_GENERIC_SP:
+return "sp";
+  case LLDB_REGNUM_GENERIC_FP:
+return "fp";
+  case LLDB_REGNUM_GENERIC_RA:
+return "ra";
+  case LLDB_REGNUM_GENERIC_FLAGS:
+return "flags";
+  case LLDB_REGNUM_GENERIC_ARG1:
+return "arg1";
+  case LLDB_REGNUM_GENERIC_ARG2:
+return "arg2";
+  case LLDB_REGNUM_GENERIC_ARG3:
+return "arg3";
+  case LLDB_REGNUM_GENERIC_ARG4:
+return "arg4";
+  case LLDB_REGNUM_GENERIC_ARG5:
+return "arg5";
+  case LLDB_REGNUM_GENERIC_ARG6:
+return "arg6";
+  case LLDB_REGNUM_GENERIC_ARG7:
+return "arg7";
+  case LLDB_REGNUM_GENERIC_ARG8:
+return "arg8";
+  default:
+return "";
+  }
+}
+
+static void CollectRegNums(const uint32_t *reg_num, StreamString &response) {
+  for (int i = 0; *reg_num != LLDB_INVALID_REGNUM; ++reg_num, ++i) {
+if (i > 0)
+  response.PutChar(',');
+response.Printf("%" PRIx32, *reg_num);
+  }
+}
+
 static void WriteRegisterValueInHexFixedWidth(
 StreamString &response, NativeRegisterContext ®_ctx,
 const RegisterInfo ®_info, const RegisterValue *reg_value_p,
@@ -1699,74 +1788,18 @@
   response.Printf("bitsize:%" PRIu32 ";offset:%" PRIu32 ";",
   reg_info->byte_size * 8, reg_info->byte_offset);
 
-  switch (reg_info->encoding) {
-  case eEncodingUint:
-response.PutCString("encoding:uint;");
-break;
-  case eEncodingSint:
-response.PutCString("encoding:sint;");
-break;
-  case eEncodingIEEE754:
-response.PutCString("encoding:ieee754;");
-break;
-  case eEncodingVector:
-response.PutCString("encoding:vector;");
-break;
-  default:
-break;
-  }
+  llvm::StringRef encoding = GetEncodingNameOrEmpty(*reg_info

[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Committed as aedc196101e33bd58f7443c5b93398418ce55edf 
. I've 
updated the commit message to include a better description of what is being 
changed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [lldb] c112190 - [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

2020-02-17 Thread Pavel Labath via lldb-commits

Author: Paolo Severini
Date: 2020-02-17T12:42:23+01:00
New Revision: c1121908aace019b3e31e24def58a21a978531cd

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

LOG: [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging

Add a dynamic loader plug-in class for WebAssembly modules.

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

Added: 
lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h
lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
lldb/test/API/functionalities/gdb_remote_client/test_sym.yaml

lldb/test/API/functionalities/gdb_remote_client/test_wasm_embedded_debug_sections.yaml

lldb/test/API/functionalities/gdb_remote_client/test_wasm_external_debug_sections.yaml

Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/DynamicLoader/CMakeLists.txt
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
lldb/test/Shell/ObjectFile/wasm/basic.yaml
lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 7e2d80fceec8..9f68fc7e88c5 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -105,6 +105,7 @@ LLDB_PLUGIN_DECLARE(ProcessGDBRemote)
 LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderPOSIXDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderStatic)
+LLDB_PLUGIN_DECLARE(DynamicLoaderWasmDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD)
 
 using namespace lldb_private;
@@ -240,6 +241,7 @@ llvm::Error SystemInitializerFull::Initialize() {
   LLDB_PLUGIN_INITIALIZE(ProcessGDBRemote);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderPOSIXDYLD);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD); // Before DynamicLoaderStatic.
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderStatic);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderWindowsDYLD);
 
@@ -327,6 +329,7 @@ void SystemInitializerFull::Terminate() {
 
   LLDB_PLUGIN_TERMINATE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderPOSIXDYLD);
+  LLDB_PLUGIN_TERMINATE(DynamicLoaderWasmDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderStatic);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWindowsDYLD);
 

diff  --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
index 9f3b2ab0e50f..f357fea02efb 100644
--- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
@@ -4,3 +4,4 @@ add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)
 add_subdirectory(Hexagon-DYLD)
 add_subdirectory(Windows-DYLD)
+add_subdirectory(wasm-DYLD)

diff  --git a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
new file mode 100644
index ..a4a4ac7b44e7
--- /dev/null
+++ b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_lldb_library(lldbPluginDynamicLoaderWasmDYLD PLUGIN
+  DynamicLoaderWasmDYLD.cpp
+
+  LINK_LIBS
+lldbCore
+lldbTarget
+  LINK_COMPONENTS
+Support
+  )

diff  --git 
a/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp 
b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
new file mode 100644
index ..ae7e011eaa52
--- /dev/null
+++ b/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
@@ -0,0 +1,70 @@
+//===-- DynamicLoaderWasmDYLD.cpp 
-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "DynamicLoaderWasmDYLD.h"
+
+#include "Plugins/ObjectFile/wasm/ObjectFileWasm.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::wasm;
+
+LLDB_PLUGIN_DEFINE(DynamicLoaderWasmDYLD)
+
+DynamicLoaderWasmDYLD::DynamicLoaderWasmDYLD(Process *process)
+: Dynamic

[Lldb-commits] [PATCH] D74637: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D74637#1878720 , @labath wrote:

> the MainCU is stored in the DIERef, which you now say you want to change.


Just some wording: If MainCU was in `DIERef` then MainCU needs to be also in 
`DWARFDIE` which means `DWARFDIE` must grow 16->24 bytes which you do not want. 
So transitively yes, I cannot store MainCU into `DIERef`.

> Suppose these patches are accepted (let's call them tentatively accepted). 
> What would be the next steps?

I find this patch as a NFC cleanup to the codebase - to satisfy a new premise 
`user_id_t` is used as little as possible and thus only for external interfaces 
which must not deal with MainCU in any way.
Its larger goal is to satisfy this item of the big DWZ plan you made 
:

> I think it would be good to have only one kind of "user id". What are the 
> cases where you need a main-cu-less user id?

Sure thanks for all the reviews.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74637



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


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

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc1121908aace: [LLDB] Add DynamicLoaderWasmDYLD plugin for 
WebAssembly debugging (authored by paolosev, committed by labath).

Changed prior to commit:
  https://reviews.llvm.org/D72751?vs=244300&id=244937#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751

Files:
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/Plugins/DynamicLoader/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/CMakeLists.txt
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
  lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.h
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
  lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.h
  lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
  lldb/test/API/functionalities/gdb_remote_client/test_sym.yaml
  
lldb/test/API/functionalities/gdb_remote_client/test_wasm_embedded_debug_sections.yaml
  
lldb/test/API/functionalities/gdb_remote_client/test_wasm_external_debug_sections.yaml
  lldb/test/Shell/ObjectFile/wasm/basic.yaml
  lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
  lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
  lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
  lldb/tools/lldb-test/SystemInitializerTest.cpp

Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -91,6 +91,7 @@
 LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderPOSIXDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderStatic)
+LLDB_PLUGIN_DECLARE(DynamicLoaderWasmDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD)
 
 using namespace lldb_private;
@@ -215,6 +216,7 @@
   LLDB_PLUGIN_INITIALIZE(ProcessGDBRemote);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderPOSIXDYLD);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD); // Before DynamicLoaderStatic.
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderStatic);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderWindowsDYLD);
 
@@ -302,6 +304,7 @@
 
   LLDB_PLUGIN_TERMINATE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderPOSIXDYLD);
+  LLDB_PLUGIN_TERMINATE(DynamicLoaderWasmDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderStatic);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWindowsDYLD);
 
Index: lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
+++ lldb/test/Shell/ObjectFile/wasm/unified-debug-sections.yaml
@@ -13,11 +13,11 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
+# CHECK: Executable: false
 # CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Type: shared library
 # CHECK: Strata: user
-# CHECK: Base VM address: 0xa
+# CHECK: Base VM address: 0x0
 
 # CHECK: Name: code
 # CHECK: Type: code
Index: lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
+++ lldb/test/Shell/ObjectFile/wasm/stripped-debug-sections.yaml
@@ -4,9 +4,9 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
-# CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Executable: false
+# CHECK: Stripped: false
+# CHECK: Type: shared library
 # CHECK: Strata: user
 # CHECK: Base VM address: 0x0
 
Index: lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
+++ lldb/test/Shell/ObjectFile/wasm/embedded-debug-sections.yaml
@@ -4,11 +4,11 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
-# CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Executable: false
+# CHECK: Stripped: false
+# CHECK: Type: shared library
 # CHECK: Strata: user
-# CHECK: Base VM address: 0xa
+# CHECK: Base VM address: 0x0
 
 # CHECK: Name: code
 # CHECK: Type: code
Index: lldb/test/Shell/ObjectFile/wasm/basic.yaml
===
--- lldb/test/Shell/ObjectFile/wasm/basic.yaml
+++ lldb/test/Shell/ObjectFile/wasm/basic.yaml
@@ -4,11 +4,11 @@
 # CHECK: Plugin name: wasm
 # CHECK: Architecture: wasm32-unknown-unknown-wasm
 # CHECK: UUID: 
-# CHECK: Executable: true
-# CHECK: Stripped: true
-# CHECK: Type: executable
+# CHECK: Executable: false
+# CHECK: Stripped: false
+# CHECK: Type: shared library
 # CHECK: Strata

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

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D72751#1877432 , @paolosev wrote:

> In D72751#1869268 , @labath wrote:
>
> > yeah, go for it.
>
>
> Hi @labath, can I ask you the favor to land this patch for me?  I have 
> rebased it because the logic of SystemInitializers have changed with new 
> macros.


Committed as c1121908aace019b3e31e24def58a21a978531cd 
.

> I asked commit access and I should have obtained it, but when I try to land 
> this patch either with 'arc land' or with 'git push' I get a permission error:
> 
>   git push --dry-run
>   Password for 'https://paolosevm...@github.com':
>   remote: Permission to llvm/llvm-project.git denied to paolosevMSFT.
>   fatal: unable to access 
> 'https://paolosevm...@github.com/llvm/llvm-project.git/': The requested URL 
> returned error: 403
> 
> 
> Maybe there is something I have not understood in the process...

"arc land" never worked. Don't even try it -- all it can do is mess up your 
local repo. :)

The "git push" error looks like a generic problem with authenticating to 
github. I'd try creating a dummy personal repo and seeing if you can push there 
first. Switching to a different transport protocol (`g...@github.com` + 
authentication via ssh keys) is also worth a shot.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


[Lldb-commits] [PATCH] D72158: [DebugInfo] Make most debug line prologue errors non-fatal to parsing

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:323-325
+// Treat this error as unrecoverable - we cannot be sure what any of
+// the data represents including the length field, so cannot skip it or 
make
+// any reasonable assumptions.

jhenderson wrote:
> labath wrote:
> > BTW, I think this error should be recoverable too. I believe the reason why 
> > the length field comes *before* the version number is specifically so that 
> > one can skip over contributions with unsupported (future) version numbers.
> > 
> > While it's hard to say what the future versions of dwarf will look like, I 
> > would expect that the committee will try very hard to avoid  making changes 
> > in the length field. I think they'd use one of the 
> > DW_LENGTH_lo_reserved..DW_LENGTH_hi_reserved-1 constants for severely 
> > incompatible changes.
> "Unrecoverable" here means don't try to parse this table, but do allow 
> parsing the next. I think the comment might be slightly misleading in this 
> regard. FWIW, a version of 0 or 1 probably doesn't have a leading length, so 
> it is definitely unrecoverable. For versions > 5, which are now checked, we 
> don't know what the structure of the header is, so although we could take a 
> guess, we'd almost certainly get it wrong and produce invalid (possibly very 
> invalid) output. I don't have a strong opinion as to whether that should be 
> an unrecoverable error or not (currently it is).
Ah, right, I see now what you mean. I agree it makes no sense to parse the 
contents of a contribution with an unrecognized version. The part about not 
being able to trust the length field threw me off, as the length of the 
contribution is the one thing we can expect to remain unchanged between dwarf 
versions.

Sorry about the false alarm.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72158



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


[Lldb-commits] [lldb] d41d528 - [lldb] Add @skipIfXmlSupportMissing to TestWasm.py

2020-02-17 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-17T13:12:52+01:00
New Revision: d41d5286485beacc06190af17b9e23767e22e7ab

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

LOG: [lldb] Add @skipIfXmlSupportMissing to TestWasm.py

These tests rely on being able to parse qXfer:libraries:read packet
(which is in xml).

Added: 


Modified: 
lldb/test/API/functionalities/gdb_remote_client/TestWasm.py

Removed: 




diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py 
b/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
index 8929e0e44e62..859a9176c417 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
@@ -94,6 +94,7 @@ def tearDown(self):
 lldb.DBG.SetSelectedPlatform(self._initial_platform)
 super(TestWasm, self).tearDown()
 
+@skipIfXmlSupportMissing
 def test_load_module_with_embedded_symbols_from_remote(self):
 """Test connecting to a WebAssembly engine via GDB-remote and loading 
a Wasm module with embedded DWARF symbols"""
 
@@ -136,6 +137,7 @@ def 
test_load_module_with_embedded_symbols_from_remote(self):
 self.assertEquals(load_address | debug_line_section.GetFileOffset(), 
debug_line_section.GetLoadAddress(target))
 
 
+@skipIfXmlSupportMissing
 def test_load_module_with_stripped_symbols_from_remote(self):
 """Test connecting to a WebAssembly engine via GDB-remote and loading 
a Wasm module with symbols stripped into a separate Wasm file"""
 
@@ -186,6 +188,7 @@ def 
test_load_module_with_stripped_symbols_from_remote(self):
 self.assertEquals(LLDB_INVALID_ADDRESS, 
debug_line_section.GetLoadAddress(target))
 
 
+@skipIfXmlSupportMissing
 def test_load_module_from_file(self):
 """Test connecting to a WebAssembly engine via GDB-remote and loading 
a Wasm module from a file"""
 



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


[Lldb-commits] [lldb] 0e1da1e - [LLDB] Fix GCC warnings about extra semicolons. NFC.

2020-02-17 Thread Martin Storsjö via lldb-commits

Author: Martin Storsjö
Date: 2020-02-17T14:16:46+02:00
New Revision: 0e1da1ef4af24ece9db4b0467b6c1932088c951e

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

LOG: [LLDB] Fix GCC warnings about extra semicolons. NFC.

Added: 


Modified: 
lldb/source/API/SystemInitializerFull.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 9f68fc7e88c5..b629e53e9dfe 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,22 +24,22 @@
 
 #include 
 
-LLDB_PLUGIN_DECLARE(ABIAArch64);
-LLDB_PLUGIN_DECLARE(ABIARM);
-LLDB_PLUGIN_DECLARE(ABISysV_arc);
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
-LLDB_PLUGIN_DECLARE(ABIMips);
-LLDB_PLUGIN_DECLARE(ABIPowerPC);
-LLDB_PLUGIN_DECLARE(ABISysV_s390x);
-LLDB_PLUGIN_DECLARE(ABIX86);
-LLDB_PLUGIN_DECLARE(ObjectFileBreakpad);
-LLDB_PLUGIN_DECLARE(ObjectFileELF);
-LLDB_PLUGIN_DECLARE(ObjectFileMachO);
-LLDB_PLUGIN_DECLARE(ObjectFilePECOFF);
-LLDB_PLUGIN_DECLARE(ObjectFileWasm);
-LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive);
-LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO);
-LLDB_PLUGIN_DECLARE(ScriptInterpreterNone);
+LLDB_PLUGIN_DECLARE(ABIAArch64)
+LLDB_PLUGIN_DECLARE(ABIARM)
+LLDB_PLUGIN_DECLARE(ABISysV_arc)
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
+LLDB_PLUGIN_DECLARE(ABIMips)
+LLDB_PLUGIN_DECLARE(ABIPowerPC)
+LLDB_PLUGIN_DECLARE(ABISysV_s390x)
+LLDB_PLUGIN_DECLARE(ABIX86)
+LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
+LLDB_PLUGIN_DECLARE(ObjectFileELF)
+LLDB_PLUGIN_DECLARE(ObjectFileMachO)
+LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
+LLDB_PLUGIN_DECLARE(ObjectFileWasm)
+LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
+LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
+LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
 #if LLDB_ENABLE_PYTHON
 LLDB_PLUGIN_DECLARE(OperatingSystemPython)
 LLDB_PLUGIN_DECLARE(ScriptInterpreterPython)



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


[Lldb-commits] [lldb] 07355c1 - [lldb] Delete register info definitions in the x86_64 ABI classes

2020-02-17 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-17T14:01:36+01:00
New Revision: 07355c1c08be54e6fda494168724e76e7e7da8cd

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

LOG: [lldb] Delete register info definitions in the x86_64 ABI classes

Summary:
These definitions are used to "augment" information received from the remote
target with eh/debug frame and "generic" register numbers.

Besides being verbose, this information was also incomplete (new registers like
xmm16-31 were missing) and sometimes even downright wrong (ymm register
numbers).

Most of this information is available via llvm's MCRegisterInfo. This patch
creates a new class, MCBasedABI, which retrieves the eh and debug frame register
numbers this way. The tricky part here is that the llvm class uses all-caps
register names, whereas lldb register are lowercase, and sometimes called
slightly differently. Therefore this class introduces some hooks to allow a
subclass to customize the MC lookup. The subclass also needs to suply the
"generic" register numbers, as this is an lldb invention.

This patch ports the x86_64 ABI classes to use the new register info mechanism.
It also creates a new "ABIx86_64" class which can be used to house code common
to x86_64 both ABIs. Right now, this just consists of a single function, but
there are plenty of other things that could be moved here too.

Reviewers: JDevlieghere, jasonmolenda

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

Added: 
lldb/source/Plugins/ABI/X86/ABIX86_64.h
lldb/unittests/Target/ABITest.cpp

Modified: 
lldb/include/lldb/Target/ABI.h
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
lldb/source/Target/ABI.cpp
lldb/unittests/Target/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index 4718fee61777..b88cc354d9eb 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -163,6 +163,28 @@ class RegInfoBasedABI : public ABI {
   virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
 };
 
+class MCBasedABI : public ABI {
+public:
+  void AugmentRegisterInfo(RegisterInfo &info) override;
+
+  /// If the register name is of the form "[]" then change
+  /// the name to "[]". Otherwise, leave the name unchanged.
+  static void MapRegisterName(std::string ®, llvm::StringRef from_prefix,
+   llvm::StringRef to_prefix);
+protected:
+  using ABI::ABI;
+
+  /// Return eh_frame and dwarf numbers for the given register.
+  virtual std::pair GetEHAndDWARFNums(llvm::StringRef reg);
+
+  /// Return the generic number of the given register.
+  virtual uint32_t GetGenericNum(llvm::StringRef reg) = 0;
+
+  /// For the given (capitalized) lldb register name, return the name of this
+  /// register in the MCRegisterInfo struct.
+  virtual std::string GetMCName(std::string reg) { return reg; }
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_ABI_h_

diff  --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp 
b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
index 01671190e106..7729e58f8580 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
@@ -55,162 +55,8 @@ enum dwarf_regnums {
   dwarf_r14,
   dwarf_r15,
   dwarf_rip,
-  dwarf_xmm0,
-  dwarf_xmm1,
-  dwarf_xmm2,
-  dwarf_xmm3,
-  dwarf_xmm4,
-  dwarf_xmm5,
-  dwarf_xmm6,
-  dwarf_xmm7,
-  dwarf_xmm8,
-  dwarf_xmm9,
-  dwarf_xmm10,
-  dwarf_xmm11,
-  dwarf_xmm12,
-  dwarf_xmm13,
-  dwarf_xmm14,
-  dwarf_xmm15,
-  dwarf_stmm0,
-  dwarf_stmm1,
-  dwarf_stmm2,
-  dwarf_stmm3,
-  dwarf_stmm4,
-  dwarf_stmm5,
-  dwarf_stmm6,
-  dwarf_stmm7,
-  dwarf_ymm0,
-  dwarf_ymm1,
-  dwarf_ymm2,
-  dwarf_ymm3,
-  dwarf_ymm4,
-  dwarf_ymm5,
-  dwarf_ymm6,
-  dwarf_ymm7,
-  dwarf_ymm8,
-  dwarf_ymm9,
-  dwarf_ymm10,
-  dwarf_ymm11,
-  dwarf_ymm12,
-  dwarf_ymm13,
-  dwarf_ymm14,
-  dwarf_ymm15,
-  dwarf_bnd0 = 126,
-  dwarf_bnd1,
-  dwarf_bnd2,
-  dwarf_bnd3
 };
 
-static RegisterInfo g_register_infos[] = {
-// clang-format off
-// NAME  ALT  SZ OFF  ENCODING FORMAT 
EH_FRAMEDWARF GENERIC 
LLDB  NATIVE
-//   ===  == ===  ====
=== = === 
= ==
-{"rax",  nullptr,  8,  0, eEncodingUint,   eFormatHex,   
{dwarf_rax,  dwarf_rax,LLDB_INVALID_REGN

[Lldb-commits] [PATCH] D74244: [lldb] Delete register info definitions in the x86_64 ABI classes

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG07355c1c08be: [lldb] Delete register info definitions in the 
x86_64 ABI classes (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D74244?vs=244624&id=244942#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74244

Files:
  lldb/include/lldb/Target/ABI.h
  lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/X86/ABISysV_x86_64.h
  lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
  lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.h
  lldb/source/Plugins/ABI/X86/ABIX86_64.h
  lldb/source/Target/ABI.cpp
  lldb/unittests/Target/ABITest.cpp
  lldb/unittests/Target/CMakeLists.txt

Index: lldb/unittests/Target/CMakeLists.txt
===
--- lldb/unittests/Target/CMakeLists.txt
+++ lldb/unittests/Target/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(TargetTests
+  ABITest.cpp
   ExecutionContextTest.cpp
   MemoryRegionInfoTest.cpp
   ModuleCacheTest.cpp
Index: lldb/unittests/Target/ABITest.cpp
===
--- /dev/null
+++ lldb/unittests/Target/ABITest.cpp
@@ -0,0 +1,26 @@
+//===-- ABITest.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Target/ABI.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+TEST(MCBasedABI, MapRegisterName) {
+  auto map = [](std::string name) {
+MCBasedABI::MapRegisterName(name, "foo", "bar");
+return name;
+  };
+  EXPECT_EQ("bar", map("foo"));
+  EXPECT_EQ("bar0", map("foo0"));
+  EXPECT_EQ("bar47", map("foo47"));
+  EXPECT_EQ("foo47x", map("foo47x"));
+  EXPECT_EQ("fooo47", map("fooo47"));
+  EXPECT_EQ("bar47", map("bar47"));
+}
+
Index: lldb/source/Target/ABI.cpp
===
--- lldb/source/Target/ABI.cpp
+++ lldb/source/Target/ABI.cpp
@@ -228,3 +228,43 @@
   if (info.kinds[eRegisterKindGeneric] == LLDB_INVALID_REGNUM)
 info.kinds[eRegisterKindGeneric] = abi_info.kinds[eRegisterKindGeneric];
 }
+
+void MCBasedABI::AugmentRegisterInfo(RegisterInfo &info) {
+  uint32_t eh, dwarf;
+  std::tie(eh, dwarf) = GetEHAndDWARFNums(info.name);
+
+  if (info.kinds[eRegisterKindEHFrame] == LLDB_INVALID_REGNUM)
+info.kinds[eRegisterKindEHFrame] = eh;
+  if (info.kinds[eRegisterKindDWARF] == LLDB_INVALID_REGNUM)
+info.kinds[eRegisterKindDWARF] = dwarf;
+  if (info.kinds[eRegisterKindGeneric] == LLDB_INVALID_REGNUM)
+info.kinds[eRegisterKindGeneric] = GetGenericNum(info.name);
+}
+
+std::pair
+MCBasedABI::GetEHAndDWARFNums(llvm::StringRef name) {
+  std::string mc_name = GetMCName(name.str());
+  llvm::transform(mc_name, mc_name.begin(), std::toupper);
+  int eh = -1;
+  int dwarf = -1;
+  for (unsigned reg = 0; reg < m_mc_register_info_up->getNumRegs(); ++reg) {
+if (m_mc_register_info_up->getName(reg) == mc_name) {
+  eh = m_mc_register_info_up->getDwarfRegNum(reg, /*isEH=*/true);
+  dwarf = m_mc_register_info_up->getDwarfRegNum(reg, /*isEH=*/false);
+  break;
+}
+  }
+  return std::pair(eh == -1 ? LLDB_INVALID_REGNUM : eh,
+   dwarf == -1 ? LLDB_INVALID_REGNUM
+   : dwarf);
+}
+
+void MCBasedABI::MapRegisterName(std::string &name, llvm::StringRef from_prefix,
+ llvm::StringRef to_prefix) {
+  llvm::StringRef name_ref = name;
+  if (!name_ref.consume_front(from_prefix))
+return;
+  uint64_t _;
+  if (name_ref.empty() || to_integer(name_ref, _, 10))
+name = (to_prefix + name_ref).str();
+}
Index: lldb/source/Plugins/ABI/X86/ABIX86_64.h
===
--- /dev/null
+++ lldb/source/Plugins/ABI/X86/ABIX86_64.h
@@ -0,0 +1,26 @@
+//===-- ABIX86_64.h -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_PLUGIN_ABI_X86_ABIX86_64_H
+#define LLDB_PLUGIN_ABI_X86_ABIX86_64_H
+
+#include "lldb/Target/ABI.h"
+#include "lldb/lldb-private.h"
+
+class ABIX86_64 : public lldb_private::MCBasedABI {
+protected:
+  std::string GetMCName(std::string name) override {
+MapRegisterName(name, "stmm", "st");
+return name;
+  }
+
+private:
+  using lldb_private::MCBasedA

[Lldb-commits] [lldb] b2d64b6 - [lldb] Fix build error from 07355c1c08b

2020-02-17 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-17T14:12:29+01:00
New Revision: b2d64b698f8771290e42e558a1e6cc645375b90c

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

LOG: [lldb] Fix build error from 07355c1c08b

The error is: no matching function for call to 'transform(std::string&, 
std::__cxx11::basic_string::iterator, )'

The fix: replace llvm::transform with an equally simple hand-rolled
loop.

Added: 


Modified: 
lldb/source/Target/ABI.cpp

Removed: 




diff  --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp
index 402ac235e3ff..027ea057751f 100644
--- a/lldb/source/Target/ABI.cpp
+++ b/lldb/source/Target/ABI.cpp
@@ -244,7 +244,8 @@ void MCBasedABI::AugmentRegisterInfo(RegisterInfo &info) {
 std::pair
 MCBasedABI::GetEHAndDWARFNums(llvm::StringRef name) {
   std::string mc_name = GetMCName(name.str());
-  llvm::transform(mc_name, mc_name.begin(), std::toupper);
+  for (char &c : mc_name)
+c = std::toupper(c);
   int eh = -1;
   int dwarf = -1;
   for (unsigned reg = 0; reg < m_mc_register_info_up->getNumRegs(); ++reg) {



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


[Lldb-commits] [lldb] 67f63f3 - [lldb/DWARF] Re-enable basic dwp support

2020-02-17 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-17T14:10:36+01:00
New Revision: 67f63f3f7c27a8438236538fdda75e32c819cc54

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

LOG: [lldb/DWARF] Re-enable basic dwp support

Summary:
This patch removes the bitrotted SymbolFileDWARF(Dwo)Dwp classes, and
replaces them with dwp support implemented directly inside
SymbolFileDWARFDwo, in a manner mirroring the implementation in llvm.
This patch does:
- add support for the .debug_cu_index section to our DWARFContext
- adds a llvm::DWARFUnitIndex argument to the DWARFUnit constructors.
  This argument is used to look up the offsets of the debug_info and
  debug_abbrev contributions in the sections of the dwp file.
- makes sure the creation of the DebugInfo object as well as the initial
  discovery of DWARFUnits is thread-safe, as we can now call this
  concurrently when doing parallel indexing.

This patch does not:
- use the DWARFUnitIndex to search for other kinds of contributions
  (debug_loc, debug_ranges, etc.). This means that units which reference
  these sections will not work correctly. These will be handled by
  follow-up patches, but even the present level of support is sufficient
  to enable basic functionality.
- Make the llvm::DWARFContext thread-safe. Right now, it just avoids this
  problem by ensuring everything is initialized ahead of time. However,
  this is something we will run into more often as we try to use more of
  llvm, and so I plan to start looking into our options here.

Reviewers: JDevlieghere, aprantl, clayborg

Subscribers: mgorny, mgrang, lldb-commits

Tags: #lldb

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/dwp.s

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp

Removed: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h



diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index 49de7df9c74e..550404314af5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -37,8 +37,6 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
   NameToDIE.cpp
   SymbolFileDWARF.cpp
   SymbolFileDWARFDwo.cpp
-  SymbolFileDWARFDwoDwp.cpp
-  SymbolFileDWARFDwp.cpp
   SymbolFileDWARFDebugMap.cpp
   UniqueDWARFASTType.cpp
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
index b3009f7a83dc..79601e3bad0d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -28,18 +28,23 @@ static DWARFDataExtractor LoadSection(SectionList 
*section_list,
 }
 
 const DWARFDataExtractor &
-DWARFContext::LoadOrGetSection(SectionType main_section_type,
+DWARFContext::LoadOrGetSection(llvm::Optional main_section_type,
llvm::Optional dwo_section_type,
SectionData &data) {
   llvm::call_once(data.flag, [&] {
 if (dwo_section_type && isDwo())
   data.data = LoadSection(m_dwo_section_list, *dwo_section_type);
-else
-  data.data = LoadSection(m_main_section_list, main_section_type);
+else if (main_section_type)
+  data.data = LoadSection(m_main_section_list, *main_section_type);
   });
   return data.data;
 }
 
+const DWARFDataExtractor &DWARFContext::getOrLoadCuIndexData() {
+  return LoadOrGetSection(llvm::None, eSectionTypeDWARFDebugCuIndex,
+  m_data_debug_cu_index);
+}
+
 const DWARFDataExtractor &DWARFContext::getOrLoadAbbrevData() {
   return LoadOrGetSection(eSectionTypeDWARFDebugAbbrev,
   eSectionTypeDWARFDebugAbbrevDwo, 
m_data_debug_abbrev);
@@ -128,6 +133,7 @@ llvm::DWARFContext &DWARFContext::GetAsLLVM() {
 };
 
 AddSection("debug_line_str", getOrLoadLineStrData());
+Ad

[Lldb-commits] [PATCH] D73783: [lldb/DWARF] Re-enable basic dwp support

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG67f63f3f7c27: [lldb/DWARF] Re-enable basic dwp support 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D73783?vs=241712&id=244948#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73783

Files:
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwoDwp.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.h
  lldb/test/Shell/SymbolFile/DWARF/dwp.s
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp

Index: lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
===
--- lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
+++ lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
@@ -111,7 +111,7 @@
   llvm::Expected dwarf_unit = DWARFUnit::extract(
   *m_symfile_dwarf, uid,
   *static_cast(&debug_info),
-  DIERef::DebugInfo, &offset_ptr);
+  DIERef::DebugInfo, &offset_ptr, nullptr);
   if (dwarf_unit)
 m_dwarf_unit = dwarf_unit.get();
 }
Index: lldb/test/Shell/SymbolFile/DWARF/dwp.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/dwp.s
@@ -0,0 +1,149 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t --defsym MAIN=0
+# RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t.dwp --defsym DWP=0
+# RUN: %lldb %t -o "target variable A" -b | FileCheck %s
+# RUN: lldb-test symbols %t | FileCheck %s --check-prefix=SYMBOLS
+
+# CHECK: (int) A = 0
+# CHECK: (int) A = 1
+# CHECK: (int) A = 2
+# CHECK: (int) A = 3
+
+# SYMBOLS:  Compile units:
+# SYMBOLS-NEXT: CompileUnit{0x}, language = "unknown", file = '0.c'
+# SYMBOLS-NEXT:   Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x0
+# SYMBOLS-NEXT: CompileUnit{0x0001}, language = "unknown", file = '1.c'
+# SYMBOLS-NEXT:   Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x1
+# SYMBOLS-NEXT: CompileUnit{0x0002}, language = "unknown", file = '2.c'
+# SYMBOLS-NEXT:   Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x2
+# SYMBOLS-NEXT: CompileUnit{0x0003}, language = "unknown", file = '3.c'
+# SYMBOLS-NEXT:   Variable{{.*}}, name = "A", {{.*}}, location = DW_OP_GNU_addr_index 0x3
+# SYMBOLS-NEXT: CompileUnit{0x0004}, language = "unknown", file = ''
+# SYMBOLS-EMPTY:
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   0   # DW_CHILDREN_no
+.ascii  "\260B" # DW_AT_GNU_dwo_name
+.byte   8   # DW_FORM_string
+.ascii  "\261B" # DW_AT_GNU_dwo_id
+.byte   7   # DW_FORM_data8
+.ascii  "\263B" # DW_AT_GNU_addr_base
+.byte   23  # DW_FORM_sec_offset
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.ifdef MAIN
+.irpc I,01234
+.data
+A\I:
+.long \I
+
+.section.debug_info,"",@progbits
+.Lcu_begin\I:
+.long   .Ldebug_info_end\I-.Ldebug_info_start\I # Length of Unit
+.Ldebug_info_start\I:
+.short  4   # DWARF version number
+.long   .debug_abbrev   # Offset Into Abbrev. Section
+.byte   8   # Address Size (in bytes)
+.byte   1   # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
+.asciz  "A.dwo" # DW_AT_GNU_dwo_name
+.quad   \I  # DW_AT_GNU_dwo_id
+.long   .debug_addr # DW_AT_GNU_addr_base
+.Ldebug_info_end\I:
+
+.section.debug_addr,"",@progbits
+.quad   A\I
+.endr
+.endif
+
+.ifdef DWP
+# This deliberately excludes compile unit 4 to check test the case of a missing
+# split unit.
+.irpc I,0123
+.secti

[Lldb-commits] [PATCH] D74637: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 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.

In D74637#1878748 , @jankratochvil 
wrote:

> In D74637#1878720 , @labath wrote:
>
> > Suppose these patches are accepted (let's call them tentatively accepted). 
> > What would be the next steps?
>
>
> I find this patch as a NFC cleanup to the codebase - to satisfy a new premise 
> `user_id_t` is used as little as possible and thus only for external 
> interfaces which must not deal with MainCU in any way.


Ok, I think I can go with that. I wanted to get a feel for where your going  
(something mid-level plan between this patch, and the "big DWZ plan") to see 
where this is going, but I think we can accept this just on the basis that it 
is a revert of D63322 , which turned out to be 
a dud. And the changes are not that big so it's not a big deal if we need to 
modify this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74637



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


[Lldb-commits] [PATCH] D74690: Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Per discussion on the other patch, I think this is fine too, just can we get 
rid of the DIERef default constructor? I think all you'd need is to use the 
insert DenseMap function instead of operator[].


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74690



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


[Lldb-commits] [lldb] 2178088 - Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Jan Kratochvil via lldb-commits

Author: Jan Kratochvil
Date: 2020-02-17T16:35:42+01:00
New Revision: 21780888791837b575d227a9a69c1afee9e4c29d

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

LOG: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

As discussed in https://reviews.llvm.org/D73206#1871895 there is both
`DIERef` and `user_id_t` and sometimes (for DWZ) we need to encode Main
CU into them and sometimes we cannot as it is unavailable at that point
and at the same time not even needed.

I have also noticed `DIERef` and `user_id_t` in fact contain the same
information which can be seen in SymbolFileDWARF::GetUID.

SB* API/ABI is already using `user_id_t` and it needs to encode Main CU
for DWZ. Therefore what about making `DIERef` the identifier not
containing Main CU and `user_id_t` the identifier containing Main CU?

It is sort of a revert of D63322.

I find this patch as a NFC cleanup to the codebase - to satisfy a new
premise `user_id_t` is used as little as possible and thus only for
external interfaces which must not deal with MainCU in any way.

Its larger goal is to satisfy a plan to implement DWZ support.

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

Added: 


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

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index 5546bb7e8b86..7d78ea18587f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -44,6 +44,16 @@ class DIERef {
 
   dw_offset_t die_offset() const { return m_die_offset; }
 
+  bool operator<(DIERef other) const {
+if (m_dwo_num_valid != other.m_dwo_num_valid)
+  return m_dwo_num_valid < other.m_dwo_num_valid;
+if (m_dwo_num_valid && (m_dwo_num != other.m_dwo_num))
+  return m_dwo_num < other.m_dwo_num;
+if (m_section != other.m_section)
+  return m_section < other.m_section;
+return m_die_offset < other.m_die_offset;
+  }
+
 private:
   uint32_t m_dwo_num : 30;
   uint32_t m_dwo_num_valid : 1;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b7e91c0eedb0..954f1110ba1e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2381,9 +2381,9 @@ void SymbolFileDWARF::GetMangledNamesForFunction(
   dwo->GetMangledNamesForFunction(scope_qualified_name, mangled_names);
   }
 
-  for (lldb::user_id_t uid :
+  for (DIERef die_ref :
m_function_scope_qualified_name_map.lookup(scope_qualified_name)) {
-DWARFDIE die = GetDIE(uid);
+DWARFDIE die = GetDIE(die_ref);
 mangled_names.push_back(ConstString(die.GetMangledName()));
   }
 }
@@ -3031,7 +3031,7 @@ TypeSP SymbolFileDWARF::ParseType(const SymbolContext 
&sc, const DWARFDIE &die,
.AsCString(""));
   if (scope_qualified_name.size()) {
 m_function_scope_qualified_name_map[scope_qualified_name].insert(
-die.GetID());
+*die.GetDIERef());
   }
 }
   }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index c592561b4880..4d6132099801 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -500,7 +500,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFile,
   bool m_fetched_external_modules : 1;
   lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
 
-  typedef std::set DIERefSet;
+  typedef std::set DIERefSet;
   typedef llvm::StringMap NameToOffsetMap;
   NameToOffsetMap m_function_scope_qualified_name_map;
   std::unique_ptr m_ranges;



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


[Lldb-commits] [PATCH] D74637: Separate DIERef vs. user_id_t: m_function_scope_qualified_name_map

2020-02-17 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG217808887918: Separate DIERef vs. user_id_t: 
m_function_scope_qualified_name_map (authored by jankratochvil).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74637

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -500,7 +500,7 @@
   bool m_fetched_external_modules : 1;
   lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
 
-  typedef std::set DIERefSet;
+  typedef std::set DIERefSet;
   typedef llvm::StringMap NameToOffsetMap;
   NameToOffsetMap m_function_scope_qualified_name_map;
   std::unique_ptr m_ranges;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2381,9 +2381,9 @@
   dwo->GetMangledNamesForFunction(scope_qualified_name, mangled_names);
   }
 
-  for (lldb::user_id_t uid :
+  for (DIERef die_ref :
m_function_scope_qualified_name_map.lookup(scope_qualified_name)) {
-DWARFDIE die = GetDIE(uid);
+DWARFDIE die = GetDIE(die_ref);
 mangled_names.push_back(ConstString(die.GetMangledName()));
   }
 }
@@ -3031,7 +3031,7 @@
.AsCString(""));
   if (scope_qualified_name.size()) {
 m_function_scope_qualified_name_map[scope_qualified_name].insert(
-die.GetID());
+*die.GetDIERef());
   }
 }
   }
Index: lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -44,6 +44,16 @@
 
   dw_offset_t die_offset() const { return m_die_offset; }
 
+  bool operator<(DIERef other) const {
+if (m_dwo_num_valid != other.m_dwo_num_valid)
+  return m_dwo_num_valid < other.m_dwo_num_valid;
+if (m_dwo_num_valid && (m_dwo_num != other.m_dwo_num))
+  return m_dwo_num < other.m_dwo_num;
+if (m_section != other.m_section)
+  return m_section < other.m_section;
+return m_die_offset < other.m_die_offset;
+  }
+
 private:
   uint32_t m_dwo_num : 30;
   uint32_t m_dwo_num_valid : 1;


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -500,7 +500,7 @@
   bool m_fetched_external_modules : 1;
   lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
 
-  typedef std::set DIERefSet;
+  typedef std::set DIERefSet;
   typedef llvm::StringMap NameToOffsetMap;
   NameToOffsetMap m_function_scope_qualified_name_map;
   std::unique_ptr m_ranges;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2381,9 +2381,9 @@
   dwo->GetMangledNamesForFunction(scope_qualified_name, mangled_names);
   }
 
-  for (lldb::user_id_t uid :
+  for (DIERef die_ref :
m_function_scope_qualified_name_map.lookup(scope_qualified_name)) {
-DWARFDIE die = GetDIE(uid);
+DWARFDIE die = GetDIE(die_ref);
 mangled_names.push_back(ConstString(die.GetMangledName()));
   }
 }
@@ -3031,7 +3031,7 @@
.AsCString(""));
   if (scope_qualified_name.size()) {
 m_function_scope_qualified_name_map[scope_qualified_name].insert(
-die.GetID());
+*die.GetDIERef());
   }
 }
   }
Index: lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -44,6 +44,16 @@
 
   dw_offset_t die_offset() const { return m_die_offset; }
 
+  bool operator<(DIERef other) const {
+if (m_dwo_num_valid != other.m_dwo_num_valid)
+  return m_dwo_num_valid < other.m_dwo_num_valid;
+if (m_dwo_num_valid && (m_dwo_num != other.m_dwo_num))
+  return m_dwo_num < other.m_dwo_num;
+if (m_section != other.m_section)
+  return m_section < other.m_section;
+return m_die_offset < other.m_die_offset;
+  }
+
 private:
   uint32_t m_dwo_num : 30;
   uint32_t m_dwo_num_valid 

[Lldb-commits] [PATCH] D74690: Separate DIERef vs. user_id_t: GetForwardDeclClangTypeToDie()

2020-02-17 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 244976.
jankratochvil added a comment.

Sorry for that `DenseMap::insert`, I see it is the same as `std::map`, I should 
study `DenseMap` more.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74690

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


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -322,8 +322,7 @@
   typedef llvm::DenseMap
   DIEToClangType;
-  typedef llvm::DenseMap
-  ClangTypeToDIE;
+  typedef llvm::DenseMap ClangTypeToDIE;
 
   DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1721,9 +1721,9 @@
   // binaries.
   dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
   clang_type.GetOpaqueQualType();
-  dwarf->GetForwardDeclClangTypeToDie()
-  [ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] =
-  die.GetID();
+  dwarf->GetForwardDeclClangTypeToDie().insert(std::make_pair(
+  ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType(),
+  *die.GetDIERef()));
   m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
 }
   }


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -322,8 +322,7 @@
   typedef llvm::DenseMap
   DIEToClangType;
-  typedef llvm::DenseMap
-  ClangTypeToDIE;
+  typedef llvm::DenseMap ClangTypeToDIE;
 
   DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF);
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1721,9 +1721,9 @@
   // binaries.
   dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
   clang_type.GetOpaqueQualType();
-  dwarf->GetForwardDeclClangTypeToDie()
-  [ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType()] =
-  die.GetID();
+  dwarf->GetForwardDeclClangTypeToDie().insert(std::make_pair(
+  ClangUtil::RemoveFastQualifiers(clang_type).GetOpaqueQualType(),
+  *die.GetDIERef()));
   m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
 }
   }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74723: [lldb/DWARF] Support the debug_str_offsets section in dwp files

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

In dwp files a constant (from the debug_cu_index section) needs to be
added to each reference into the debug_str_offsets section.

I've tried to implement this to roughly match the llvm flow: I've
changed the DWARFormValue to stop resolving the indirect string
references directly -- instead, it calls into DWARFUnit, which resolves
this for it (similar to how it already resolves indirect range and
location list references). I've also done a small refactor of the string
offset base computation code in DWARFUnit in order to make it easier to
access the debug_cu_index base offset.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74723

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/dwp.s

Index: lldb/test/Shell/SymbolFile/DWARF/dwp.s
===
--- lldb/test/Shell/SymbolFile/DWARF/dwp.s
+++ lldb/test/Shell/SymbolFile/DWARF/dwp.s
@@ -5,10 +5,10 @@
 # RUN: %lldb %t -o "target variable A" -b | FileCheck %s
 # RUN: lldb-test symbols %t | FileCheck %s --check-prefix=SYMBOLS
 
-# CHECK: (int) A = 0
-# CHECK: (int) A = 1
-# CHECK: (int) A = 2
-# CHECK: (int) A = 3
+# CHECK: (INT0) A = 0
+# CHECK: (INT1) A = 1
+# CHECK: (INT2) A = 2
+# CHECK: (INT3) A = 3
 
 # SYMBOLS:  Compile units:
 # SYMBOLS-NEXT: CompileUnit{0x}, language = "unknown", file = '0.c'
@@ -64,6 +64,15 @@
 # This deliberately excludes compile unit 4 to check test the case of a missing
 # split unit.
 .irpc I,0123
+.section.debug_str.dwo,"e",@progbits
+.Lstr\I:
+.byte   'I', 'N', 'T', '0'+\I, 0
+
+.section.debug_str_offsets.dwo,"e",@progbits
+.Lstr_offsets\I:
+.long   .Lstr\I-.debug_str.dwo
+.Lstr_offsets_end\I:
+
 .section.debug_abbrev.dwo,"e",@progbits
 .Labbrev\I:
 .byte   \I*10+1 # Abbreviation Code
@@ -90,13 +99,22 @@
 .byte   36  # DW_TAG_base_type
 .byte   0   # DW_CHILDREN_no
 .byte   3   # DW_AT_name
-.byte   14  # DW_FORM_string
+.byte   8   # DW_FORM_string
 .byte   62  # DW_AT_encoding
 .byte   11  # DW_FORM_data1
 .byte   11  # DW_AT_byte_size
 .byte   11  # DW_FORM_data1
 .byte   0   # EOM(1)
 .byte   0   # EOM(2)
+.byte   \I*10+4 # Abbreviation Code
+.byte   22  # DW_TAG_typedef
+.byte   0   # DW_CHILDREN_no
+.byte   3   # DW_AT_name
+.uleb128 0x1f02 # DW_FORM_GNU_str_index
+.byte   73  # DW_AT_type
+.byte   19  # DW_FORM_ref4
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
 .byte   0   # EOM(3)
 .Labbrev_end\I:
 
@@ -112,10 +130,14 @@
 .byte   '0'+\I, '.', 'c', 0 # DW_AT_name
 .byte   \I*10+2 # Abbrev DW_TAG_variable
 .asciz  "A" # DW_AT_name
-.long   .Ltype\I-.Lcu_begin\I   # DW_AT_type
+.long   .Ltypedef\I-.Lcu_begin\I# DW_AT_type
 .byte   2   # DW_AT_location
 .byte   0xfb# DW_OP_GNU_addr_index
 .byte   \I
+.Ltypedef\I:
+.byte   \I*10+4 # Abbrev DW_TAG_typedef
+.byte   0   # DW_AT_name
+.long   .Ltype\I-.Lcu_begin\I   # DW_AT_type
 .Ltype\I:
 .byte   \I*10+3 # Abbrev DW_TAG_base_type
 .asciz  "int"   # DW_AT_name
@@ -128,22 +150,26 @@
 .section.debug_cu_index,"e",@progbits
 .short  2   # DWARF version number
 .short  0   # Reserved
-.long   2   # Section count
+.long   3   # Section count
 .long   4   # Unit count
 .long   8   # Slot count
 
 .quad   0, 1, 2, 3, 0, 0, 0, 0  # Hash table
 .long   1, 2, 3, 4, 0, 0, 0, 0  # Index table
 
-.long   1, 3# DW_SECT_INFO, DW_SECT_ABBREV
+.long   1   # DW_SECT_INFO
+.long   3   # DW_SECT_ABBREV
+.long   6   # DW_SECT_STR_OFFSETS
 
 .irpc I,0123
 .long .Lcu_begin\I-.debug_info.dwo
 .long .Labbrev\I-.debug_abbrev.dwo
+   

[Lldb-commits] [lldb] 8f95a82 - [lldb] Fix Windows bot.

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T09:06:59-08:00
New Revision: 8f95a82bc04091eda40f1cd1ca6c44d14c53dd4c

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

LOG: [lldb] Fix Windows bot.

Should fix error C2039: 'toupper': is not a member of 'std'.

Added: 


Modified: 
lldb/source/Target/ABI.cpp

Removed: 




diff  --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp
index 027ea057751f..47a46f401e61 100644
--- a/lldb/source/Target/ABI.cpp
+++ b/lldb/source/Target/ABI.cpp
@@ -17,6 +17,7 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/Log.h"
 #include "llvm/Support/TargetRegistry.h"
+#include 
 
 using namespace lldb;
 using namespace lldb_private;



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


[Lldb-commits] [lldb] 7d6da32 - [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T09:07:00-08:00
New Revision: 7d6da329dee1eda1761430d9097d1323f32c4c0c

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

LOG: [lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin

This patch changes the way we initialize and terminate the plugins in
the system initializer. It uses an approach similar to LLVM's
TARGETS_TO_BUILD with a def file that enumerates the plugins.

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

Added: 
lldb/source/Plugins/Plugins.def.in

Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
lldb/source/Plugins/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
lldb/source/Plugins/Language/ObjC/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt

lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/OperatingSystem/CMakeLists.txt
lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/tools/lldb-test/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp
lldb/unittests/Disassembler/CMakeLists.txt
lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 1544ecc386c7..d42e53ac6fe3 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -22,12 +22,15 @@
 #include 
 #include 
 
-#define LLDB_PLUGIN_DEFINE(PluginName) 
\
+#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)  
\
   namespace lldb_private { 
\
-  void lldb_initialize_##PluginName() { PluginName::Initialize(); }
\
-  void lldb_terminate_##PluginName() { PluginName::Terminate(); }  
\
+  void lldb_initialize_##PluginName() { ClassName::Initialize(); } 
\
+  void lldb_terminate_##PluginName() { ClassName::Terminate(); }   
\
   }
 
+#define LLDB_PLUGIN_DEFINE(PluginName) 
\
+  LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
+
 // FIXME: Generate me with CMake
 #define LLDB_PLUGIN_DECLARE(PluginName)
\
   namespace lldb_private { 
\

diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index b629e53e9dfe..f6b37c5bfebd 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,89 +24,8 @@
 
 #include 
 
-LLDB_PLUGIN_DECLARE(ABIAArch64)
-LLDB_PLUGIN_DECLARE(ABIARM)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
-LLDB_PLUGIN_DECLARE(ABIMips)
-LLDB_PLUGIN_DECLARE(ABIPowerPC)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
-LLDB_PLUGIN_DECLARE(ABIX86)
-LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
-LLDB_PLUGIN_DECLARE(ObjectFileELF)
-LLDB_PLUGIN_DECLARE(ObjectFileMachO)
-LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
-LLDB_PLUGIN_DECLARE(ObjectFileWasm)
-LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
-LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
-LLDB_PLUGIN_DECL

[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-17 Thread Haibo Huang via Phabricator via lldb-commits
hhb created this revision.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
hhb edited the summary of this revision.
hhb added a reviewer: labath.

This change allows a hard coded relative PYTHONHOME setting. So that python can 
easily be packaged together with lldb.

The change includes:

1. Extend LLDB_RELOCATABLE_PYTHON to all platforms. It defaults to ON for 
platforms other than Windows, to keep the behavior compatible.
2. Allows to customize LLDB_PYTHON_HOME. But still defaults to PYTHON_HOME.
3. LLDB_PYTHON_HOME can be a path relative to liblldb. If it is relative, we 
will resolve it before send it to Py_DecodeLocale.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74727

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -279,12 +279,35 @@
   void InitializePythonHome() {
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, &size);
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str_type {
+  const char *lldb_python_home = LLDB_PYTHON_HOME;
+  const char *absolute_python_home = nullptr;
+  llvm::SmallString<64> path;
+  if (llvm::sys::path::is_absolute(lldb_python_home)) {
+absolute_python_home = lldb_python_home;
+  } else {
+FileSpec spec = HostInfo::GetShlibDir();
+if (!spec)
+  return nullptr;
+spec.GetPath(path);
+llvm::sys::path::append(path, lldb_python_home);
+llvm::sys::path::remove_dots(path, /* remove_dot_dots = */ true);
+absolute_python_home = path.c_str();
+  }
+#if PY_MAJOR_VERSION >= 3
+  size_t size = 0;
+  return Py_DecodeLocale(absolute_python_home, &size);
+#else
+  return strdup(absolute_python_home);
+#endif
+}();
+if (g_python_home != nullptr) {
+  Py_SetPythonHome(g_python_home);
+}
 #else
 #if defined(__APPLE__) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7
 // For Darwin, the only Python version supported is the one shipped in the
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -59,7 +59,13 @@
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
 
-option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to 
locate Python." OFF)
+if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(default_relocatable_python OFF)
+else()
+  set(default_relocatable_python ON)
+endif()
+
+option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to 
locate Python." {default_relocatable_python})
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
@@ -141,9 +147,11 @@
 
 if (LLDB_ENABLE_PYTHON)
   include_directories(${PYTHON_INCLUDE_DIRS})
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND NOT 
LLDB_RELOCATABLE_PYTHON)
+  if (NOT LLDB_RELOCATABLE_PYTHON)
 get_filename_component(PYTHON_HOME "${PYTHON_EXECUTABLE}" DIRECTORY)
-file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME)
+set(LLDB_PYTHON_HOME "${PYTHON_HOME}" CACHE STRING
+  "Path to use as PYTHONHONE in lldb. If a relative path is specified, \
+  it will be resolved at runtime relative to liblldb directory.")
   endif()
 endif()
 


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -279,12 +279,35 @@
   void InitializePythonHome() {
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, &size);
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str

[Lldb-commits] [lldb] 3431dc3 - [lldb/Plugin] Fix plugin definition for ProcessWindows

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T10:24:18-08:00
New Revision: 3431dc32a4162c0c3e0e0cd3e9e550c5f3c57047

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

LOG: [lldb/Plugin] Fix plugin definition for ProcessWindows

This should fix the unresolved external symbol error.

Added: 


Modified: 
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 286a95fa5894..7b020f55e993 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -44,7 +44,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ProcessWindows)
+LLDB_PLUGIN_DEFINE_ADV(ProcessWindows, ProcessWindowsCommon)
 
 namespace {
 std::string GetProcessExecutableName(HANDLE process_handle) {



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


[Lldb-commits] [lldb] deaa691 - [lldb/Plugin] Remove PLUGIN from Process POSIX & Linux

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T11:20:51-08:00
New Revision: deaa6916d3424ff9c9dfd81379dc9f4906d915f4

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

LOG: [lldb/Plugin] Remove PLUGIN from Process POSIX & Linux

ProcessPOSIX and ProcessLinux are not real plugins and should not be
marked as such. This should fix the Linux bots.

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/CMakeLists.txt
lldb/source/Plugins/Process/POSIX/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/Process/Linux/CMakeLists.txt 
b/lldb/source/Plugins/Process/Linux/CMakeLists.txt
index b4b4c401a271..dd2a88957f48 100644
--- a/lldb/source/Plugins/Process/Linux/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Linux/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginProcessLinux PLUGIN
+add_lldb_library(lldbPluginProcessLinux
   NativeProcessLinux.cpp
   NativeRegisterContextLinux.cpp
   NativeRegisterContextLinux_arm.cpp

diff  --git a/lldb/source/Plugins/Process/POSIX/CMakeLists.txt 
b/lldb/source/Plugins/Process/POSIX/CMakeLists.txt
index fd74f816d1a5..2db4e795b96b 100644
--- a/lldb/source/Plugins/Process/POSIX/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/POSIX/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginProcessPOSIX PLUGIN
+add_lldb_library(lldbPluginProcessPOSIX
   CrashReason.cpp
   NativeProcessELF.cpp
   ProcessMessage.cpp



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


[Lldb-commits] [lldb] 058cb1b - Revert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T12:34:21-08:00
New Revision: 058cb1b47fd7fa18e75834d069ead286f6ca55a8

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

LOG: Revert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for 
plugin"

This temporarily reverts commit 7d6da329dee1eda1761430d9097d1323f32c4c0c
because it's causing test failures on the bots.

Added: 


Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
lldb/source/Plugins/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
lldb/source/Plugins/Language/ObjC/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt

lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/OperatingSystem/CMakeLists.txt
lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/tools/lldb-test/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp
lldb/unittests/Disassembler/CMakeLists.txt
lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt

Removed: 
lldb/source/Plugins/Plugins.def.in



diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index d42e53ac6fe3..1544ecc386c7 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -22,15 +22,12 @@
 #include 
 #include 
 
-#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)  
\
+#define LLDB_PLUGIN_DEFINE(PluginName) 
\
   namespace lldb_private { 
\
-  void lldb_initialize_##PluginName() { ClassName::Initialize(); } 
\
-  void lldb_terminate_##PluginName() { ClassName::Terminate(); }   
\
+  void lldb_initialize_##PluginName() { PluginName::Initialize(); }
\
+  void lldb_terminate_##PluginName() { PluginName::Terminate(); }  
\
   }
 
-#define LLDB_PLUGIN_DEFINE(PluginName) 
\
-  LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
-
 // FIXME: Generate me with CMake
 #define LLDB_PLUGIN_DECLARE(PluginName)
\
   namespace lldb_private { 
\

diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index f6b37c5bfebd..593f3ab8dcc8 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,8 +24,89 @@
 
 #include 
 
-#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
-#include "Plugins/Plugins.def"
+LLDB_PLUGIN_DECLARE(ABIAArch64)
+LLDB_PLUGIN_DECLARE(ABIARM)
+LLDB_PLUGIN_DECLARE(ABISysV_arc)
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
+LLDB_PLUGIN_DECLARE(ABIMips)
+LLDB_PLUGIN_DECLARE(ABIPowerPC)
+LLDB_PLUGIN_DECLARE(ABISysV_s390x)
+LLDB_PLUGIN_DECLARE(ABIX86)
+LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
+LLDB_PLUGIN_DECLARE(ObjectFileELF)
+LLDB_PLUGIN_DECLARE(ObjectFileMachO)
+LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
+LLDB_PLUGIN_DECLARE(ObjectFileWasm)
+LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
+LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
+LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
+#if LLDB_ENA

[Lldb-commits] [lldb] 46c4f63 - [lldb/Plugin] Update ProcessWindows plugin for revert

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T13:53:07-08:00
New Revision: 46c4f63ec491948876ca3edb5343418a6719e0b2

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

LOG: [lldb/Plugin] Update ProcessWindows plugin for revert

Added: 


Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 593f3ab8dcc8..b629e53e9dfe 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -89,7 +89,7 @@ LLDB_PLUGIN_DECLARE(CPlusPlusLanguage)
 LLDB_PLUGIN_DECLARE(ObjCLanguage)
 LLDB_PLUGIN_DECLARE(ObjCPlusPlusLanguage)
 #if defined(_WIN32)
-LLDB_PLUGIN_DECLARE(ProcessWindowsCommon)
+LLDB_PLUGIN_DECLARE(ProcessWindows)
 #endif
 #if defined(__FreeBSD__)
 LLDB_PLUGIN_DECLARE(ProcessFreeBSD)
@@ -220,7 +220,7 @@ llvm::Error SystemInitializerFull::Initialize() {
   LLDB_PLUGIN_INITIALIZE(ObjCPlusPlusLanguage);
 
 #if defined(_WIN32)
-  LLDB_PLUGIN_INITIALIZE(ProcessWindowsCommon);
+  LLDB_PLUGIN_INITIALIZE(ProcessWindows);
 #endif
 #if defined(__FreeBSD__)
   LLDB_PLUGIN_INITIALIZE(ProcessFreeBSD);

diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp 
b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 7b020f55e993..286a95fa5894 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -44,7 +44,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE_ADV(ProcessWindows, ProcessWindowsCommon)
+LLDB_PLUGIN_DEFINE(ProcessWindows)
 
 namespace {
 std::string GetProcessExecutableName(HANDLE process_handle) {



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


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

2020-02-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/API/SystemInitializerFull.cpp:244
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderPOSIXDYLD);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD); // Before DynamicLoaderStatic.
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderStatic);

What's the rationale here? Plugins shouldn't rely on the order in which they 
are initialized. This breaks when the initializers are auto generated. Can we 
remove this dependency? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


[Lldb-commits] [lldb] 9b12dc9 - Re-land "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T14:43:05-08:00
New Revision: 9b12dc98fd0821f8d1f7f6304a314b6417d6ae3d

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

LOG: Re-land "[lldb/CMake] Auto-generate the Initialize and Terminate calls for 
plugin"

This patch changes the way we initialize and terminate the plugins in
the system initializer. It uses an approach similar to LLVM's
TARGETS_TO_BUILD with a def file that enumerates the plugins.

The previously landed patch got reverted because it was lacking:

 (1) A plugin definition for the Objective-C language runtime,
 (2) The dependency between the Static and WASM dynamic loader,
 (3) Explicit initialization of ScriptInterpreterNone for lldb-test.

All issues have been addressed in this patch.

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

Added: 
lldb/source/Plugins/Plugins.def.in

Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
lldb/source/Plugins/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt

lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/OperatingSystem/CMakeLists.txt
lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/tools/lldb-test/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp
lldb/unittests/Disassembler/CMakeLists.txt
lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 1544ecc386c7..d42e53ac6fe3 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -22,12 +22,15 @@
 #include 
 #include 
 
-#define LLDB_PLUGIN_DEFINE(PluginName) 
\
+#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)  
\
   namespace lldb_private { 
\
-  void lldb_initialize_##PluginName() { PluginName::Initialize(); }
\
-  void lldb_terminate_##PluginName() { PluginName::Terminate(); }  
\
+  void lldb_initialize_##PluginName() { ClassName::Initialize(); } 
\
+  void lldb_terminate_##PluginName() { ClassName::Terminate(); }   
\
   }
 
+#define LLDB_PLUGIN_DEFINE(PluginName) 
\
+  LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
+
 // FIXME: Generate me with CMake
 #define LLDB_PLUGIN_DECLARE(PluginName)
\
   namespace lldb_private { 
\

diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index b629e53e9dfe..f6b37c5bfebd 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,89 +24,8 @@
 
 #include 
 
-LLDB_PLUGIN_DECLARE(ABIAArch64)
-LLDB_PLUGIN_DECLARE(ABIARM)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
-LLDB_PLUGIN_DECLARE(ABIMips)
-LLDB_PLUGIN_DECLARE(ABIPowerPC)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
-LL

[Lldb-commits] [PATCH] D74743: [lldb] Make header guards consistent across LLDB

2020-02-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, teemperor.
Herald added subscribers: usaxena95, jsji, jfb, arphaman, atanasyan, MaskRay, 
kbarton, aheejin, sbc100, ki.stfu, nemanjai, sdardis, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLDB.

LLDB has a few different styles of header guards and they're not very 
consistent because things get moved around and copy pasted. This unifies the 
header guards across LLDB and converts everything to match LLVM's style.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D74743

Files:
  lldb/include/lldb/API/LLDB.h
  lldb/include/lldb/API/SBAddress.h
  lldb/include/lldb/API/SBAttachInfo.h
  lldb/include/lldb/API/SBBlock.h
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointLocation.h
  lldb/include/lldb/API/SBBreakpointName.h
  lldb/include/lldb/API/SBBroadcaster.h
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/include/lldb/API/SBCommandReturnObject.h
  lldb/include/lldb/API/SBCommunication.h
  lldb/include/lldb/API/SBCompileUnit.h
  lldb/include/lldb/API/SBData.h
  lldb/include/lldb/API/SBDebugger.h
  lldb/include/lldb/API/SBDeclaration.h
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBEvent.h
  lldb/include/lldb/API/SBExecutionContext.h
  lldb/include/lldb/API/SBExpressionOptions.h
  lldb/include/lldb/API/SBFile.h
  lldb/include/lldb/API/SBFileSpec.h
  lldb/include/lldb/API/SBFileSpecList.h
  lldb/include/lldb/API/SBFrame.h
  lldb/include/lldb/API/SBFunction.h
  lldb/include/lldb/API/SBHostOS.h
  lldb/include/lldb/API/SBInstruction.h
  lldb/include/lldb/API/SBInstructionList.h
  lldb/include/lldb/API/SBLanguageRuntime.h
  lldb/include/lldb/API/SBLaunchInfo.h
  lldb/include/lldb/API/SBLineEntry.h
  lldb/include/lldb/API/SBListener.h
  lldb/include/lldb/API/SBMemoryRegionInfo.h
  lldb/include/lldb/API/SBMemoryRegionInfoList.h
  lldb/include/lldb/API/SBModule.h
  lldb/include/lldb/API/SBModuleSpec.h
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBProcess.h
  lldb/include/lldb/API/SBProcessInfo.h
  lldb/include/lldb/API/SBQueue.h
  lldb/include/lldb/API/SBQueueItem.h
  lldb/include/lldb/API/SBSection.h
  lldb/include/lldb/API/SBSourceManager.h
  lldb/include/lldb/API/SBStream.h
  lldb/include/lldb/API/SBStringList.h
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/API/SBSymbol.h
  lldb/include/lldb/API/SBSymbolContext.h
  lldb/include/lldb/API/SBSymbolContextList.h
  lldb/include/lldb/API/SBTarget.h
  lldb/include/lldb/API/SBThread.h
  lldb/include/lldb/API/SBThreadCollection.h
  lldb/include/lldb/API/SBThreadPlan.h
  lldb/include/lldb/API/SBTrace.h
  lldb/include/lldb/API/SBTraceOptions.h
  lldb/include/lldb/API/SBType.h
  lldb/include/lldb/API/SBTypeCategory.h
  lldb/include/lldb/API/SBTypeEnumMember.h
  lldb/include/lldb/API/SBTypeFilter.h
  lldb/include/lldb/API/SBTypeFormat.h
  lldb/include/lldb/API/SBTypeNameSpecifier.h
  lldb/include/lldb/API/SBTypeSummary.h
  lldb/include/lldb/API/SBTypeSynthetic.h
  lldb/include/lldb/API/SBUnixSignals.h
  lldb/include/lldb/API/SBValue.h
  lldb/include/lldb/API/SBValueList.h
  lldb/include/lldb/API/SBVariablesOptions.h
  lldb/include/lldb/API/SBWatchpoint.h
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointID.h
  lldb/include/lldb/Breakpoint/BreakpointIDList.h
  lldb/include/lldb/Breakpoint/BreakpointList.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h
  lldb/include/lldb/Breakpoint/BreakpointLocationList.h
  lldb/include/lldb/Breakpoint/BreakpointName.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/include/lldb/Breakpoint/BreakpointPrecondition.h
  lldb/include/lldb/Breakpoint/BreakpointResolver.h
  lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h
  lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
  lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h
  lldb/include/lldb/Breakpoint/BreakpointResolverName.h
  lldb/include/lldb/Breakpoint/BreakpointResolverScripted.h
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Breakpoint/BreakpointSiteList.h
  lldb/include/lldb/Breakpoint/Stoppoint.h
  lldb/include/lldb/Breakpoint/StoppointCallbackContext.h
  lldb/include/lldb/Breakpoint/StoppointLocation.h
  lldb/include/lldb/Breakpoint/Watchpoint.h
  lldb/include/lldb/Breakpoint/WatchpointList.h
  lldb/include/lldb/Breakpoint/WatchpointOptions.h
  lldb/include/lldb/Core/Address.h
  lldb/include/lldb/Core/AddressRange.h
  lldb/include/lldb/Core/AddressResolver.h
  lldb/include/lldb/Core/AddressResolverFileLine.h
  lldb/include/lldb/Core/AddressResolverName.h
  lldb/include/lldb/Core/Communication.h
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Core/EmulateInstruction.h
  lldb/include/lldb/Core/FileLineResolver.h
  lldb/include/lldb/Core/FileSpecList.h
  lldb/include/lldb/Core/For

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

2020-02-17 Thread Paolo Severini via Phabricator via lldb-commits
paolosev added a comment.

@JDevlieghere added inline comments:

> lldb/source/API/SystemInitializerFull.cpp 244
>  What's the rationale here? Plugins shouldn't rely on the order in which they 
> are initialized. This breaks when the initializers are auto generated. Can we 
> remove this dependency?

This was discussed in one of the comments above. If DynamicLoaderStatic 
preceeds DynamicLoaderWasmDYLD then it is recognized as a valid loader for a 
triple like "wasm32-unknown-unknown-wasm" because the Triple::OS is 
llvm::Triple::UnknownOS.
There is an explicit check for UnknownOS in 
DynamicLoaderStatic::CreateInstance().
Should ProcessGDBRemote::GetDynamicLoader behave differently just when the 
architecture is wasm32, as a workaround?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


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

2020-02-17 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D72751#1879806 , @paolosev wrote:

> @JDevlieghere added inline comments:
>
> > lldb/source/API/SystemInitializerFull.cpp 244
> >  What's the rationale here? Plugins shouldn't rely on the order in which 
> > they are initialized. This breaks when the initializers are auto generated. 
> > Can we remove this dependency?
>
> This was discussed in one of the comments above. If DynamicLoaderStatic 
> preceeds DynamicLoaderWasmDYLD then it is recognized as a valid loader for a 
> triple like "wasm32-unknown-unknown-wasm" because the Triple::OS is 
> llvm::Triple::UnknownOS.
>  There is an explicit check for UnknownOS in 
> DynamicLoaderStatic::CreateInstance().
>  Should `DynamicLoaderStatic::CreateInstance` behave differently just when 
> the architecture is wasm32, as a workaround?


I think it depends on whether the `DynamicLoaderStatic` should be a fallback. 
If it doesn't make sense then yes, I think we should reject that triple there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


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

2020-02-17 Thread Paolo Severini via Phabricator via lldb-commits
paolosev added a comment.

> I think it depends on whether the `DynamicLoaderStatic` should be a fallback. 
> If it doesn't make sense then yes, I think we should reject that triple there.

It should not be a fallback. Ok! I'll create a new patch with this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


[Lldb-commits] [PATCH] D74660: WIP: [lldb/FileSystem] Add & use CreateReadonlyDataBuffer where possible

2020-02-17 Thread Vedant Kumar via Phabricator via lldb-commits
vsk planned changes to this revision.
vsk added a comment.

@labath thank you for your comments. I'm not yet sure what explains the average 
size of the WritableMemoryBuffer's allocated on our users' machines (~ 187,918 
bytes, comfortably larger than the 16K threshold in `shouldUseMmap`). I'll need 
to figure this out before going any further.

I did expect `openFileAux` to always malloc() when constructing a 
WritableMemoryBuffer, forgetting that a MAP_PRIVATE mapping would also work. 
Generally, on Darwin (& probably elsewhere) we want to use MAP_PRIVATE mappings 
as much as possible, as these do not need to get written to swap space or 
stashed in the VM compressor.


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

https://reviews.llvm.org/D74660



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


[Lldb-commits] [lldb] c8001d5 - [lldb/Plugin] Fix some issues on Windows

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T17:22:18-08:00
New Revision: c8001d56df620e5c961c7d459aecf1b90e7f937c

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

LOG: [lldb/Plugin] Fix some issues on Windows

 - Don't initialize NativePDB.
 - Initialize ProcessWindows after any Process*Core plugins.
 - Don't initialize DynamicLoaderDarwinKernel on non-Darwin platforms.

Added: 


Modified: 
lldb/source/Plugins/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/CMakeLists.txt
lldb/source/Plugins/Plugins.def.in
lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Removed: 




diff  --git a/lldb/source/Plugins/CMakeLists.txt 
b/lldb/source/Plugins/CMakeLists.txt
index 2ab29209810b..7e6276ea1d87 100644
--- a/lldb/source/Plugins/CMakeLists.txt
+++ b/lldb/source/Plugins/CMakeLists.txt
@@ -27,16 +27,20 @@ get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
 
 set(LLDB_ENUM_PLUGINS "")
 
-# FIXME: This is a hack to make the DynamicLoaderWasmDYLD happy.
-set(LLDB_DYNAMIC_LOADER_STATIC "")
+# Some plugins depend on other plugins being loaded before. This hacks around
+# that issue by loading them last. Note that there's no order guarantee within
+# this category.
+set(LLDB_ENUM_PLUGINS_LOADED_LAST "")
 
 foreach(p ${LLDB_ALL_PLUGINS})
   # Strip lldbPlugin form the plugin name.
   string(SUBSTRING ${p} 10 -1 pStripped)
   if(${pStripped} MATCHES "^ScriptInterpreter*")
 set(LLDB_ENUM_PLUGINS 
"${LLDB_ENUM_PLUGINS}LLDB_SCRIPT_PLUGIN(${pStripped})\n")
+  elseif(${pStripped} MATCHES "^ProcessWindows*")
+set(LLDB_ENUM_PLUGINS_LOADED_LAST 
"${LLDB_ENUM_PLUGINS_LOADED_LAST}LLDB_PLUGIN(${pStripped})\n")
   elseif(${pStripped} STREQUAL "DynamicLoaderStatic")
-set(LLDB_DYNAMIC_LOADER_STATIC 
"${LLDB_DYNAMIC_LOADER_STATIC}LLDB_PLUGIN(${pStripped})\n")
+set(LLDB_ENUM_PLUGINS_LOADED_LAST 
"${LLDB_ENUM_PLUGINS_LOADED_LAST}LLDB_PLUGIN(${pStripped})\n")
   else()
 set(LLDB_ENUM_PLUGINS "${LLDB_ENUM_PLUGINS}LLDB_PLUGIN(${pStripped})\n")
   endif()

diff  --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
index f357fea02efb..bb0776dc497a 100644
--- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
@@ -1,4 +1,6 @@
-add_subdirectory(Darwin-Kernel)
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_subdirectory(Darwin-Kernel)
+endif()
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)

diff  --git a/lldb/source/Plugins/Plugins.def.in 
b/lldb/source/Plugins/Plugins.def.in
index 98977fc62d2a..63a68a17e6ec 100644
--- a/lldb/source/Plugins/Plugins.def.in
+++ b/lldb/source/Plugins/Plugins.def.in
@@ -30,7 +30,7 @@
 #endif
 
 @LLDB_ENUM_PLUGINS@
-@LLDB_DYNAMIC_LOADER_STATIC@
+@LLDB_ENUM_PLUGINS_LOADED_LAST@
 
 #undef LLDB_PLUGIN
 #undef LLDB_SCRIPT_PLUGIN

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt 
b/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
index 4f19231c346c..7dab9370e512 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
+add_lldb_library(lldbPluginSymbolFileNativePDB
   CodeViewRegisterMapping.cpp
   CompileUnitIndex.cpp
   DWARFLocationExpression.cpp

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index e6819096f994..73dec53eda6a 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -66,8 +66,6 @@ using namespace npdb;
 using namespace llvm::codeview;
 using namespace llvm::pdb;
 
-LLDB_PLUGIN_DEFINE(SymbolFileNativePDB)
-
 char SymbolFileNativePDB::ID;
 
 static lldb::LanguageType TranslateLanguage(PDB_Lang lang) {



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


[Lldb-commits] [lldb] fcae621 - [lldb/Plugin] Unconditionally build Darwin-Kernel

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T18:14:24-08:00
New Revision: fcae62167e80d365e02f02175eb20de469d82755

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

LOG: [lldb/Plugin] Unconditionally build Darwin-Kernel

Added: 


Modified: 
lldb/source/Plugins/DynamicLoader/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt 
b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
index bb0776dc497a..f357fea02efb 100644
--- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
+++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt
@@ -1,6 +1,4 @@
-if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  add_subdirectory(Darwin-Kernel)
-endif()
+add_subdirectory(Darwin-Kernel)
 add_subdirectory(MacOSX-DYLD)
 add_subdirectory(POSIX-DYLD)
 add_subdirectory(Static)



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


[Lldb-commits] [lldb] 50c9cd9 - Revert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T19:04:50-08:00
New Revision: 50c9cd9526a7835ad5a702471a997c30d4fc6bcc

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

LOG: Revert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for 
plugin"

This is still failing spectacularly on the Windows bot and I still have
no clue what's going on.

Added: 


Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
lldb/source/Plugins/CMakeLists.txt
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt

lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/source/Plugins/OperatingSystem/CMakeLists.txt
lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/tools/lldb-test/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp
lldb/unittests/Disassembler/CMakeLists.txt
lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt

Removed: 
lldb/source/Plugins/Plugins.def.in



diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index d42e53ac6fe3..1544ecc386c7 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -22,15 +22,12 @@
 #include 
 #include 
 
-#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)  
\
+#define LLDB_PLUGIN_DEFINE(PluginName) 
\
   namespace lldb_private { 
\
-  void lldb_initialize_##PluginName() { ClassName::Initialize(); } 
\
-  void lldb_terminate_##PluginName() { ClassName::Terminate(); }   
\
+  void lldb_initialize_##PluginName() { PluginName::Initialize(); }
\
+  void lldb_terminate_##PluginName() { PluginName::Terminate(); }  
\
   }
 
-#define LLDB_PLUGIN_DEFINE(PluginName) 
\
-  LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
-
 // FIXME: Generate me with CMake
 #define LLDB_PLUGIN_DECLARE(PluginName)
\
   namespace lldb_private { 
\

diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index f6b37c5bfebd..b629e53e9dfe 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,8 +24,89 @@
 
 #include 
 
-#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
-#include "Plugins/Plugins.def"
+LLDB_PLUGIN_DECLARE(ABIAArch64)
+LLDB_PLUGIN_DECLARE(ABIARM)
+LLDB_PLUGIN_DECLARE(ABISysV_arc)
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
+LLDB_PLUGIN_DECLARE(ABIMips)
+LLDB_PLUGIN_DECLARE(ABIPowerPC)
+LLDB_PLUGIN_DECLARE(ABISysV_s390x)
+LLDB_PLUGIN_DECLARE(ABIX86)
+LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
+LLDB_PLUGIN_DECLARE(ObjectFileELF)
+LLDB_PLUGIN_DECLARE(ObjectFileMachO)
+LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
+LLDB_PLUGIN_DECLARE(ObjectFileWasm)
+LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
+LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
+LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
+#if LLDB_ENABLE_PYTHON
+LLDB_PLU

[Lldb-commits] [lldb] ac1ea0d - [lldb/Plugins] Remove PLUGIN from libraries that aren't really plugins.

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T19:40:00-08:00
New Revision: ac1ea0d3da1ef620a392d2e22a38c03bd844383b

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

LOG: [lldb/Plugins] Remove PLUGIN from libraries that aren't really plugins.

Although their name and location suggests otherwise, these libraries are
not really plugins but rather support the real plugins.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
lldb/source/Plugins/Process/Utility/CMakeLists.txt
lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt 
b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
index 909e92ace8d4..29633e42d765 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -2,7 +2,7 @@ if(NOT LLDB_BUILT_STANDALONE)
   set(tablegen_deps intrinsics_gen)
 endif()
 
-add_lldb_library(lldbPluginExpressionParserClang PLUGIN
+add_lldb_library(lldbPluginExpressionParserClang
   ASTResultSynthesizer.cpp
   ASTStructExtractor.cpp
   ASTUtils.cpp

diff  --git a/lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt 
b/lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
index 854320dd312e..980d788afc72 100644
--- a/lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
+++ b/lldb/source/Plugins/Language/ClangCommon/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginClangCommon PLUGIN
+add_lldb_library(lldbPluginClangCommon
   ClangHighlighter.cpp
 
   LINK_LIBS

diff  --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt 
b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
index 508a361aa6dd..1717b0a89666 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginCPPRuntime PLUGIN
+add_lldb_library(lldbPluginCPPRuntime
   CPPLanguageRuntime.cpp
 
   LINK_LIBS

diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt 
b/lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
index 5b3ea2ff27fa..d6de9dcc31bc 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginObjCRuntime PLUGIN
+add_lldb_library(lldbPluginObjCRuntime
   ObjCLanguageRuntime.cpp
 
   LINK_LIBS

diff  --git a/lldb/source/Plugins/Platform/POSIX/CMakeLists.txt 
b/lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
index c4c62e46add3..6f52deabc855 100644
--- a/lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
+++ b/lldb/source/Plugins/Platform/POSIX/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginPlatformPOSIX PLUGIN
+add_lldb_library(lldbPluginPlatformPOSIX
   PlatformPOSIX.cpp
 
LINK_LIBS

diff  --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt 
b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index 55746b04c39f..dfc8c11f3869 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginProcessUtility PLUGIN
+add_lldb_library(lldbPluginProcessUtility
   AuxVector.cpp
   DynamicRegisterInfo.cpp
   FreeBSDSignals.cpp

diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt 
b/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
index 4f19231c346c..7dab9370e512 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
+add_lldb_library(lldbPluginSymbolFileNativePDB
   CodeViewRegisterMapping.cpp
   CompileUnitIndex.cpp
   DWARFLocationExpression.cpp



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


[Lldb-commits] [lldb] 478c9cc - [lldb/Plugins] Rename lldbPluginDisassemblerLLVM (NFC)

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T19:14:01-08:00
New Revision: 478c9cc4f5e06072d533c6b72aaa173654bee02d

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

LOG: [lldb/Plugins] Rename lldbPluginDisassemblerLLVM (NFC)

Added: 


Modified: 
lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
lldb/unittests/Disassembler/CMakeLists.txt
lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt 
b/lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
index a25a436d498e..51959cbbc993 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
+++ b/lldb/source/Plugins/Disassembler/LLVMC/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginDisassemblerLLVM PLUGIN
+add_lldb_library(lldbPluginDisassemblerLLVMC PLUGIN
   DisassemblerLLVMC.cpp
 
   LINK_LIBS

diff  --git a/lldb/unittests/Disassembler/CMakeLists.txt 
b/lldb/unittests/Disassembler/CMakeLists.txt
index de78d12fa2fa..a0a3c264f16c 100644
--- a/lldb/unittests/Disassembler/CMakeLists.txt
+++ b/lldb/unittests/Disassembler/CMakeLists.txt
@@ -6,7 +6,7 @@ if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
   lldbCore
   lldbSymbol
   lldbTarget
-  lldbPluginDisassemblerLLVM
+  lldbPluginDisassemblerLLVMC
   lldbPluginProcessUtility
 LINK_COMPONENTS
   Support

diff  --git a/lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt 
b/lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
index 77924792fe5c..f3bbd71df32d 100644
--- a/lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
+++ b/lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
@@ -5,7 +5,7 @@ add_lldb_unittest(Arm64InstEmulationTests
 lldbSymbol
 lldbTarget
 lldbPluginUnwindAssemblyInstEmulation
-lldbPluginDisassemblerLLVM
+lldbPluginDisassemblerLLVMC
 lldbPluginInstructionARM64
 lldbPluginProcessUtility
   LINK_COMPONENTS

diff  --git a/lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt 
b/lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt
index d803f4593636..679f7664cb87 100644
--- a/lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt
+++ b/lldb/unittests/UnwindAssembly/PPC64/CMakeLists.txt
@@ -5,7 +5,7 @@ add_lldb_unittest(PPC64InstEmulationTests
 lldbSymbol
 lldbTarget
 lldbPluginUnwindAssemblyInstEmulation
-lldbPluginDisassemblerLLVM
+lldbPluginDisassemblerLLVMC
 lldbPluginInstructionPPC64
 lldbPluginProcessUtility
   LINK_COMPONENTS



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


[Lldb-commits] [lldb] bcde387 - [lldb/Plugins] Initialize all ABI plugins by their plugin name

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T19:55:43-08:00
New Revision: bcde387f46b74ee2954497b682425e4cac80f082

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

LOG: [lldb/Plugins] Initialize all ABI plugins by their plugin name

Added: 


Modified: 
lldb/include/lldb/Core/PluginManager.h
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/PluginManager.h 
b/lldb/include/lldb/Core/PluginManager.h
index 1544ecc386c7..d42e53ac6fe3 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -22,12 +22,15 @@
 #include 
 #include 
 
-#define LLDB_PLUGIN_DEFINE(PluginName) 
\
+#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)  
\
   namespace lldb_private { 
\
-  void lldb_initialize_##PluginName() { PluginName::Initialize(); }
\
-  void lldb_terminate_##PluginName() { PluginName::Terminate(); }  
\
+  void lldb_initialize_##PluginName() { ClassName::Initialize(); } 
\
+  void lldb_terminate_##PluginName() { ClassName::Terminate(); }   
\
   }
 
+#define LLDB_PLUGIN_DEFINE(PluginName) 
\
+  LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
+
 // FIXME: Generate me with CMake
 #define LLDB_PLUGIN_DECLARE(PluginName)
\
   namespace lldb_private { 
\

diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index b629e53e9dfe..1933cc57259e 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -26,11 +26,11 @@
 
 LLDB_PLUGIN_DECLARE(ABIAArch64)
 LLDB_PLUGIN_DECLARE(ABIARM)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
+LLDB_PLUGIN_DECLARE(ABIARC)
+LLDB_PLUGIN_DECLARE(ABIHexagon)
 LLDB_PLUGIN_DECLARE(ABIMips)
 LLDB_PLUGIN_DECLARE(ABIPowerPC)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
+LLDB_PLUGIN_DECLARE(ABISystemZ)
 LLDB_PLUGIN_DECLARE(ABIX86)
 LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
 LLDB_PLUGIN_DECLARE(ObjectFileELF)
@@ -116,11 +116,11 @@ SystemInitializerFull::~SystemInitializerFull() {}
 
 #define LLDB_PROCESS_AArch64(op) op(ABIAArch64);
 #define LLDB_PROCESS_ARM(op) op(ABIARM);
-#define LLDB_PROCESS_ARC(op) op(ABISysV_arc);
-#define LLDB_PROCESS_Hexagon(op) op(ABISysV_hexagon);
+#define LLDB_PROCESS_ARC(op) op(ABIARC);
+#define LLDB_PROCESS_Hexagon(op) op(ABIHexagon);
 #define LLDB_PROCESS_Mips(op) op(ABIMips);
 #define LLDB_PROCESS_PowerPC(op) op(ABIPowerPC);
-#define LLDB_PROCESS_SystemZ(op) op(ABISysV_s390x);
+#define LLDB_PROCESS_SystemZ(op) op(ABISystemZ);
 #define LLDB_PROCESS_X86(op) op(ABIX86);
 
 #define LLDB_PROCESS_AMDGPU(op)

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp 
b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index 94f7c2aff641..8ba63b9ba4a1 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -1665,7 +1665,7 @@ ABIMacOSX_arm64::CreateInstance(ProcessSP process_sp, 
const ArchSpec &arch) {
   const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();
 
   if (vendor_type == llvm::Triple::Apple) {
-if (arch_type == llvm::Triple::aarch64 || 
+if (arch_type == llvm::Triple::aarch64 ||
 arch_type == llvm::Triple::aarch64_32) {
   return ABISP(
   new ABIMacOSX_arm64(std::move(process_sp), 
MakeMCRegisterInfo(arch)));

diff  --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp 
b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
index 1690f1c511f2..10e3b0ff2f7d 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
@@ -55,7 +55,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ABISysV_arc)
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_arc, ABIARC)
 
 namespace {
 namespace dwarf {
@@ -146,7 +146,7 @@ size_t ABISysV_arc::GetRedZoneSize() const { return 0; }
 bool ABISysV_arc::IsRegisterFileReduced(RegisterContext ®_ctx) const {
   if (!m_is_reg_file_reduced) {
 const auto *const rf_build_reg = reg_ctx.GetRegisterInfoByName("rf_build");
-
+
 const auto reg_value = reg_ctx.ReadRegisterAsUnsigned(rf_build_reg,

[Lldb-commits] [lldb] ccad194 - [lldb/Plugins] Rename initializers to match their plugin name.

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T20:07:53-08:00
New Revision: ccad1948618d13a86e8a30488ba1ace8b7fd6b73

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

LOG: [lldb/Plugins] Rename initializers to match their plugin name.

Use LLDB_PLUGIN_DEFINE_ADV to make the name of the generated initializer
match the name of the plugin. This is a step towards generating the
initializers with a def file. I'm landing this change in pieces so I can
narrow down what exactly breaks the Windows bot.

Added: 


Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 1933cc57259e..9a067c1de9ad 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -38,7 +38,7 @@ LLDB_PLUGIN_DECLARE(ObjectFileMachO)
 LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
 LLDB_PLUGIN_DECLARE(ObjectFileWasm)
 LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
-LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO)
+LLDB_PLUGIN_DECLARE(ObjectContainerMachOArchive)
 LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
 #if LLDB_ENABLE_PYTHON
 LLDB_PLUGIN_DECLARE(OperatingSystemPython)
@@ -75,13 +75,13 @@ LLDB_PLUGIN_DECLARE(SymbolFilePDB)
 LLDB_PLUGIN_DECLARE(SymbolFileSymtab)
 LLDB_PLUGIN_DECLARE(SymbolVendorWasm)
 LLDB_PLUGIN_DECLARE(UnwindAssemblyInstEmulation)
-LLDB_PLUGIN_DECLARE(UnwindAssembly_x86)
-LLDB_PLUGIN_DECLARE(EmulateInstructionARM)
-LLDB_PLUGIN_DECLARE(EmulateInstructionARM64)
-LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS)
-LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS64)
-LLDB_PLUGIN_DECLARE(EmulateInstructionPPC64)
-LLDB_PLUGIN_DECLARE(ItaniumABILanguageRuntime)
+LLDB_PLUGIN_DECLARE(UnwindAssemblyX86)
+LLDB_PLUGIN_DECLARE(InstructionARM)
+LLDB_PLUGIN_DECLARE(InstructionARM64)
+LLDB_PLUGIN_DECLARE(InstructionMIPS)
+LLDB_PLUGIN_DECLARE(InstructionMIPS64)
+LLDB_PLUGIN_DECLARE(InstructionPPC64)
+LLDB_PLUGIN_DECLARE(CXXItaniumABI)
 LLDB_PLUGIN_DECLARE(AppleObjCRuntime)
 LLDB_PLUGIN_DECLARE(SystemRuntimeMacOSX)
 LLDB_PLUGIN_DECLARE(RenderScriptRuntime)
@@ -89,21 +89,21 @@ LLDB_PLUGIN_DECLARE(CPlusPlusLanguage)
 LLDB_PLUGIN_DECLARE(ObjCLanguage)
 LLDB_PLUGIN_DECLARE(ObjCPlusPlusLanguage)
 #if defined(_WIN32)
-LLDB_PLUGIN_DECLARE(ProcessWindows)
+LLDB_PLUGIN_DECLARE(ProcessWindowsCommon)
 #endif
 #if defined(__FreeBSD__)
 LLDB_PLUGIN_DECLARE(ProcessFreeBSD)
 #endif
 #if defined(__APPLE__)
 LLDB_PLUGIN_DECLARE(SymbolVendorMacOSX)
-LLDB_PLUGIN_DECLARE(ProcessKDP)
+LLDB_PLUGIN_DECLARE(ProcessMacOSXKernel)
 LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel)
 #endif
 LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog)
-LLDB_PLUGIN_DECLARE(PlatformRemoteGDBServer)
+LLDB_PLUGIN_DECLARE(PlatformGDB)
 LLDB_PLUGIN_DECLARE(ProcessGDBRemote)
 LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderPOSIXDYLD)
+LLDB_PLUGIN_DECLARE(DynamicLoaderPosixDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderStatic)
 LLDB_PLUGIN_DECLARE(DynamicLoaderWasmDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD)
@@ -145,7 +145,7 @@ llvm::Error SystemInitializerFull::Initialize() {
   LLDB_PLUGIN_INITIALIZE(ObjectFileWasm);
 
   LLDB_PLUGIN_INITIALIZE(ObjectContainerBSDArchive);
-  LLDB_PLUGIN_INITIALIZE(ObjectContainerUniversalMachO);
+  LLDB_PLUGIN_INITIALIZE(ObjectContainerMachOArchive);
 
   LLDB_PLUGIN_INITIALIZE(ScriptInterpreterNone);
 
@@ -202,15 +202,15 @@ llvm::Error SystemInitializerFull::Initialize() {
   LLDB_PLUGIN_INITIALIZE(SymbolFileSymtab);
   LLDB_PLUGIN_INITIALIZE(SymbolVendorWasm);
   LLDB_PLUGIN_INITIALIZE(UnwindAssemblyInstEmulation);
-  LLDB_PLUGIN_INITIALIZE(UnwindAssembly_x86);
+  LLDB_PLUGIN_INITIALIZE(UnwindAssemblyX86);
 
-  LLDB_PLUGIN_INITIALIZE(EmulateInstructionARM);
-  LLDB_PLUGIN_INITIALIZE(EmulateInstructionARM64);
-  LLDB_PLUGIN_INITIALIZE(EmulateInstructionMIPS)

[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid reopened this revision.
omjavaid added a comment.
This revision is now accepted and ready to land.

This breaks LLDB AArch64 Linux buildbot 
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/1713


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [lldb] fdc122e - Revert "[lldb/lldb-server] Add target.xml support for qXfer request."

2020-02-17 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2020-02-18T10:16:52+05:00
New Revision: fdc122e4ed6fd04c31595635d45675ad68d258bd

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

LOG: Revert "[lldb/lldb-server] Add target.xml support for qXfer request."

This patch cause floating point registers to fail on LLDB aarch64-linux
buildbot.

http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/1713

This reverts commit aedc196101e33bd58f7443c5b93398418ce55edf.

Added: 


Modified: 

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Removed: 

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py

lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp



diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
deleted file mode 100644
index 8b20bcb0..
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-CXX_SOURCES := main.cpp
-
-include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
deleted file mode 100644
index 530e2ce80023..
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-import gdbremote_testcase
-import textwrap
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-import re
-import xml.etree.ElementTree as ET
-
-class TestGdbRemoteTargetXmlPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@expectedFailureNetBSD
-@llgs_test
-def test_g_target_xml_returns_correct_data(self):
-self.init_llgs_test()
-self.build()
-self.set_inferior_startup_launch()
-
-procs = self.prep_debug_monitor_and_inferior()
-
-OFFSET = 0
-LENGTH = 0x10
-self.test_sequence.add_log_lines([
-"read packet: $qXfer:features:read:target.xml:{:x},{:x}#00".format(
-OFFSET,
-LENGTH),
-{   
-"direction": "send", 
-"regex": re.compile("^\$l(.+)#[0-9a-fA-F]{2}$"), 
-"capture": {1: "target_xml"}
-}],
-True)
-context = self.expect_gdbremote_sequence()
-
-target_xml = context.get("target_xml")
-
-root = ET.fromstring(target_xml)
-self.assertIsNotNone(root)
-self.assertEqual(root.tag, "target")
-
-architecture = root.find("architecture")
-self.assertIsNotNone(architecture)
-self.assertEqual(architecture.text, self.getArchitecture())
-
-feature = root.find("feature")
-self.assertIsNotNone(feature)
-
-target_xml_registers = feature.findall("reg")
-self.assertTrue(len(target_xml_registers) > 0)
-
-# registers info collected by qRegisterInfo
-self.add_register_info_collection_packets()
-context = self.expect_gdbremote_sequence()
-self.assertIsNotNone(context)
-q_info_registers = self.parse_register_info_packets(context)
-
-self.assertTrue(len(target_xml_registers) == len(q_info_registers))
-for register in zip(target_xml_registers, q_info_registers):
-xml_info_reg = register[0]
-q_info_reg = register[1]
-self.assertEqual(q_info_reg["name"], xml_info_reg.get("name"))
-self.assertEqual(q_info_reg["set"], xml_info_reg.get("group"))
-self.assertEqual(q_info_reg["format"], xml_info_reg.get("format"))
-self.assertEqual(q_info_reg["bitsize"], 
xml_info_reg.get("bitsize"))
-self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
-self.assertEqual(q_info_reg["encoding"], 
xml_info_reg.get("encoding"))
\ No newline at end of file

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/main.cpp
 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-read

[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid requested changes to this revision.
omjavaid added a comment.
This revision now requires changes to proceed.

I have reverted this change temporarily. Please look at the test failure. I ll 
also do the same at my end. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [lldb] aa2ae6a - [lldb/Plugins] Add missing initialize/terminate calls

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T21:28:16-08:00
New Revision: aa2ae6af81d73773d27d94d120056ef02ce4af6b

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

LOG: [lldb/Plugins] Add missing initialize/terminate calls

Add missing initialize and terminate calls for DynamicLoaderHexagonDYLD
and ObjectFileJIT.

Added: 


Modified: 
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 




diff  --git a/lldb/source/API/SystemInitializerFull.cpp 
b/lldb/source/API/SystemInitializerFull.cpp
index 9a067c1de9ad..894df077836a 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -34,6 +34,7 @@ LLDB_PLUGIN_DECLARE(ABISystemZ)
 LLDB_PLUGIN_DECLARE(ABIX86)
 LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
 LLDB_PLUGIN_DECLARE(ObjectFileELF)
+LLDB_PLUGIN_DECLARE(ObjectFileJIT)
 LLDB_PLUGIN_DECLARE(ObjectFileMachO)
 LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
 LLDB_PLUGIN_DECLARE(ObjectFileWasm)
@@ -102,6 +103,7 @@ LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel)
 LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog)
 LLDB_PLUGIN_DECLARE(PlatformGDB)
 LLDB_PLUGIN_DECLARE(ProcessGDBRemote)
+LLDB_PLUGIN_DECLARE(DynamicLoaderHexagonDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderPosixDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderStatic)
@@ -140,6 +142,7 @@ llvm::Error SystemInitializerFull::Initialize() {
 
   LLDB_PLUGIN_INITIALIZE(ObjectFileBreakpad);
   LLDB_PLUGIN_INITIALIZE(ObjectFileELF);
+  LLDB_PLUGIN_INITIALIZE(ObjectFileJIT);
   LLDB_PLUGIN_INITIALIZE(ObjectFileMachO);
   LLDB_PLUGIN_INITIALIZE(ObjectFilePECOFF);
   LLDB_PLUGIN_INITIALIZE(ObjectFileWasm);
@@ -239,6 +242,7 @@ llvm::Error SystemInitializerFull::Initialize() {
   LLDB_PLUGIN_INITIALIZE(PlatformGDB);
 
   LLDB_PLUGIN_INITIALIZE(ProcessGDBRemote);
+  LLDB_PLUGIN_INITIALIZE(DynamicLoaderHexagonDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderPosixDYLD);
   LLDB_PLUGIN_INITIALIZE(DynamicLoaderWasmDYLD); // Before DynamicLoaderStatic.
@@ -327,6 +331,7 @@ void SystemInitializerFull::Terminate() {
   LLDB_PLUGIN_TERMINATE(ProcessGDBRemote);
   LLDB_PLUGIN_TERMINATE(StructuredDataDarwinLog);
 
+  LLDB_PLUGIN_TERMINATE(DynamicLoaderHexagonDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderMacOSXDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderPosixDYLD);
   LLDB_PLUGIN_TERMINATE(DynamicLoaderWasmDYLD);
@@ -343,6 +348,7 @@ void SystemInitializerFull::Terminate() {
 
   LLDB_PLUGIN_TERMINATE(ObjectFileBreakpad);
   LLDB_PLUGIN_TERMINATE(ObjectFileELF);
+  LLDB_PLUGIN_TERMINATE(ObjectFileJIT);
   LLDB_PLUGIN_TERMINATE(ObjectFileMachO);
   LLDB_PLUGIN_TERMINATE(ObjectFilePECOFF);
   LLDB_PLUGIN_TERMINATE(ObjectFileWasm);

diff  --git 
a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp 
b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index 4e227abbafc2..fe86b2929073 100644
--- 
a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ 
b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -25,6 +25,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+LLDB_PLUGIN_DEFINE(DynamicLoaderHexagonDYLD)
+
 // Aidan 21/05/2014
 //
 // Notes about hexagon dynamic loading:

diff  --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp 
b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index 2d505bcd409b..371bbb5ff84d 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -39,6 +39,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
+LLDB_PLUGIN_DEFINE(ObjectFileJIT)
+
 char ObjectFileJIT::ID;
 
 void ObjectFileJIT::Initialize() {

diff  --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp 
b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index 6112dd234fb2..bc5d119a30a1 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -27,6 +27,7 @@ LLDB_PLUGIN_DECLARE(ABISystemZ)
 LLDB_PLUGIN_DECLARE(ABIX86)
 LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
 LLDB_PLUGIN_DECLARE(ObjectFileELF)
+LLDB_PLUGIN_DECLARE(ObjectFileJIT)
 LLDB_PLUGIN_DECLARE(ObjectFileMachO)
 LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
 LLDB_PLUGIN_DECLARE(ObjectFileWasm)
@@ -88,6 +89,7 @@ LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel)
 LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog)
 LLDB_PLUGIN_DECLARE(PlatformGDB)
 LLDB_PLUGIN_DECLARE(ProcessGDBRemote)
+LLDB_PLUGIN_DECLARE(DynamicLoaderHexagonDYLD)
 LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
 LL

[Lldb-commits] [lldb] b0cb98b - [lldb/Plugins] Conditionally build OperatingSystemPython.

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T21:22:37-08:00
New Revision: b0cb98b1f5d53cbce66652fa2894c55db61965a4

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

LOG: [lldb/Plugins] Conditionally build OperatingSystemPython.

Only build the Python Operating System Plugin when LLDB_ENABLE_PYTHON is
set to true.

Added: 


Modified: 
lldb/source/Plugins/OperatingSystem/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/OperatingSystem/CMakeLists.txt 
b/lldb/source/Plugins/OperatingSystem/CMakeLists.txt
index 655007a0aab9..06d909b862a0 100644
--- a/lldb/source/Plugins/OperatingSystem/CMakeLists.txt
+++ b/lldb/source/Plugins/OperatingSystem/CMakeLists.txt
@@ -1 +1,3 @@
-add_subdirectory(Python)
+if (LLDB_ENABLE_PYTHON)
+  add_subdirectory(Python)
+endif()



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added inline comments.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:465
+  response.PutChar(',');
+response.Printf("%" PRIx32, *reg_num);
+  }

I think this is not correct: target.xml expects this to be 
[decimal](https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp#L4417).
 (This is different from qRegisterInfo, which expects 
[hex](https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp#L579).)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py:69
+self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
+self.assertEqual(q_info_reg["encoding"], 
xml_info_reg.get("encoding"))

Why don't you test all the fields here?



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2814
+if (!encoding.empty())
+  response.Printf("encoding=\"%s\" ", encoding.str().c_str());
+

labath wrote:
> Similarly, `response << "encoding='" << encoding << "' "`, or 
> `response.Format("encoding='{0}'", encoding)` would be shorter, and avoid 
> string copying.
Nit: Now it is a funny mixture of operator<<, Printfs and PutCString. Is there 
a reason not to use << for everything? (I guess PutHex8 can't be easily done 
with <<, but everything else can?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin added inline comments.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2814
+
+if (reg_info->invalidate_regs && reg_info->invalidate_regs[0]) {
+  response.PutCString("invalidate_regnums=\"");

I know this is copy&paste from qRegisterInfo, but should not this be `if 
(reg_info->invalidate_regs && reg_info->invalidate_regs[0] != 
LLDB_INVALID_REGNUM)`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [PATCH] D74743: [lldb] Make header guards consistent across LLDB

2020-02-17 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: wuzish.

Yeah, let's do what LLVM is doing. Thanks!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74743



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


[Lldb-commits] [lldb] 866b7a6 - [lldb] Replace empty ctor en dtor bodies with =default (NFC)

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T22:58:26-08:00
New Revision: 866b7a651949f373a3b191f5fee3a7fe0a2709be

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

LOG: [lldb] Replace empty ctor en dtor bodies with =default (NFC)

Use = default instead of empty constructor and destructor bodies in the
API layer.

Added: 


Modified: 
lldb/source/API/SBAddress.cpp
lldb/source/API/SBAttachInfo.cpp
lldb/source/API/SBBreakpoint.cpp
lldb/source/API/SBBreakpointLocation.cpp
lldb/source/API/SBData.cpp
lldb/source/API/SBDeclaration.cpp
lldb/source/API/SBError.cpp
lldb/source/API/SBEvent.cpp
lldb/source/API/SBExecutionContext.cpp
lldb/source/API/SBExpressionOptions.cpp
lldb/source/API/SBFile.cpp
lldb/source/API/SBFileSpec.cpp
lldb/source/API/SBFileSpecList.cpp
lldb/source/API/SBInstruction.cpp
lldb/source/API/SBInstructionList.cpp
lldb/source/API/SBLaunchInfo.cpp
lldb/source/API/SBLineEntry.cpp
lldb/source/API/SBListener.cpp
lldb/source/API/SBMemoryRegionInfo.cpp
lldb/source/API/SBMemoryRegionInfoList.cpp
lldb/source/API/SBModule.cpp
lldb/source/API/SBModuleSpec.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/API/SBProcess.cpp
lldb/source/API/SBProcessInfo.cpp
lldb/source/API/SBQueue.cpp
lldb/source/API/SBSection.cpp
lldb/source/API/SBSourceManager.cpp
lldb/source/API/SBStream.cpp
lldb/source/API/SBStringList.cpp
lldb/source/API/SBStructuredData.cpp
lldb/source/API/SBSymbolContext.cpp
lldb/source/API/SBSymbolContextList.cpp
lldb/source/API/SBTarget.cpp
lldb/source/API/SBThread.cpp
lldb/source/API/SBThreadCollection.cpp
lldb/source/API/SBThreadPlan.cpp
lldb/source/API/SBType.cpp
lldb/source/API/SBTypeCategory.cpp
lldb/source/API/SBTypeEnumMember.cpp
lldb/source/API/SBTypeFilter.cpp
lldb/source/API/SBTypeFormat.cpp
lldb/source/API/SBTypeNameSpecifier.cpp
lldb/source/API/SBTypeSummary.cpp
lldb/source/API/SBTypeSynthetic.cpp
lldb/source/API/SBUnixSignals.cpp
lldb/source/API/SBValue.cpp
lldb/source/API/SBValueList.cpp
lldb/source/API/SBWatchpoint.cpp
lldb/source/API/SystemInitializerFull.cpp

Removed: 




diff  --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index e332f3155f46..d2b9b80973c8 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -52,7 +52,7 @@ SBAddress::SBAddress(lldb::addr_t load_addr, lldb::SBTarget 
&target)
   SetLoadAddress(load_addr, target);
 }
 
-SBAddress::~SBAddress() {}
+SBAddress::~SBAddress() = default;
 
 const SBAddress &SBAddress::operator=(const SBAddress &rhs) {
   LLDB_RECORD_METHOD(const lldb::SBAddress &,

diff  --git a/lldb/source/API/SBAttachInfo.cpp 
b/lldb/source/API/SBAttachInfo.cpp
index 9f0d2eb399d9..b21589cf2708 100644
--- a/lldb/source/API/SBAttachInfo.cpp
+++ b/lldb/source/API/SBAttachInfo.cpp
@@ -54,7 +54,7 @@ SBAttachInfo::SBAttachInfo(const SBAttachInfo &rhs)
   m_opaque_sp = clone(rhs.m_opaque_sp);
 }
 
-SBAttachInfo::~SBAttachInfo() {}
+SBAttachInfo::~SBAttachInfo() = default;
 
 lldb_private::ProcessAttachInfo &SBAttachInfo::ref() { return *m_opaque_sp; }
 

diff  --git a/lldb/source/API/SBBreakpoint.cpp 
b/lldb/source/API/SBBreakpoint.cpp
index 156c50f4ca90..283dd7ea8253 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -873,7 +873,7 @@ SBBreakpointList::SBBreakpointList(SBTarget &target)
   LLDB_RECORD_CONSTRUCTOR(SBBreakpointList, (lldb::SBTarget &), target);
 }
 
-SBBreakpointList::~SBBreakpointList() {}
+SBBreakpointList::~SBBreakpointList() = default;
 
 size_t SBBreakpointList::GetSize() const {
   LLDB_RECORD_METHOD_CONST_NO_ARGS(size_t, SBBreakpointList, GetSize);

diff  --git a/lldb/source/API/SBBreakpointLocation.cpp 
b/lldb/source/API/SBBreakpointLocation.cpp
index 40384c7ffe88..e29f3fd9c50e 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -59,7 +59,7 @@ operator=(const SBBreakpointLocation &rhs) {
   return LLDB_RECORD_RESULT(*this);
 }
 
-SBBreakpointLocation::~SBBreakpointLocation() {}
+SBBreakpointLocation::~SBBreakpointLocation() = default;
 
 BreakpointLocationSP SBBreakpointLocation::GetSP() const {
   return m_opaque_wp.lock();

diff  --git a/lldb/source/API/SBData.cpp b/lldb/source/API/SBData.cpp
index a8ce58edaf88..daf313ad55c9 100644
--- a/lldb/source/API/SBData.cpp
+++ b/lldb/source/API/SBData.cpp
@@ -41,7 +41,7 @@ const SBData &SBData::operator=(const SBData &rhs) {
   return LLDB_RECORD_RESULT(*this);
 }
 
-SBData::~SBData() {}
+SBData::~SBData() = default;
 
 void SBData::SetOpaque(const lldb::DataExtractorSP &data_sp) {
   m_opaque_sp = data_sp;

diff  --git a/lldb/source/API/SBDe

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

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I think we should just have DynamicLoaderStatic disqualify itself for wasm 
files -- using it will never work there, so why should it pretend to support 
them...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72751



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-17 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2814
+if (!encoding.empty())
+  response.Printf("encoding=\"%s\" ", encoding.str().c_str());
+

jarin wrote:
> labath wrote:
> > Similarly, `response << "encoding='" << encoding << "' "`, or 
> > `response.Format("encoding='{0}'", encoding)` would be shorter, and avoid 
> > string copying.
> Nit: Now it is a funny mixture of operator<<, Printfs and PutCString. Is 
> there a reason not to use << for everything? (I guess PutHex8 can't be easily 
> done with <<, but everything else can?)
Yeah, I'm all for using anything else than printf (operator<<, the Format 
function, etc.). I just didn't feel like raising this point at that time. :/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [lldb] ffd78a0 - [lldb] Replace #pragma once with header guard

2020-02-17 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-17T23:39:19-08:00
New Revision: ffd78a008ab29c399975485e86bc6bedf91c5277

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

LOG: [lldb] Replace #pragma once with header guard

This got messed up when updating the header guard. Remove the
`pragma once` and use a header guard instead.

Added: 


Modified: 
lldb/include/lldb/Host/HostGetOpt.h
lldb/include/lldb/Host/common/GetOptInc.h

Removed: 




diff  --git a/lldb/include/lldb/Host/HostGetOpt.h 
b/lldb/include/lldb/Host/HostGetOpt.h
index 6fb0ac53dd5d..746e03e1bd1e 100644
--- a/lldb/include/lldb/Host/HostGetOpt.h
+++ b/lldb/include/lldb/Host/HostGetOpt.h
@@ -1,7 +1,3 @@
-#ifndef LLDB_HOST_HOSTGETOPT_H
-
-#define LLDB_HOST_HOSTGETOPT_H
-
 //===-- HostGetOpt.h *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
@@ -9,7 +5,9 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
-#pragma once
+
+#ifndef LLDB_HOST_HOSTGETOPT_H
+#define LLDB_HOST_HOSTGETOPT_H
 
 #if !defined(_MSC_VER) && !defined(__NetBSD__)
 
@@ -26,4 +24,4 @@
 
 #endif
 
-#endif
+#endif // LLDB_HOST_HOSTGETOPT_H

diff  --git a/lldb/include/lldb/Host/common/GetOptInc.h 
b/lldb/include/lldb/Host/common/GetOptInc.h
index caa2efc060a0..3fb9add47954 100644
--- a/lldb/include/lldb/Host/common/GetOptInc.h
+++ b/lldb/include/lldb/Host/common/GetOptInc.h
@@ -1,9 +1,14 @@
-#ifndef LLDB_HOST_COMMON_GETOPTINC_H
+//===-- GetOptInc.h -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
 
+#ifndef LLDB_HOST_COMMON_GETOPTINC_H
 #define LLDB_HOST_COMMON_GETOPTINC_H
 
-#pragma once
-
 #include "lldb/lldb-defines.h"
 
 #if defined(_MSC_VER)
@@ -55,4 +60,4 @@ int getopt_long_only(int argc, char *const *argv, const char 
*optstring,
  const struct option *longopts, int *longindex);
 #endif
 
-#endif
+#endif // LLDB_HOST_COMMON_GETOPTINC_H



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


[Lldb-commits] [lldb] f9568a9 - [lldb][NFC] Make all CompilerDeclContext parameters references instead of pointers

2020-02-17 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-18T08:58:36+01:00
New Revision: f9568a95493aea3ea813bd37cb8c084ec4294e38

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

LOG: [lldb][NFC] Make all CompilerDeclContext parameters references instead of 
pointers

Summary:
All of our lookup APIs either use `CompilerDeclContext &` or 
`CompilerDeclContext *` semi-randomly it seems.
This leads to us constantly converting between those two types (and doing 
nullptr checks when going from
pointer to reference). It also leads to the confusing situation where we have 
two possible ways to express
that we don't have a CompilerDeclContex: either a nullptr or an invalid 
CompilerDeclContext (aka a default
constructed CompilerDeclContext).

This moves all APIs to use references and gets rid of all the nullptr checks 
and conversions.

Reviewers: labath, mib, shafik

Reviewed By: labath, shafik

Subscribers: shafik, arphaman, abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Symbol/SymbolFile.h
lldb/source/API/SBModule.cpp
lldb/source/Breakpoint/BreakpointResolverName.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/AddressResolverName.cpp
lldb/source/Core/Disassembler.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/SourceManager.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp

lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/source/Symbol/SymbolFile.cpp
lldb/tools/lldb-test/lldb-test.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index a811b77e40c9..4715961eabf1 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -302,7 +302,7 @@ class Module : public std::enable_shared_from_this,
   /// A symbol context list that gets filled in with all of the
   /// matches.
   void FindFunctions(ConstString name,
- const CompilerDeclContext *parent_decl_ctx,
+ const CompilerDeclContext &parent_decl_ctx,
  lldb::FunctionNameType name_type_mask, bool symbols_ok,
  bool inlines_ok, SymbolContextList &sc_list);
 
@@ -365,7 +365,7 @@ class Module : public std::enable_shared_from_this,
   /// A list of variables that gets the matches appended to.
   ///
   void FindGlobalVariables(ConstString name,
-   const CompilerDeclContext *parent_decl_ctx,
+   const CompilerDeclContext &parent_decl_ctx,
size_t max_matches, VariableList &variable_list);
 
   /// Find global and static variables by regular expression.
@@ -444,7 +444,7 @@ class Module : public std::enable_shared_from_this,
   /// \param[out] type_list
   /// A type list gets populated with any matches.
   void FindTypesInNamespace(ConstString type_name,
-const CompilerDeclContext *parent_decl_ctx,
+const CompilerDeclContext &parent_decl_ctx,
 size_t max_matches, TypeList &type_list);
 
   /// Get const accessor for the module architecture.
@@ -1037,7 +1037,7 @@ class Module : public 
std::enable_shared_from_this,
   Module(); // Only used internally by CreateJITModule ()
 
   void FindTypes_Impl(
-  ConstString name, const CompilerDeclContext *parent_decl_ctx,
+  ConstString name, const CompilerDeclContext &parent_decl_ctx,
   size_t max_matches,
   llvm::DenseSet &searched_symbol_files,
   TypeMap &types);

diff  --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symb