[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

BTW, do you have commit access, or you need someone to commit this for you?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62221



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


[Lldb-commits] [PATCH] D62499: Create a generic handler for Xfer packets

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:2738
+  if (!memory_buffer_sp) {
+if (xfer_object == "auxv") {
+// *BSD impls should be able to do this too.

aadsm wrote:
> xiaobai wrote:
> > labath wrote:
> > > Given that this function is going to grow, it would be good to split it 
> > > in smaller chunks. Maybe move this code into something like 
> > > `ErrorOr ReadObject(StringRef object)`?
> > +1
> > 
> > You could have smaller methods like "ParseAuxvPacket" and "ReadObject"
> I'm actually trying to return an llvm::Expected so I can return a 
> `createStringError` that will have a message and an error code (as far as I 
> can see `ErrorOr`only allows to return an error code).
> However, I can't figure out how to get both the error code and error message 
> from the `takeError()` function. I found `llvm::errorToErrorCode` and 
> `llvm::toString` but they both require to pass ownership of the error to them 
> so I can only use one of them.
> Is the only way to use the `handleErrors` function that will give me access 
> to the underlying `ErrorInfo` where I can then call `convertToErrorCode` and 
> `getMessage` on it? Sounds overly complicated for something that's probably 
> simpler than this.
Yeah, using `Expected` is a even better idea.

`handleErrors` is the right way to do this kind of thing. If you're using 
`Expected` then the best way to handle this situation would be to define a 
custom error type to mean "unimplemented". Then you could do something like:
```
Expected t = getT();
if (!t) {
 ??? result;
  handleAllErrors(t.takeError(),
[&] (UnimplementedError &e) { result = 
SendUnimplementedResponse(e.message()); },
   // TODO: We should have a SendErrorResponse version that takes a llvm::Error
[&] (std::unique_ptr e) { result = 
SendErrorResponse(Status(Error(std::move(e)));
  );
  return result;
}
do_stuff(*e);
```

Ideally this code wouldn't even live inside the packet handler function, but we 
would have a separate function for that, and packet handlers would just return 
`Expected`. However, that's for another patch...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62499



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


[Lldb-commits] [PATCH] D62503: Add ReadCStringFromMemory for faster string reads

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62503#1520435 , @aadsm wrote:

> > However, now that I think about it, that is nonsense, because there is no 
> > way for us to say to the user that "we failed to read some initial bytes, 
> > but this is the memory contents after that". So just using 
> > process_vm_readv, and finishing up with ptrace sounds fine to me.
>
> The reason why I thought reading page by page still made sense in the 
> ReadMemory is to cover for the situation where we cross 3 pages and the page 
> in the middle is not readable. However, that might not be realistic to happen?


Yeah, you're right. This can even happen with just two pages if the first page 
is not readable-by-process_vm_readv but it *is* readable-by-ptrace. I think 
that's pretty unlikely to happen, but it is possible in theory. I'll leave it 
up to you to figure out whether it's worth implementing that.

In D62503#1520435 , @aadsm wrote:

> > That would also allow you to test this by sending `m` packets which are 
> > deliberately chosen to cross readable/unreadable page boundaries in 
> > interesting ways...
>
> BTW: LLDB will usually always send down aligned reads due to it populating 
> its memory cache.


Yep, this kind of test would have to be done at the lldb-server level. Which is 
reasonable, as we're actually testing lldb-server behavior.




Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:1502-1504
+Status NativeProcessLinux::ReadCStringFromMemory(lldb::addr_t addr,
+ char *buffer, size_t max_size,
+ size_t &total_bytes_read) {

clayborg wrote:
> Seems like this function could be added to the NativeProcess base class? We 
> would need to add "virtual size_t NativeProcess::GetCacheLineSize() = 0;" to 
> NativeProcess too in that case.
There's `llvm::sys::Process::getPageSizeEstimate()`, which can be used directly 
here. Since lldb-server is running on the same host as the debugged process, we 
don't even have to pipe things through the NativeProcess class.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62503



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


[Lldb-commits] [PATCH] D62499: Create a generic handler for Xfer packets

2019-05-29 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

> One time just before it's loaded (so lldb can check which modules are loaded) 
> and another right after it's loaded (so lldb can check again which ones are 
> loaded and calculate the difference).

There is on NetBSD and on a selection of other OSs: `_rtld_debug_state` 
integrated as a part of ELF dynamic loader.

Is there something like that on Android that could be reused?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62499



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


[Lldb-commits] [PATCH] D62570: [WIP] Use LLVM's debug line parser in LLDB

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Interesting stuff. I was wondering why you even needed to construct the 
`DWARFContext` and `DWARFUnit`, so I looked around a bit. It looks like they 
are only used for calling `DWARFFormValue::extract` to fetch the strings from 
the string table in the V5 case. So, it sounds like we need the `DWARFContext` 
to reach the string table, but maybe we don't need to create the `DWARFUnit` ? 
After all, one of the main goals of DWARF5 debug_lines was to have them be 
independent of the debug_info section.

What I'm trying to get at here is that it may be possible to limit the amount 
of work being done in `DWARFContext` by passing it only the small set of 
sections that it needs to get this parsed (something like debug_line, 
debug_str, debug_line_str ?).

BTW, I am also going to be touching this code slightly, as I'm trying to make 
sure the "support file" lists are shared between the various type units. 
However, it hopefully won't conflict with this too much, as I mostly approach 
it from the "other end" (i.e., what happens to the file lists after they have 
been parsed).


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62570



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


[Lldb-commits] [PATCH] D62562: [Target] Introduce Process::GetLanguageRuntimes

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Target/Process.cpp:1565
+  for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) 
{
+if (auto runtime = GetLanguageRuntime(lang_type, retry_if_null))
+  language_runtimes.emplace_back(std::move(runtime));

Use `auto *` to make it clear that this is a pointer (or even `LanguageRuntime 
*`, as the type is not that long). Then drop `std::move` below, as it's useless 
for pointers.



Comment at: source/Target/Thread.cpp:2217-2218
+  for (LanguageRuntime *runtime : language_runtimes) {
+if (!runtime)
+  continue;
+

It looks like the code already makes sure null pointers don't make it into the 
list. We should make that a part of the contract and not check it twice.


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

https://reviews.llvm.org/D62562



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


[Lldb-commits] [PATCH] D62499: Create a generic handler for Xfer packets

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62499#1520610 , @krytarowski wrote:

> > One time just before it's loaded (so lldb can check which modules are 
> > loaded) and another right after it's loaded (so lldb can check again which 
> > ones are loaded and calculate the difference).
>
> There is on NetBSD and on a selection of other OSs: `_rtld_debug_state` 
> integrated as a part of ELF dynamic loader.
>
> Is there something like that on Android that could be reused?


Yes, there is, and it's being used now. The question here is what do we do 
*after* we hit the dynamic loader breakpoint...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62499



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


[Lldb-commits] [PATCH] D62500: Add support to read aux vector values

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62500#1519658 , @JDevlieghere 
wrote:

> > A third option would be to create a completely new library for this. In the 
> > past we've talked about a new library for "classes describing various 
> > properties of a process", where we'd have MemoryRegionInfo, ProcessInfo, 
> > etc, but so far it hasn't materialized. It seems like this could fit nicely 
> > into this description, so we could start with the new library with this 
> > class. +@JDevlieghere for any thoughts on this.
>
> Do you mean having `AuxVector` in this library, or having it take a 
> `ProcessInfo` instead of the `Process` itself?


The first option. The idea would be that "ProcessInfo" describes uids/pids/... 
of a process, MemoryRegionInfo describes it's memory regions, and AuxVector 
describes it's, well.. aux vector. UnixSignals, and probably some others could 
go there too.

OTOH, Process/Utility sounds like a good name for this kind of thing, and some 
of these classes are already there, so we may want to approach this from the 
other end, and remove anything that should not be there (RegisterContextLLDB is 
my first candidate).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62500



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


[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:372
+return std::move(*expected_ranges);
+  unit.GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError(
+  "{0x%8.8x}: DIE has DW_AT_ranges(0x%" PRIx64 ") attribute, but "

JDevlieghere wrote:
> Can we add a test that ensures we actually display this error?
Done.


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

https://reviews.llvm.org/D62302



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


[Lldb-commits] [lldb] r361938 - DWARF: Fix address range support in mixed 4+5 scenario

2019-05-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 29 02:22:36 2019
New Revision: 361938

URL: http://llvm.org/viewvc/llvm-project?rev=361938&view=rev
Log:
DWARF: Fix address range support in mixed 4+5 scenario

Summary:
debug_ranges got renamed to debug_rnglists in DWARF 5. Prior to this
patch lldb was just picking the first section it could find in the file,
and using that for all address ranges lookups. This is not correct in
case the file contains a mixture of compile units with various standard
versions (not a completely unlikely scenario).

In this patch I make lldb support reading from both sections
simulaneously, and decide the correct section to use based on the
version number of the compile unit. SymbolFileDWARF::DebugRanges is
split into GetDebugRanges and GetDebugRngLists (the first one is renamed
mainly so we can catch all incorrect usages).

I tried to structure the code similarly to how llvm handles this logic
(hence DWARFUnit::FindRnglistFromOffset/Index), but the implementations
are still relatively far from each other.

Reviewers: JDevlieghere, aprantl, clayborg

Subscribers: lldb-commits

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

Added:
lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s
Modified:
lldb/trunk/lit/SymbolFile/DWARF/debug_ranges_and_rnglists.test
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Added: lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s?rev=361938&view=auto
==
--- lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s (added)
+++ lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s Wed May 29 
02:22:36 2019
@@ -0,0 +1,78 @@
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>&1 | FileCheck 
%s
+
+# CHECK: DIE has DW_AT_ranges(0x47) attribute, but range extraction failed (No 
debug_ranges section),
+# CHECK:  Function: id = {0x7fff001c}, name = "ranges", range = 
[0x-0x0004)
+# CHECK:Blocks: id = {0x7fff001c}, range = [0x-0x0004)
+
+.text
+.p2align 12
+.globl  ranges
+.type   ranges,@function
+ranges:# @ranges
+nop
+lookup_ranges:
+nop
+nop
+nop
+.Lranges_end:
+.size   ranges, .Lranges_end-ranges
+# -- End function
+.section.debug_str,"MS",@progbits,1
+.Lproducer:
+.asciz  "Hand-written DWARF"
+.Lranges:
+.asciz  "ranges"
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   14  # DW_FORM_strp
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46  # DW_TAG_subprogram
+.byte   1   # DW_CHILDREN_yes
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   3   # DW_AT_name
+.byte   14  # DW_FORM_strp
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   5   # Abbreviation Code
+.byte   11  # DW_TAG_lexical_block
+.byte   0   # DW_CHILDREN_no
+.byte   85  # DW_AT_ranges
+.byte   23  # DW_FORM_sec_offset
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.section.debug_info,"",@progbits
+.Lcu_begin0:
+.long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+.short  4   # DWARF version number
+.lo

[Lldb-commits] [PATCH] D62302: DWARF: Fix address range support in mixed 4+5 scenario

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Closed by commit rL361938: DWARF: Fix address range support in mixed 4+5 
scenario (authored by labath, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62302?vs=201515&id=201845#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62302

Files:
  lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s
  lldb/trunk/lit/SymbolFile/DWARF/debug_ranges_and_rnglists.test
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s
===
--- lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s
+++ lldb/trunk/lit/SymbolFile/DWARF/debug_ranges-missing-section.s
@@ -0,0 +1,78 @@
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s lookup_ranges" -o exit 2>&1 | FileCheck %s
+
+# CHECK: DIE has DW_AT_ranges(0x47) attribute, but range extraction failed (No debug_ranges section),
+# CHECK:  Function: id = {0x7fff001c}, name = "ranges", range = [0x-0x0004)
+# CHECK:Blocks: id = {0x7fff001c}, range = [0x-0x0004)
+
+.text
+.p2align 12
+.globl  ranges
+.type   ranges,@function
+ranges:# @ranges
+nop
+lookup_ranges:
+nop
+nop
+nop
+.Lranges_end:
+.size   ranges, .Lranges_end-ranges
+# -- End function
+.section.debug_str,"MS",@progbits,1
+.Lproducer:
+.asciz  "Hand-written DWARF"
+.Lranges:
+.asciz  "ranges"
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   14  # DW_FORM_strp
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46  # DW_TAG_subprogram
+.byte   1   # DW_CHILDREN_yes
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   3   # DW_AT_name
+.byte   14  # DW_FORM_strp
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   5   # Abbreviation Code
+.byte   11  # DW_TAG_lexical_block
+.byte   0   # DW_CHILDREN_no
+.byte   85  # DW_AT_ranges
+.byte   23  # DW_FORM_sec_offset
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   0   # EOM(3)
+
+.section.debug_info,"",@progbits
+.Lcu_begin0:
+.long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+.short  4   # DWARF version number
+.long   .debug_abbrev   # Offset Into Abbrev. Section
+.byte   8   # Address Size (in bytes)
+.byte   1   # Abbrev [1] 0xb:0x7b DW_TAG_compile_unit
+.long   .Lproducer  # DW_AT_producer
+.quad   ranges  # DW_AT_low_pc
+.long   .Lranges_end-ranges # DW_AT_high_pc
+.byte   2   # Abbrev [2] 0x2a:0x4d DW_TAG_subprogram
+.quad   ranges  # DW_AT_low_pc
+.long   .Lranges_end-ranges # DW_AT_high_pc
+.long   .Lranges# DW_AT_name
+.byte   5   # Abbrev [5] 0x61:0x15 DW_TAG_lexical_block
+.long   0x47# DW_AT_ranges
+.byte   0   # End Of Children Mark
+.

[Lldb-commits] [lldb] r361939 - DWARFASTParserClang: Unify compilation unit language handling

2019-05-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 29 02:32:59 2019
New Revision: 361939

URL: http://llvm.org/viewvc/llvm-project?rev=361939&view=rev
Log:
DWARFASTParserClang: Unify compilation unit language handling

Summary:
The function was not being consistent in how it retrieved the language
of the current compile unit. Sometimes it did so from the lldb CU
object, and sometimes from the DWARF die. This patch unifies the
handling on the latter. The reason for choosing the DWARF method is
because I'd eventually like to stop creating lldb CUs for dwarf type
units (and so this code needs to would need to work without them).

Reviewers: clayborg, JDevlieghere, aprantl

Subscribers: jdoerfert, lldb-commits

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

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=361939&r1=361938&r2=361939&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Wed May 
29 02:32:59 2019
@@ -294,6 +294,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 
   dw_attr_t attr;
   TypeSP type_sp;
+  LanguageType cu_language = die.GetLanguage();
   switch (tag) {
   case DW_TAG_typedef:
   case DW_TAG_base_type:
@@ -468,11 +469,8 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 }
   }
 
-  bool translation_unit_is_objc =
-  (sc.comp_unit->GetLanguage() == eLanguageTypeObjC ||
-   sc.comp_unit->GetLanguage() == eLanguageTypeObjC_plus_plus);
-
-  if (translation_unit_is_objc) {
+  if (cu_language == eLanguageTypeObjC ||
+  cu_language == eLanguageTypeObjC_plus_plus) {
 if (type_name_cstr != nullptr) {
   static ConstString g_objc_type_name_id("id");
   static ConstString g_objc_type_name_Class("Class");
@@ -629,8 +627,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 Declaration unique_decl(decl);
 
 if (type_name_const_str) {
-  LanguageType die_language = die.GetLanguage();
-  if (Language::LanguageIsCPlusPlus(die_language)) {
+  if (Language::LanguageIsCPlusPlus(cu_language)) {
 // For C++, we rely solely upon the one definition rule that says
 // only one thing can exist at a given decl context. We ignore the
 // file and line that things are declared on.
@@ -668,7 +665,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 }
 
 if (byte_size && *byte_size == 0 && type_name_cstr && !die.HasChildren() &&
-sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
+cu_language == eLanguageTypeObjC) {
   // Work around an issue with clang at the moment where forward
   // declarations for objective C classes are emitted as:
   //  DW_TAG_structure_type [2]


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


[Lldb-commits] [PATCH] D62481: DWARFASTParserClang: Unify compilation unit language handling

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361939: DWARFASTParserClang: Unify compilation unit 
language handling (authored by labath, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D62481?vs=201499&id=201846#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62481

Files:
  source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp


Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -294,6 +294,7 @@
 
   dw_attr_t attr;
   TypeSP type_sp;
+  LanguageType cu_language = die.GetLanguage();
   switch (tag) {
   case DW_TAG_typedef:
   case DW_TAG_base_type:
@@ -468,11 +469,8 @@
 }
   }
 
-  bool translation_unit_is_objc =
-  (sc.comp_unit->GetLanguage() == eLanguageTypeObjC ||
-   sc.comp_unit->GetLanguage() == eLanguageTypeObjC_plus_plus);
-
-  if (translation_unit_is_objc) {
+  if (cu_language == eLanguageTypeObjC ||
+  cu_language == eLanguageTypeObjC_plus_plus) {
 if (type_name_cstr != nullptr) {
   static ConstString g_objc_type_name_id("id");
   static ConstString g_objc_type_name_Class("Class");
@@ -629,8 +627,7 @@
 Declaration unique_decl(decl);
 
 if (type_name_const_str) {
-  LanguageType die_language = die.GetLanguage();
-  if (Language::LanguageIsCPlusPlus(die_language)) {
+  if (Language::LanguageIsCPlusPlus(cu_language)) {
 // For C++, we rely solely upon the one definition rule that says
 // only one thing can exist at a given decl context. We ignore the
 // file and line that things are declared on.
@@ -668,7 +665,7 @@
 }
 
 if (byte_size && *byte_size == 0 && type_name_cstr && !die.HasChildren() &&
-sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
+cu_language == eLanguageTypeObjC) {
   // Work around an issue with clang at the moment where forward
   // declarations for objective C classes are emitted as:
   //  DW_TAG_structure_type [2]


Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -294,6 +294,7 @@
 
   dw_attr_t attr;
   TypeSP type_sp;
+  LanguageType cu_language = die.GetLanguage();
   switch (tag) {
   case DW_TAG_typedef:
   case DW_TAG_base_type:
@@ -468,11 +469,8 @@
 }
   }
 
-  bool translation_unit_is_objc =
-  (sc.comp_unit->GetLanguage() == eLanguageTypeObjC ||
-   sc.comp_unit->GetLanguage() == eLanguageTypeObjC_plus_plus);
-
-  if (translation_unit_is_objc) {
+  if (cu_language == eLanguageTypeObjC ||
+  cu_language == eLanguageTypeObjC_plus_plus) {
 if (type_name_cstr != nullptr) {
   static ConstString g_objc_type_name_id("id");
   static ConstString g_objc_type_name_Class("Class");
@@ -629,8 +627,7 @@
 Declaration unique_decl(decl);
 
 if (type_name_const_str) {
-  LanguageType die_language = die.GetLanguage();
-  if (Language::LanguageIsCPlusPlus(die_language)) {
+  if (Language::LanguageIsCPlusPlus(cu_language)) {
 // For C++, we rely solely upon the one definition rule that says
 // only one thing can exist at a given decl context. We ignore the
 // file and line that things are declared on.
@@ -668,7 +665,7 @@
 }
 
 if (byte_size && *byte_size == 0 && type_name_cstr && !die.HasChildren() &&
-sc.comp_unit->GetLanguage() == eLanguageTypeObjC) {
+cu_language == eLanguageTypeObjC) {
   // Work around an issue with clang at the moment where forward
   // declarations for objective C classes are emitted as:
   //  DW_TAG_structure_type [2]
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62477: DWARFASTParserClang: Move attribute parsing into a single function

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added a comment.

In D62477#1519318 , @clayborg wrote:

> Would be good to verify performance doesn't regress from this somehow. Maybe 
> having a large DWARF file with many types and accessing each type and making 
> sure it is completed via the external AST.


I tried to measure this by calling ParseTypes 

 for each compile unit in a loop. If anything, the readings seem to indicate 
that the new version is faster (which is possible because we now don't iterate 
the attribute list twice to search for DW_AT_signature). However, the readings 
were pretty inconsistent even for identical runs, so this is most likely just 
noise.

TBH, I'd be surprised if this affects the performance in any way because there 
is so much other work being done while parsing/completing a type, and this only 
changes how we iterate over the attribute list. And the complexity of the 
iteration is still bound by the actual number of attirbutes, the only 
difference now is that the contained switch will have ~40 case labels instead 
of some slightly smaller number.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp:248
+  clang::StorageClass storage = clang::SC_None;
+  const char *mangled_name = nullptr;
+  ConstString name;

clayborg wrote:
> Why is this stored as a "const char *" and "name" below as a ConstString?
It's stored in the form in which the code expects to use it. Name used both as 
ConstString and as a c string, so I chose the first. The mangled name is only 
used as a c string, so I did not want to const-ify it needlessly (though the 
string will probably end up in the string pool anyway at some point.


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

https://reviews.llvm.org/D62477



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


[Lldb-commits] [PATCH] D62472: [CMake] LLDB.framework tools handling

2019-05-29 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 201859.
sgraenitz marked an inline comment as done.
sgraenitz added a comment.

Fixed debugserver; excluded changes in add_lldb_library() for now; result of 
this test looks as good as before:

$ cmake -GNinja -C../llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake 
-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi;lldb" ../llvm-project/llvm
$ ninja lldb lldb-argdumper lldb-server darwin-debug debugserver lldb-framework
$ DESTDIR=install ninja install


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62472

Files:
  lldb/CMakeLists.txt
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/cmake/modules/LLDBFramework.cmake
  lldb/tools/argdumper/CMakeLists.txt
  lldb/tools/darwin-debug/CMakeLists.txt
  lldb/tools/debugserver/source/CMakeLists.txt
  lldb/tools/driver/CMakeLists.txt
  lldb/tools/lldb-mi/CMakeLists.txt
  lldb/tools/lldb-server/CMakeLists.txt
  lldb/tools/lldb-vscode/CMakeLists.txt

Index: lldb/tools/lldb-vscode/CMakeLists.txt
===
--- lldb/tools/lldb-vscode/CMakeLists.txt
+++ lldb/tools/lldb-vscode/CMakeLists.txt
@@ -31,5 +31,15 @@
   )
 
 if(LLDB_BUILD_FRAMEWORK)
-  lldb_setup_framework_rpaths_in_tool(lldb-vscode)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  lldb_setup_rpaths(lldb-vscode
+BUILD_RPATH
+  "${framework_build_dir}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
 endif()
Index: lldb/tools/lldb-server/CMakeLists.txt
===
--- lldb/tools/lldb-server/CMakeLists.txt
+++ lldb/tools/lldb-server/CMakeLists.txt
@@ -77,3 +77,7 @@
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_add_to_framework(lldb-server)
+endif()
Index: lldb/tools/lldb-mi/CMakeLists.txt
===
--- lldb/tools/lldb-mi/CMakeLists.txt
+++ lldb/tools/lldb-mi/CMakeLists.txt
@@ -95,5 +95,15 @@
   )
 
 if(LLDB_BUILD_FRAMEWORK)
-  lldb_setup_framework_rpaths_in_tool(lldb-mi)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  lldb_setup_rpaths(lldb-mi
+BUILD_RPATH
+  "${framework_build_dir}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
 endif()
Index: lldb/tools/driver/CMakeLists.txt
===
--- lldb/tools/driver/CMakeLists.txt
+++ lldb/tools/driver/CMakeLists.txt
@@ -31,5 +31,15 @@
 set_target_properties(LLDBOptionsTableGen PROPERTIES FOLDER "lldb misc")
 
 if(LLDB_BUILD_FRAMEWORK)
-  lldb_setup_framework_rpaths_in_tool(lldb)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  lldb_setup_rpaths(lldb
+BUILD_RPATH
+  "${framework_build_dir}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
 endif()
Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -265,6 +265,10 @@
   ${entitlements}
 )
 
+  if(LLDB_BUILD_FRAMEWORK)
+lldb_add_to_framework(debugserver)
+  endif()
+
   if(IOS)
 set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS
   WITH_LOCKDOWN
Index: lldb/tools/darwin-debug/CMakeLists.txt
===
--- lldb/tools/darwin-debug/CMakeLists.txt
+++ lldb/tools/darwin-debug/CMakeLists.txt
@@ -1,3 +1,7 @@
 add_lldb_tool(darwin-debug
   darwin-debug.cpp
   )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_add_to_framework(darwin-debug)
+endif()
Index: lldb/tools/argdumper/CMakeLists.txt
===
--- lldb/tools/argdumper/CMakeLists.txt
+++ lldb/tools/argdumper/CMakeLists.txt
@@ -4,3 +4,7 @@
   LINK_LIBS
 lldbUtility
   )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_add_to_framework(lldb-argdumper)
+endif()
Index: lldb/cmake/modules/LLDBFramework.cmake

[Lldb-commits] [lldb] r361946 - [CMake] LLDB.framework tools handling

2019-05-29 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Wed May 29 04:26:06 2019
New Revision: 361946

URL: http://llvm.org/viewvc/llvm-project?rev=361946&view=rev
Log:
[CMake] LLDB.framework tools handling

Summary:
Modify the way LLDB.framework tools are collected. This allows for better 
fine-tuning of the install behavior downstream. Each target calls 
`lldb_add_to_framework()` individually. When entering the function, the target 
exists and we can tweak its very own post-build and install steps. This was not 
possible with the old `LLDB_FRAMEWORK_TOOLS` approach.

No function change otherwise.
This is a reduced follow-up from the proposal in D61952.

Reviewers: xiaobai, compnerd, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: clayborg, friss, ki.stfu, mgorny, lldb-commits, labath, #lldb

Tags: #lldb

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/cmake/modules/LLDBFramework.cmake
lldb/trunk/tools/argdumper/CMakeLists.txt
lldb/trunk/tools/darwin-debug/CMakeLists.txt
lldb/trunk/tools/debugserver/source/CMakeLists.txt
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt
lldb/trunk/tools/lldb-server/CMakeLists.txt
lldb/trunk/tools/lldb-vscode/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=361946&r1=361945&r2=361946&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed May 29 04:26:06 2019
@@ -151,6 +151,10 @@ if(LLDB_INCLUDE_TESTS)
 list(APPEND LLDB_TEST_DEPS dsymutil)
   endif()
 
+  if(TARGET lldb-framework)
+list(APPEND LLDB_TEST_DEPS lldb-framework)
+  endif()
+
   add_custom_target(lldb-test-deps)
   add_dependencies(lldb-test-deps ${LLDB_TEST_DEPS})
   set_target_properties(lldb-test-deps PROPERTIES FOLDER "lldb misc")

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=361946&r1=361945&r2=361946&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Wed May 29 04:26:06 2019
@@ -208,3 +208,32 @@ function(lldb_setup_framework_rpaths_in_
 
   add_dependencies(${name} lldb-framework)
 endfunction()
+
+# Unified handling for executable LLDB.framework resources. Given the name of 
an
+# executable target, this function adds a post-build step to copy it to the
+# framework bundle in the build-tree.
+function(lldb_add_to_framework name)
+  set(subdir "LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources")
+
+  # Destination for the copy in the build-tree. While the framework target may
+  # not exist yet, it will exist when the generator expression gets expanded.
+  set(copy_dest "$/../../../${subdir}")
+
+  # Copy into the framework's Resources directory for testing.
+  add_custom_command(TARGET ${name} POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E copy $ ${copy_dest}
+COMMENT "Copy ${name} to ${copy_dest}"
+  )
+endfunction()
+
+# CMake's set_target_properties() doesn't allow to pass lists for RPATH
+# properties directly (error: "called with incorrect number of arguments").
+# Instead of defining two list variables each time, use this helper function.
+function(lldb_setup_rpaths name)
+  cmake_parse_arguments(LIST "" "" "BUILD_RPATH;INSTALL_RPATH" ${ARGN})
+  set_target_properties(${name} PROPERTIES
+BUILD_WITH_INSTALL_RPATH OFF
+BUILD_RPATH "${LIST_BUILD_RPATH}"
+INSTALL_RPATH "${LIST_INSTALL_RPATH}"
+  )
+endfunction()
\ No newline at end of file

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=361946&r1=361945&r2=361946&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Wed May 29 04:26:06 2019
@@ -64,8 +64,6 @@ if(LLDB_BUILD_FRAMEWORK)
   set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default 
is A)")
   set(LLDB_FRAMEWORK_BUILD_DIR bin CACHE STRING "Output directory for 
LLDB.framework")
   set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Install 
directory for LLDB.framework")
-  set(LLDB_FRAMEWORK_TOOLS darwin-debug;debugserver;lldb-argdumper;lldb-server 
CACHE STRING
-  "List of tools to include in LLDB.framework/Resources")
 
   # Set designated directory for all dSYMs. Essentially, this emits the
   # framework's dSYM outside of the framework directory.

Modified: lldb/trunk/cmake/modules/LLDBFramework.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBFramework.cmake?rev=361946&r1=361945&r2=361

[Lldb-commits] [lldb] r361947 - [CMake] Remove lldb-server from LLDB.framework

2019-05-29 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Wed May 29 04:28:11 2019
New Revision: 361947

URL: http://llvm.org/viewvc/llvm-project?rev=361947&view=rev
Log:
[CMake] Remove lldb-server from LLDB.framework

Summary: The LLDB test suite doesn't need lldb-server in the framework bundle 
anymore.

Reviewers: JDevlieghere, jasonmolenda, xiaobai

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=361947&r1=361946&r2=361947&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Wed May 29 04:28:11 2019
@@ -77,7 +77,3 @@ add_lldb_tool(lldb-server
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
-
-if(LLDB_BUILD_FRAMEWORK)
-  lldb_add_to_framework(lldb-server)
-endif()


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


[Lldb-commits] [lldb] r361948 - Revert "D11003: Tolerate DWARF compile unit without filename."

2019-05-29 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed May 29 04:28:35 2019
New Revision: 361948

URL: http://llvm.org/viewvc/llvm-project?rev=361948&view=rev
Log:
Revert "D11003: Tolerate DWARF compile unit without filename."

Summary:
This code is modifying a support file list after it has been created.
This makes it hard to share the file list between type units and
compile units in DWARF. It's not a total showstopper, but supporting
this while also sharing the lists would make things more complicated.

Given that this was added to support a project which never fully
materialised, and that even back then there were some concerns about the
correctness of this approach (according to D11003#200772 the compile
unit name is not guaranteed to be the first one in the support file
list), I think we should just delete this workaround.

Reviewers: clayborg, tberghammer, dsrbecky

Subscribers: aprantl, lldb-commits

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=361948&r1=361947&r2=361948&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed May 29 
04:28:35 2019
@@ -689,19 +689,6 @@ lldb::CompUnitSP SymbolFileDWARF::ParseC
 module_sp, dwarf_cu, cu_file_spec, dwarf_cu->GetID(),
 cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo);
 
-// If we just created a compile unit with an invalid file spec,
-// try and get the first entry in the supports files from the
-// line table as that should be the compile unit.
-if (!cu_file_spec) {
-  cu_file_spec = cu_sp->GetSupportFiles().GetFileSpecAtIndex(1);
-  if (cu_file_spec) {
-(FileSpec &)(*cu_sp) = cu_file_spec;
-// Also fix the invalid file spec which was copied from the
-// compile unit.
-cu_sp->GetSupportFiles().Replace(0, cu_file_spec);
-  }
-}
-
 dwarf_cu->SetUserData(cu_sp.get());
 
 m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(


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


[Lldb-commits] [PATCH] D62474: [CMake] Remove lldb-server from LLDB.framework

2019-05-29 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361947: [CMake] Remove lldb-server from LLDB.framework 
(authored by stefan.graenitz, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62474?vs=201480&id=201862#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62474

Files:
  tools/lldb-server/CMakeLists.txt


Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -77,7 +77,3 @@
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
-
-if(LLDB_BUILD_FRAMEWORK)
-  lldb_add_to_framework(lldb-server)
-endif()


Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -77,7 +77,3 @@
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
-
-if(LLDB_BUILD_FRAMEWORK)
-  lldb_add_to_framework(lldb-server)
-endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62517: Revert "D11003: Tolerate DWARF compile unit without filename."

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361948: Revert "D11003: Tolerate DWARF compile unit 
without filename." (authored by labath, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D62517?vs=201640&id=201863#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62517

Files:
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -689,19 +689,6 @@
 module_sp, dwarf_cu, cu_file_spec, dwarf_cu->GetID(),
 cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo);
 
-// If we just created a compile unit with an invalid file spec,
-// try and get the first entry in the supports files from the
-// line table as that should be the compile unit.
-if (!cu_file_spec) {
-  cu_file_spec = cu_sp->GetSupportFiles().GetFileSpecAtIndex(1);
-  if (cu_file_spec) {
-(FileSpec &)(*cu_sp) = cu_file_spec;
-// Also fix the invalid file spec which was copied from the
-// compile unit.
-cu_sp->GetSupportFiles().Replace(0, cu_file_spec);
-  }
-}
-
 dwarf_cu->SetUserData(cu_sp.get());
 
 m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -689,19 +689,6 @@
 module_sp, dwarf_cu, cu_file_spec, dwarf_cu->GetID(),
 cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo);
 
-// If we just created a compile unit with an invalid file spec,
-// try and get the first entry in the supports files from the
-// line table as that should be the compile unit.
-if (!cu_file_spec) {
-  cu_file_spec = cu_sp->GetSupportFiles().GetFileSpecAtIndex(1);
-  if (cu_file_spec) {
-(FileSpec &)(*cu_sp) = cu_file_spec;
-// Also fix the invalid file spec which was copied from the
-// compile unit.
-cu_sp->GetSupportFiles().Replace(0, cu_file_spec);
-  }
-}
-
 dwarf_cu->SetUserData(cu_sp.get());
 
 m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62472: [CMake] LLDB.framework tools handling

2019-05-29 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361946: [CMake] LLDB.framework tools handling (authored by 
stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62472?vs=201859&id=201861#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62472

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/cmake/modules/LLDBConfig.cmake
  lldb/trunk/cmake/modules/LLDBFramework.cmake
  lldb/trunk/tools/argdumper/CMakeLists.txt
  lldb/trunk/tools/darwin-debug/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/CMakeLists.txt
  lldb/trunk/tools/driver/CMakeLists.txt
  lldb/trunk/tools/lldb-mi/CMakeLists.txt
  lldb/trunk/tools/lldb-server/CMakeLists.txt
  lldb/trunk/tools/lldb-vscode/CMakeLists.txt

Index: lldb/trunk/tools/lldb-mi/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt
@@ -95,5 +95,15 @@
   )
 
 if(LLDB_BUILD_FRAMEWORK)
-  lldb_setup_framework_rpaths_in_tool(lldb-mi)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  lldb_setup_rpaths(lldb-mi
+BUILD_RPATH
+  "${framework_build_dir}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
 endif()
Index: lldb/trunk/tools/lldb-vscode/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-vscode/CMakeLists.txt
+++ lldb/trunk/tools/lldb-vscode/CMakeLists.txt
@@ -31,5 +31,15 @@
   )
 
 if(LLDB_BUILD_FRAMEWORK)
-  lldb_setup_framework_rpaths_in_tool(lldb-vscode)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  lldb_setup_rpaths(lldb-vscode
+BUILD_RPATH
+  "${framework_build_dir}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
 endif()
Index: lldb/trunk/tools/debugserver/source/CMakeLists.txt
===
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt
@@ -265,6 +265,10 @@
   ${entitlements}
 )
 
+  if(LLDB_BUILD_FRAMEWORK)
+lldb_add_to_framework(debugserver)
+  endif()
+
   if(IOS)
 set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS
   WITH_LOCKDOWN
Index: lldb/trunk/tools/driver/CMakeLists.txt
===
--- lldb/trunk/tools/driver/CMakeLists.txt
+++ lldb/trunk/tools/driver/CMakeLists.txt
@@ -31,5 +31,15 @@
 set_target_properties(LLDBOptionsTableGen PROPERTIES FOLDER "lldb misc")
 
 if(LLDB_BUILD_FRAMEWORK)
-  lldb_setup_framework_rpaths_in_tool(lldb)
+  # In the build-tree, we know the exact path to the framework directory.
+  # The installed framework can be in different locations.
+  get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+  lldb_setup_rpaths(lldb
+BUILD_RPATH
+  "${framework_build_dir}"
+INSTALL_RPATH
+  "@loader_path/../../../SharedFrameworks"
+  "@loader_path/../../System/Library/PrivateFrameworks"
+  "@loader_path/../../Library/PrivateFrameworks"
+  )
 endif()
Index: lldb/trunk/tools/darwin-debug/CMakeLists.txt
===
--- lldb/trunk/tools/darwin-debug/CMakeLists.txt
+++ lldb/trunk/tools/darwin-debug/CMakeLists.txt
@@ -1,3 +1,7 @@
 add_lldb_tool(darwin-debug
   darwin-debug.cpp
   )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_add_to_framework(darwin-debug)
+endif()
Index: lldb/trunk/tools/argdumper/CMakeLists.txt
===
--- lldb/trunk/tools/argdumper/CMakeLists.txt
+++ lldb/trunk/tools/argdumper/CMakeLists.txt
@@ -4,3 +4,7 @@
   LINK_LIBS
 lldbUtility
   )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_add_to_framework(lldb-argdumper)
+endif()
Index: lldb/trunk/tools/lldb-server/CMakeLists.txt
===
--- lldb/trunk/tools/lldb-server/CMakeLists.txt
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt
@@ -77,3 +77,7 @@
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_add_to_framework(lldb-server)
+endif()
Index: lldb/trunk/cmake/modules/AddLLD

[Lldb-commits] [PATCH] D62547: (lldb-vscode) Evaluate expressions as LLDB commands when in REPL mode.

2019-05-29 Thread Ivan Hernandez via Phabricator via lldb-commits
ivanhernandez13 added a comment.

clayborg - I see the issue that this change would introduce and I’m not certain 
of a solution. Also, I’m not sure I understand what we get from keeping track 
of the selected thread. Isn’t the issue that the behavior is dependent on what 
thread is selected, and whether a variable exists in that thread?  
e.g.
Thread #1
Foo: “Foo”

Thread #2
 Bar: “Bar”

- Break at BP in Thread #1 *

> Foo
> “Foo”

- Select Thread #2 *

> Foo
> (lldb) Foo
> error: ‘Foo’ is not a valid command.

lanza - One motivation behind this was to support completions (see: 
https://github.com/ivanhernandez13/swift-lldb/commit/3311eef0afcf11d3426ff1d9e153e1641fd312b3)
 although I suppose it would be easy to hack support for that as well by simply 
checking for the “`” character and using only the rest of the string for 
completions.

I was not aware of that DAP feature request. I agree that a separate command 
and REPL console ultimately sounds like a better approach.

labath - As an Xcode user I was used to simply typing an lldb command, I made 
this change locally to better replicate Xcode’s behavior. I do however, see the 
issue with inconsistent behavior that this would introduce and I’m not certain 
there is a good solution for that.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62547



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


[Lldb-commits] [PATCH] D62547: (lldb-vscode) Evaluate expressions as LLDB commands when in REPL mode.

2019-05-29 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D62547#1520849 , @ivanhernandez13 
wrote:

> labath - As an Xcode user I was used to simply typing an lldb command, I made 
> this change locally to better replicate Xcode’s behavior. I do however, see 
> the issue with inconsistent behavior that this would introduce and I’m not 
> certain there is a good solution for that.


Yes, but Xcode doesn't (I guess, I don't really use xcode) allow you to type 
just a variable name to see the variable (you have to type "print var" or 
something), so there's no conflict there. That's why emulating Xcode might not 
be the best idea here...

It might be interesting to see what other vscode DAP backends do in this 
situation (if there are any to which we can compare to -- I also don't really 
use vscode, so I don't know :P ). It would be nice to be consistent with them 
at least...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62547



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


[Lldb-commits] [PATCH] D62547: (lldb-vscode) Evaluate expressions as LLDB commands when in REPL mode.

2019-05-29 Thread Ivan Hernandez via Phabricator via lldb-commits
ivanhernandez13 added a comment.

Yep you're right, Xcode doesn't have that capability.

Unfortunately there is no standard way of doing this. Lanza filed a feature 
request to add a standard way to the DAP. Also looks like he looked into how 
other extensions do this:

> vscode-cpptools - Prefix the command with -exec e.g. -exec target list
>  vscode-lldb - The specs is actually ignored and evaluate actually evaluated 
> the lldb command. You must prefix your Debug Console command with ? in order 
> to get the spec's evaluation requirements.
>  lldb-vscode - Prefix the command with a backtick. 'target list.
>  code-debug - Same as vscode-lldb, ignores the spec and provides the debugger 
> command prompt instead.

(copied from the DAP feature request thread)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62547



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


[Lldb-commits] [lldb] r361962 - Clean up DWARFDebugInfoEntry

2019-05-29 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Wed May 29 07:36:11 2019
New Revision: 361962

URL: http://llvm.org/viewvc/llvm-project?rev=361962&view=rev
Log:
Clean up DWARFDebugInfoEntry

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=361962&r1=361961&r2=361962&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed May 
29 07:36:11 2019
@@ -1074,13 +1074,6 @@ void DWARFDebugInfoEntry::BuildFunctionA
   }
 }
 
-std::vector
-DWARFDebugInfoEntry::GetDeclContextDIEs(DWARFUnit *cu) const {
-
-  DWARFDIE die(cu, const_cast(this));
-  return die.GetDeclContextDIEs();
-}
-
 void DWARFDebugInfoEntry::GetDWARFDeclContext(
 DWARFUnit *cu, DWARFDeclContext &dwarf_decl_ctx) const {
   const dw_tag_t tag = Tag();
@@ -1096,14 +1089,6 @@ void DWARFDebugInfoEntry::GetDWARFDeclCo
   }
 }
 
-bool DWARFDebugInfoEntry::MatchesDWARFDeclContext(
-DWARFUnit *cu, const DWARFDeclContext &dwarf_decl_ctx) const {
-
-  DWARFDeclContext this_dwarf_decl_ctx;
-  GetDWARFDeclContext(cu, this_dwarf_decl_ctx);
-  return this_dwarf_decl_ctx == dwarf_decl_ctx;
-}
-
 DWARFDIE
 DWARFDebugInfoEntry::GetParentDeclContextDIE(DWARFUnit *cu) const {
   DWARFAttributes attributes;
@@ -1214,7 +1199,6 @@ DWARFDebugInfoEntry::GetQualifiedName(DW
   return storage.c_str();
 }
 
-// LookupAddress
 bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
 const DWARFUnit *cu,
 DWARFDebugInfoEntry **function_die,
@@ -1232,13 +1216,9 @@ bool DWARFDebugInfoEntry::LookupAddress(
   check_children = true;
   break;
 case DW_TAG_entry_point:
-  break;
 case DW_TAG_enumeration_type:
-  break;
 case DW_TAG_formal_parameter:
-  break;
 case DW_TAG_imported_declaration:
-  break;
 case DW_TAG_label:
   break;
 case DW_TAG_lexical_block:
@@ -1246,9 +1226,7 @@ bool DWARFDebugInfoEntry::LookupAddress(
   match_addr_range = true;
   break;
 case DW_TAG_member:
-  break;
 case DW_TAG_pointer_type:
-  break;
 case DW_TAG_reference_type:
   break;
 case DW_TAG_compile_unit:
@@ -1260,20 +1238,15 @@ bool DWARFDebugInfoEntry::LookupAddress(
   check_children = true;
   break;
 case DW_TAG_subroutine_type:
-  break;
 case DW_TAG_typedef:
-  break;
 case DW_TAG_union_type:
-  break;
 case DW_TAG_unspecified_parameters:
-  break;
 case DW_TAG_variant:
   break;
 case DW_TAG_common_block:
   check_children = true;
   break;
 case DW_TAG_common_inclusion:
-  break;
 case DW_TAG_inheritance:
   break;
 case DW_TAG_inlined_subroutine:
@@ -1284,76 +1257,53 @@ bool DWARFDebugInfoEntry::LookupAddress(
   match_addr_range = true;
   break;
 case DW_TAG_ptr_to_member_type:
-  break;
 case DW_TAG_set_type:
-  break;
 case DW_TAG_subrange_type:
-  break;
 case DW_TAG_with_stmt:
-  break;
 case DW_TAG_access_declaration:
-  break;
 case DW_TAG_base_type:
   break;
 case DW_TAG_catch_block:
   match_addr_range = true;
   break;
 case DW_TAG_const_type:
-  break;
 case DW_TAG_constant:
-  break;
 case DW_TAG_enumerator:
-  break;
 case DW_TAG_file_type:
-  break;
 case DW_TAG_friend:
-  break;
 case DW_TAG_namelist:
-  break;
 case DW_TAG_namelist_item:
-  break;
 case DW_TAG_packed_type:
   break;
 case DW_TAG_subprogram:
   match_addr_range = true;
   break;
 case DW_TAG_template_type_parameter:
-  break;
 case DW_TAG_template_value_parameter:
-  break;
 case DW_TAG_GNU_template_parameter_pack:
-  break;
 case DW_TAG_thrown_type:
   break;
 case DW_TAG_try_block:
   match_addr_range = true;
   break;
 case DW_TAG_variant_part:
-  break;
 case DW_TAG_variable:
-  break;
 case DW_TAG_volatile_type:
-  break;
 case DW_TAG_dwarf_procedure:
-  break;
 case DW_TAG_restrict_type:
-  break;
 case DW_TAG_interface_type:
   break;
 case DW_TAG_namespace:
   check_children = true;
   break;
 case DW_TAG_imported_module:
-  break;
 case DW_TAG_unspecified_type:
   break;
 case DW_TAG_partial_unit:
   match_addr_range = true;
   break;
 case DW_TAG_imported_unit:
-  break;
 case DW_TAG_shared_type:
-  break;
 default:
   break;
 }
@@ -1485,11 +1435,6 @@ DWARFDebugInfoEntry::GetAbbreviationDec

[Lldb-commits] [PATCH] D62221: [lldb-server][LLGS] Support 'g' packets

2019-05-29 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

In D62221#1520586 , @labath wrote:

> BTW, do you have commit access, or you need someone to commit this for you?


I do not, I would need someone to help me commit that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62221



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


[Lldb-commits] [PATCH] D62562: [Target] Introduce Process::GetLanguageRuntimes

2019-05-29 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 201959.
xiaobai added a comment.

Address review feedback


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

https://reviews.llvm.org/D62562

Files:
  include/lldb/Target/Language.h
  include/lldb/Target/Process.h
  source/Target/Language.cpp
  source/Target/Process.cpp
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2211,11 +2211,9 @@
 
   // NOTE: Even though this behavior is generalized, only ObjC is actually
   // supported at the moment.
-  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) {
-if (auto runtime = GetProcess()->GetLanguageRuntime(
-static_cast(lang)))
-  if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
-return e;
+  for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
+if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+  return e;
   }
 
   return ValueObjectSP();
@@ -2228,11 +2226,9 @@
 
   // NOTE: Even though this behavior is generalized, only ObjC is actually
   // supported at the moment.
-  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) {
-if (auto runtime = GetProcess()->GetLanguageRuntime(
-static_cast(lang)))
-  if (auto bt = runtime->GetBacktraceThreadFromException(exception))
-return bt;
+  for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
+if (auto bt = runtime->GetBacktraceThreadFromException(exception))
+  return bt;
   }
 
   return ThreadSP();
Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -44,6 +44,7 @@
 #include "lldb/Target/InstrumentationRuntime.h"
 #include "lldb/Target/JITLoader.h"
 #include "lldb/Target/JITLoaderList.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/MemoryHistory.h"
 #include "lldb/Target/MemoryRegionInfo.h"
@@ -1547,6 +1548,27 @@
   return m_abi_sp;
 }
 
+std::vector
+Process::GetLanguageRuntimes(bool retry_if_null) {
+  std::vector language_runtimes;
+
+  if (m_finalizing)
+return language_runtimes;
+
+  std::lock_guard guard(m_language_runtimes_mutex);
+  // Before we pass off a copy of the language runtimes, we must make sure that
+  // our collection is properly populated. It's possible that some of the
+  // language runtimes were not loaded yet, either because nobody requested it
+  // yet or the proper condition for loading wasn't yet met (e.g. libc++.so
+  // hadn't been loaded).
+  for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) {
+if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type, retry_if_null))
+  language_runtimes.emplace_back(runtime);
+  }
+
+  return language_runtimes;
+}
+
 LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language,
  bool retry_if_null) {
   if (m_finalizing)
Index: source/Target/Language.cpp
===
--- source/Target/Language.cpp
+++ source/Target/Language.cpp
@@ -348,6 +348,15 @@
   }
 }
 
+std::set Language::GetSupportedLanguages() {
+  std::set supported_languages;
+  ForEach([&](Language *lang) {
+supported_languages.emplace(lang->GetLanguageType());
+return true;
+  });
+  return supported_languages;
+}
+
 void Language::GetLanguagesSupportingTypeSystems(
 std::set &languages,
 std::set &languages_for_expressions) {
Index: include/lldb/Target/Process.h
===
--- include/lldb/Target/Process.h
+++ include/lldb/Target/Process.h
@@ -2178,6 +2178,9 @@
 
   OperatingSystem *GetOperatingSystem() { return m_os_up.get(); }
 
+  std::vector
+  GetLanguageRuntimes(bool retry_if_null = true);
+
   LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
   bool retry_if_null = true);
 
Index: include/lldb/Target/Language.h
===
--- include/lldb/Target/Language.h
+++ include/lldb/Target/Language.h
@@ -264,6 +264,8 @@
   // etc.
   static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language);
 
+  static std::set GetSupportedLanguages();
+
   static void GetLanguagesSupportingTypeSystems(
   std::set &languages,
   std::set &languages_for_expressions);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61235: Add more information to the log timer dump

2019-05-29 Thread António Afonso via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL361987: Add more information to the log timer dump (authored 
by aadsm, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61235?vs=201349&id=201963#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61235

Files:
  lldb/trunk/include/lldb/Utility/Timer.h
  lldb/trunk/source/Utility/Timer.cpp
  lldb/trunk/unittests/Utility/TimerTest.cpp

Index: lldb/trunk/include/lldb/Utility/Timer.h
===
--- lldb/trunk/include/lldb/Utility/Timer.h
+++ lldb/trunk/include/lldb/Utility/Timer.h
@@ -30,6 +30,8 @@
 friend class Timer;
 const char *m_name;
 std::atomic m_nanos;
+std::atomic m_nanos_total;
+std::atomic m_count;
 std::atomic m_next;
 
 DISALLOW_COPY_AND_ASSIGN(Category);
Index: lldb/trunk/unittests/Utility/TimerTest.cpp
===
--- lldb/trunk/unittests/Utility/TimerTest.cpp
+++ lldb/trunk/unittests/Utility/TimerTest.cpp
@@ -61,7 +61,9 @@
   StreamString ss;
   Timer::DumpCategoryTimes(&ss);
   double seconds1, seconds2;
-  ASSERT_EQ(2, sscanf(ss.GetData(), "%lf sec for CAT1%*[\n ]%lf sec for CAT2",
+  ASSERT_EQ(2, sscanf(ss.GetData(),
+  "%lf sec (total: %*lfs; child: %*lfs; count: %*d) for "
+  "CAT1%*[\n ]%lf sec for CAT2",
   &seconds1, &seconds2))
   << "String: " << ss.GetData();
   EXPECT_LT(0.01, seconds1);
@@ -69,3 +71,38 @@
   EXPECT_LT(0.001, seconds2);
   EXPECT_GT(0.1, seconds2);
 }
+
+TEST(TimerTest, CategoryTimesStats) {
+  Timer::ResetCategoryTimes();
+  {
+static Timer::Category tcat1("CAT1");
+Timer t1(tcat1, ".");
+std::this_thread::sleep_for(std::chrono::milliseconds(100));
+static Timer::Category tcat2("CAT2");
+{
+  Timer t2(tcat2, ".");
+  std::this_thread::sleep_for(std::chrono::milliseconds(10));
+}
+{
+  Timer t3(tcat2, ".");
+  std::this_thread::sleep_for(std::chrono::milliseconds(10));
+}
+  }
+  // Example output:
+  // 0.105202764 sec (total: 0.132s; child: 0.027s; count: 1) for CAT1
+  // 0.026772798 sec (total: 0.027s; child: 0.000s; count: 2) for CAT2
+  StreamString ss;
+  Timer::DumpCategoryTimes(&ss);
+  double seconds1, total1, child1, seconds2;
+  int count1, count2;
+  ASSERT_EQ(
+  6, sscanf(ss.GetData(),
+"%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n ]"
+"%lf sec (total: %*lfs; child: %*lfs; count: %d) for CAT2",
+&seconds1, &total1, &child1, &count1, &seconds2, &count2))
+  << "String: " << ss.GetData();
+  EXPECT_NEAR(total1 - child1, seconds1, 0.002);
+  EXPECT_EQ(1, count1);
+  EXPECT_NEAR(child1, seconds2, 0.002);
+  EXPECT_EQ(2, count2);
+}
Index: lldb/trunk/source/Utility/Timer.cpp
===
--- lldb/trunk/source/Utility/Timer.cpp
+++ lldb/trunk/source/Utility/Timer.cpp
@@ -41,6 +41,8 @@
 
 Timer::Category::Category(const char *cat) : m_name(cat) {
   m_nanos.store(0, std::memory_order_release);
+  m_nanos_total.store(0, std::memory_order_release);
+  m_count.store(0, std::memory_order_release);
   Category *expected = g_categories;
   do {
 m_next = expected;
@@ -93,6 +95,8 @@
 
   // Keep total results for each category so we can dump results.
   m_category.m_nanos += std::chrono::nanoseconds(timer_dur).count();
+  m_category.m_nanos_total += std::chrono::nanoseconds(total_dur).count();
+  m_category.m_count++;
 }
 
 void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; }
@@ -100,25 +104,38 @@
 /* binary function predicate:
  * - returns whether a person is less than another person
  */
-
-typedef std::pair TimerEntry;
-
-static bool CategoryMapIteratorSortCriterion(const TimerEntry &lhs,
- const TimerEntry &rhs) {
-  return lhs.second > rhs.second;
+namespace {
+struct Stats {
+  const char *name;
+  uint64_t nanos;
+  uint64_t nanos_total;
+  uint64_t count;
+};
+} // namespace
+
+static bool CategoryMapIteratorSortCriterion(const Stats &lhs,
+ const Stats &rhs) {
+  return lhs.nanos > rhs.nanos;
 }
 
 void Timer::ResetCategoryTimes() {
-  for (Category *i = g_categories; i; i = i->m_next)
+  for (Category *i = g_categories; i; i = i->m_next) {
 i->m_nanos.store(0, std::memory_order_release);
+i->m_nanos_total.store(0, std::memory_order_release);
+i->m_count.store(0, std::memory_order_release);
+  }
 }
 
 void Timer::DumpCategoryTimes(Stream *s) {
-  std::vector sorted;
+  std::vector sorted;
   for (Category *i = g_categories; i; i

[Lldb-commits] [lldb] r361995 - Fixed source header [NFC]

2019-05-29 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed May 29 10:25:03 2019
New Revision: 361995

URL: http://llvm.org/viewvc/llvm-project?rev=361995&view=rev
Log:
Fixed source header [NFC]


Modified:
lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Modified: lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp?rev=361995&r1=361994&r2=361995&view=diff
==
--- lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp (original)
+++ lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp Wed May 29 
10:25:03 2019
@@ -1,4 +1,4 @@
-//===-- PythonDataObjectsTests.cpp --*- C++ 
-*-===//
+//===-- SymbolFileDWARFTests.cpp *- C++ 
-*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.


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


[Lldb-commits] [PATCH] D62472: [CMake] LLDB.framework tools handling

2019-05-29 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The typical trick for doing argument substitution before debugging was roughly 
to debug:

exec /bin/sh executable arg1 arg2 ...

then follow through the shell to the executable.  That failed when SIP made it 
impossible to debug any of the shells, so we had to come up with another way to 
do shell expansion.  That's what argdumper does.  We run that under the user's 
shell and it just dumps the args array in a structured output so we can launch 
directly with those expanded arguments.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62472



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


[Lldb-commits] [PATCH] D62562: [Target] Introduce Process::GetLanguageRuntimes

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

LGTM


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

https://reviews.llvm.org/D62562



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


[Lldb-commits] [lldb] r361999 - [Target] Introduce Process::GetLanguageRuntimes

2019-05-29 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Wed May 29 11:08:22 2019
New Revision: 361999

URL: http://llvm.org/viewvc/llvm-project?rev=361999&view=rev
Log:
[Target] Introduce Process::GetLanguageRuntimes

Summary:
Currently there's not really a good way to iterate over the language runtimes a
process has. This is sometimes desirable (as seen in my change to Thread).
Additionally, there's not really a good reason to iterate over every available
language, but rather only over languages for which we have a plugin loaded.

Reviewers: JDevlieghere, davide, jingham

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Language.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=361999&r1=361998&r2=361999&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Wed May 29 11:08:22 2019
@@ -264,6 +264,8 @@ public:
   // etc.
   static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language);
 
+  static std::set GetSupportedLanguages();
+
   static void GetLanguagesSupportingTypeSystems(
   std::set &languages,
   std::set &languages_for_expressions);

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=361999&r1=361998&r2=361999&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Wed May 29 11:08:22 2019
@@ -2178,6 +2178,9 @@ public:
 
   OperatingSystem *GetOperatingSystem() { return m_os_up.get(); }
 
+  std::vector
+  GetLanguageRuntimes(bool retry_if_null = true);
+
   LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
   bool retry_if_null = true);
 

Modified: lldb/trunk/source/Target/Language.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=361999&r1=361998&r2=361999&view=diff
==
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Wed May 29 11:08:22 2019
@@ -348,6 +348,15 @@ LanguageType Language::GetPrimaryLanguag
   }
 }
 
+std::set Language::GetSupportedLanguages() {
+  std::set supported_languages;
+  ForEach([&](Language *lang) {
+supported_languages.emplace(lang->GetLanguageType());
+return true;
+  });
+  return supported_languages;
+}
+
 void Language::GetLanguagesSupportingTypeSystems(
 std::set &languages,
 std::set &languages_for_expressions) {

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=361999&r1=361998&r2=361999&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed May 29 11:08:22 2019
@@ -44,6 +44,7 @@
 #include "lldb/Target/InstrumentationRuntime.h"
 #include "lldb/Target/JITLoader.h"
 #include "lldb/Target/JITLoaderList.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/MemoryHistory.h"
 #include "lldb/Target/MemoryRegionInfo.h"
@@ -1547,6 +1548,27 @@ const lldb::ABISP &Process::GetABI() {
   return m_abi_sp;
 }
 
+std::vector
+Process::GetLanguageRuntimes(bool retry_if_null) {
+  std::vector language_runtimes;
+
+  if (m_finalizing)
+return language_runtimes;
+
+  std::lock_guard guard(m_language_runtimes_mutex);
+  // Before we pass off a copy of the language runtimes, we must make sure that
+  // our collection is properly populated. It's possible that some of the
+  // language runtimes were not loaded yet, either because nobody requested it
+  // yet or the proper condition for loading wasn't yet met (e.g. libc++.so
+  // hadn't been loaded).
+  for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) 
{
+if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type, 
retry_if_null))
+  language_runtimes.emplace_back(runtime);
+  }
+
+  return language_runtimes;
+}
+
 LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language,
  bool retry_if_null) {
   if (m_finalizing)

Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=361999&r1=361998&r2=361999&view=diff
==
--- lldb/trunk/source/Tar

[Lldb-commits] [PATCH] D62562: [Target] Introduce Process::GetLanguageRuntimes

2019-05-29 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361999: [Target] Introduce Process::GetLanguageRuntimes 
(authored by xiaobai, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D62562?vs=201959&id=201993#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62562

Files:
  include/lldb/Target/Language.h
  include/lldb/Target/Process.h
  source/Target/Language.cpp
  source/Target/Process.cpp
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2211,11 +2211,9 @@
 
   // NOTE: Even though this behavior is generalized, only ObjC is actually
   // supported at the moment.
-  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) {
-if (auto runtime = GetProcess()->GetLanguageRuntime(
-static_cast(lang)))
-  if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
-return e;
+  for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
+if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+  return e;
   }
 
   return ValueObjectSP();
@@ -2228,11 +2226,9 @@
 
   // NOTE: Even though this behavior is generalized, only ObjC is actually
   // supported at the moment.
-  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) {
-if (auto runtime = GetProcess()->GetLanguageRuntime(
-static_cast(lang)))
-  if (auto bt = runtime->GetBacktraceThreadFromException(exception))
-return bt;
+  for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) {
+if (auto bt = runtime->GetBacktraceThreadFromException(exception))
+  return bt;
   }
 
   return ThreadSP();
Index: source/Target/Language.cpp
===
--- source/Target/Language.cpp
+++ source/Target/Language.cpp
@@ -348,6 +348,15 @@
   }
 }
 
+std::set Language::GetSupportedLanguages() {
+  std::set supported_languages;
+  ForEach([&](Language *lang) {
+supported_languages.emplace(lang->GetLanguageType());
+return true;
+  });
+  return supported_languages;
+}
+
 void Language::GetLanguagesSupportingTypeSystems(
 std::set &languages,
 std::set &languages_for_expressions) {
Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -44,6 +44,7 @@
 #include "lldb/Target/InstrumentationRuntime.h"
 #include "lldb/Target/JITLoader.h"
 #include "lldb/Target/JITLoaderList.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/MemoryHistory.h"
 #include "lldb/Target/MemoryRegionInfo.h"
@@ -1547,6 +1548,27 @@
   return m_abi_sp;
 }
 
+std::vector
+Process::GetLanguageRuntimes(bool retry_if_null) {
+  std::vector language_runtimes;
+
+  if (m_finalizing)
+return language_runtimes;
+
+  std::lock_guard guard(m_language_runtimes_mutex);
+  // Before we pass off a copy of the language runtimes, we must make sure that
+  // our collection is properly populated. It's possible that some of the
+  // language runtimes were not loaded yet, either because nobody requested it
+  // yet or the proper condition for loading wasn't yet met (e.g. libc++.so
+  // hadn't been loaded).
+  for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) {
+if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type, retry_if_null))
+  language_runtimes.emplace_back(runtime);
+  }
+
+  return language_runtimes;
+}
+
 LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language,
  bool retry_if_null) {
   if (m_finalizing)
Index: include/lldb/Target/Language.h
===
--- include/lldb/Target/Language.h
+++ include/lldb/Target/Language.h
@@ -264,6 +264,8 @@
   // etc.
   static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language);
 
+  static std::set GetSupportedLanguages();
+
   static void GetLanguagesSupportingTypeSystems(
   std::set &languages,
   std::set &languages_for_expressions);
Index: include/lldb/Target/Process.h
===
--- include/lldb/Target/Process.h
+++ include/lldb/Target/Process.h
@@ -2178,6 +2178,9 @@
 
   OperatingSystem *GetOperatingSystem() { return m_os_up.get(); }
 
+  std::vector
+  GetLanguageRuntimes(bool retry_if_null = true);
+
   LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
   bool retry_if_null = true);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http

[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-29 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 202013.
xiaobai added a comment.

Update to reflect the recently added method Process::GetLanguageRuntimes


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

https://reviews.llvm.org/D61921

Files:
  include/lldb/Target/CPPLanguageRuntime.h
  include/lldb/Target/LanguageRuntime.h
  include/lldb/Target/ObjCLanguageRuntime.h
  source/Target/ThreadPlanStepThrough.cpp


Index: source/Target/ThreadPlanStepThrough.cpp
===
--- source/Target/ThreadPlanStepThrough.cpp
+++ source/Target/ThreadPlanStepThrough.cpp
@@ -8,9 +8,8 @@
 
 #include "lldb/Target/ThreadPlanStepThrough.h"
 #include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/DynamicLoader.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
@@ -85,22 +84,17 @@
 m_sub_plan_sp =
 loader->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
 
-  // If that didn't come up with anything, try the ObjC runtime plugin:
-  if (!m_sub_plan_sp.get()) {
-ObjCLanguageRuntime *objc_runtime =
-m_thread.GetProcess()->GetObjCLanguageRuntime();
-if (objc_runtime)
+  // If the DynamicLoader was unable to provide us with a ThreadPlan, then we
+  // try the LanguageRuntimes.
+  if (!m_sub_plan_sp) {
+for (LanguageRuntime *runtime :
+ m_thread.GetProcess()->GetLanguageRuntimes()) {
   m_sub_plan_sp =
-  objc_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
-
-CPPLanguageRuntime *cpp_runtime =
-m_thread.GetProcess()->GetCPPLanguageRuntime();
+  runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
 
-// If the ObjC runtime did not provide us with a step though plan then if 
we
-// have it check the C++ runtime for a step though plan.
-if (!m_sub_plan_sp.get() && cpp_runtime)
-  m_sub_plan_sp =
-  cpp_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  if (m_sub_plan_sp)
+break;
+}
   }
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Index: include/lldb/Target/ObjCLanguageRuntime.h
===
--- include/lldb/Target/ObjCLanguageRuntime.h
+++ include/lldb/Target/ObjCLanguageRuntime.h
@@ -216,9 +216,6 @@
 
   virtual bool HasReadObjCLibrary() = 0;
 
-  virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
-  bool stop_others) = 
0;
-
   lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel);
 
   void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel,
Index: include/lldb/Target/LanguageRuntime.h
===
--- include/lldb/Target/LanguageRuntime.h
+++ include/lldb/Target/LanguageRuntime.h
@@ -143,6 +143,9 @@
 return false;
   }
 
+  virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+  bool stop_others) = 
0;
+
   /// Identify whether a value is a language implementation detaul
   /// that should be hidden from the user interface by default.
   virtual bool IsRuntimeSupportValue(ValueObject &valobj) { return false; }
Index: include/lldb/Target/CPPLanguageRuntime.h
===
--- include/lldb/Target/CPPLanguageRuntime.h
+++ include/lldb/Target/CPPLanguageRuntime.h
@@ -61,7 +61,7 @@
   /// \return
   ///  A ThreadPlan Shared pointer
   lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
-  bool stop_others);
+  bool stop_others) override;
 
   bool IsRuntimeSupportValue(ValueObject &valobj) override;
 protected:


Index: source/Target/ThreadPlanStepThrough.cpp
===
--- source/Target/ThreadPlanStepThrough.cpp
+++ source/Target/ThreadPlanStepThrough.cpp
@@ -8,9 +8,8 @@
 
 #include "lldb/Target/ThreadPlanStepThrough.h"
 #include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/DynamicLoader.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
@@ -85,22 +84,17 @@
 m_sub_plan_sp =
 loader->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
 
-  // If that didn't come up with anything, try the ObjC runtime plugin:
-  if (!m_sub_plan_sp.get()) {
-ObjCLanguageRuntime *objc_runtime =
-m_thread.GetProcess()->GetObjCLanguageRuntime();
-if (objc_runtime)
+  // If t

[Lldb-commits] [PATCH] D62499: Create a generic handler for Xfer packets

2019-05-29 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In D62499#1520654 , @labath wrote:

> In D62499#1520610 , @krytarowski 
> wrote:
>
> > > One time just before it's loaded (so lldb can check which modules are 
> > > loaded) and another right after it's loaded (so lldb can check again 
> > > which ones are loaded and calculate the difference).
> >
> > There is on NetBSD and on a selection of other OSs: `_rtld_debug_state` 
> > integrated as a part of ELF dynamic loader.
> >
> > Is there something like that on Android that could be reused?
>
>
> Yes, there is, and it's being used now. The question here is what do we do 
> *after* we hit the dynamic loader breakpoint...


First I will need to make research of it locally as it was probably not used in 
some time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62499



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


[Lldb-commits] [PATCH] D62626: Remove length modifier when using assignment suppression in TimerTest

2019-05-29 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62626



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


[Lldb-commits] [PATCH] D62626: Remove length modifier when using assignment suppression in TimerTest

2019-05-29 Thread António Afonso via Phabricator via lldb-commits
aadsm created this revision.
aadsm added a reviewer: xiaobai.
Herald added subscribers: lldb-commits, krytarowski.
Herald added a project: LLDB.
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

lgtm


This is useless and it's giving warnings in the build bots:
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/unittests/Utility/TimerTest.cpp:67:43:
 warning: use of assignment suppression and length modifier together in 
gnu_scanf format [-Wformat=]


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62626

Files:
  lldb/unittests/Utility/TimerTest.cpp


Index: lldb/unittests/Utility/TimerTest.cpp
===
--- lldb/unittests/Utility/TimerTest.cpp
+++ lldb/unittests/Utility/TimerTest.cpp
@@ -62,7 +62,7 @@
   Timer::DumpCategoryTimes(&ss);
   double seconds1, seconds2;
   ASSERT_EQ(2, sscanf(ss.GetData(),
-  "%lf sec (total: %*lfs; child: %*lfs; count: %*d) for "
+  "%lf sec (total: %*fs; child: %*fs; count: %*d) for "
   "CAT1%*[\n ]%lf sec for CAT2",
   &seconds1, &seconds2))
   << "String: " << ss.GetData();
@@ -98,7 +98,7 @@
   ASSERT_EQ(
   6, sscanf(ss.GetData(),
 "%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n ]"
-"%lf sec (total: %*lfs; child: %*lfs; count: %d) for CAT2",
+"%lf sec (total: %*fs; child: %*fs; count: %d) for CAT2",
 &seconds1, &total1, &child1, &count1, &seconds2, &count2))
   << "String: " << ss.GetData();
   EXPECT_NEAR(total1 - child1, seconds1, 0.002);


Index: lldb/unittests/Utility/TimerTest.cpp
===
--- lldb/unittests/Utility/TimerTest.cpp
+++ lldb/unittests/Utility/TimerTest.cpp
@@ -62,7 +62,7 @@
   Timer::DumpCategoryTimes(&ss);
   double seconds1, seconds2;
   ASSERT_EQ(2, sscanf(ss.GetData(),
-  "%lf sec (total: %*lfs; child: %*lfs; count: %*d) for "
+  "%lf sec (total: %*fs; child: %*fs; count: %*d) for "
   "CAT1%*[\n ]%lf sec for CAT2",
   &seconds1, &seconds2))
   << "String: " << ss.GetData();
@@ -98,7 +98,7 @@
   ASSERT_EQ(
   6, sscanf(ss.GetData(),
 "%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n ]"
-"%lf sec (total: %*lfs; child: %*lfs; count: %d) for CAT2",
+"%lf sec (total: %*fs; child: %*fs; count: %d) for CAT2",
 &seconds1, &total1, &child1, &count1, &seconds2, &count2))
   << "String: " << ss.GetData();
   EXPECT_NEAR(total1 - child1, seconds1, 0.002);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r362032 - [Target] Sink some asserts into Process::GetLanguageRuntime

2019-05-29 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Wed May 29 14:07:53 2019
New Revision: 362032

URL: http://llvm.org/viewvc/llvm-project?rev=362032&view=rev
Log:
[Target] Sink some asserts into Process::GetLanguageRuntime

Modified:
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=362032&r1=362031&r2=362032&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed May 29 14:07:53 2019
@@ -1574,17 +1574,28 @@ LanguageRuntime *Process::GetLanguageRun
   if (m_finalizing)
 return nullptr;
 
+  LanguageRuntime *runtime = nullptr;
+
   std::lock_guard guard(m_language_runtimes_mutex);
   LanguageRuntimeCollection::iterator pos;
   pos = m_language_runtimes.find(language);
-  if (pos == m_language_runtimes.end() || (retry_if_null && !(*pos).second)) {
+  if (pos == m_language_runtimes.end() || (retry_if_null && !pos->second)) {
 lldb::LanguageRuntimeSP runtime_sp(
 LanguageRuntime::FindPlugin(this, language));
 
 m_language_runtimes[language] = runtime_sp;
-return runtime_sp.get();
+runtime = runtime_sp.get();
   } else
-return (*pos).second.get();
+runtime = pos->second.get();
+
+  if (runtime)
+// It's possible that a language runtime can support multiple 
LanguageTypes,
+// for example, CPPLanguageRuntime will support eLanguageTypeC_plus_plus,
+// eLanguageTypeC_plus_plus_03, etc. Because of this, we should get the
+// primary language type and make sure that our runtime supports it.
+assert(runtime->GetLanguageType() == 
Language::GetPrimaryLanguage(language));
+
+  return runtime;
 }
 
 CPPLanguageRuntime *Process::GetCPPLanguageRuntime(bool retry_if_null) {
@@ -1594,7 +1605,6 @@ CPPLanguageRuntime *Process::GetCPPLangu
   if (!runtime)
 return nullptr;
 
-  assert(runtime->GetLanguageType() == eLanguageTypeC_plus_plus);
   return static_cast(runtime);
 }
 
@@ -1605,7 +1615,6 @@ ObjCLanguageRuntime *Process::GetObjCLan
   if (!runtime)
 return nullptr;
 
-  assert(runtime->GetLanguageType() == eLanguageTypeObjC);
   return static_cast(runtime);
 }
 


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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-29 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

@jingham @JDevlieghere Mind giving this a quick look? I modified it to use the 
new method I added earlier and wanted to make sure there were no outstanding 
issues here.


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [lldb] r362033 - Fix Xcode project lldb unit test target so it compiles.

2019-05-29 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed May 29 14:22:54 2019
New Revision: 362033

URL: http://llvm.org/viewvc/llvm-project?rev=362033&view=rev
Log:
Fix Xcode project lldb unit test target so it compiles.


Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=362033&r1=362032&r2=362033&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed May 29 14:22:54 2019
@@ -900,6 +900,7 @@
26D7E45D13D5E30A007FD12B /* SocketAddress.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26D7E45C13D5E30A007FD12B /* SocketAddress.cpp 
*/; };
23CB15451D66DA9300EDDDE1 /* SocketAddressTest.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 2321F9391BDD332400BA9A93 /* 
SocketAddressTest.cpp */; };
23CB153B1D66DA9300EDDDE1 /* SocketTest.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 2321F93A1BDD332400BA9A93 /* SocketTest.cpp */; };
+   26FCE61C229F00F000D125BD /* SocketTestUtilities.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 26FCE61B229F00F000D125BD /* 
SocketTestUtilities.cpp */; };
26603879211CA90F00329572 /* SourceBreakpoint.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 26603870211CA90D00329572 /* 
SourceBreakpoint.cpp */; };
2689004C13353E0400698AC0 /* SourceManager.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E8F10F1B85900F91463 /* SourceManager.cpp 
*/; };
268900F313353E6F00698AC0 /* StackFrame.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26BC7F3810F1B90C00F91463 /* StackFrame.cpp */; };
@@ -2964,6 +2965,7 @@
26D7E45B13D5E2F9007FD12B /* SocketAddress.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SocketAddress.h; 
path = include/lldb/Host/SocketAddress.h; sourceTree = ""; };
2321F9391BDD332400BA9A93 /* SocketAddressTest.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
SocketAddressTest.cpp; sourceTree = ""; };
2321F93A1BDD332400BA9A93 /* SocketTest.cpp */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = 
SocketTest.cpp; sourceTree = ""; };
+   26FCE61B229F00F000D125BD /* SocketTestUtilities.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = SocketTestUtilities.cpp; sourceTree = ""; };
26603870211CA90D00329572 /* SourceBreakpoint.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SourceBreakpoint.cpp; path = "tools/lldb-vscode/SourceBreakpoint.cpp"; 
sourceTree = ""; };
2660386D211CA90C00329572 /* SourceBreakpoint.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SourceBreakpoint.h; path = "tools/lldb-vscode/SourceBreakpoint.h"; sourceTree = 
""; };
26BC7E8F10F1B85900F91463 /* SourceManager.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SourceManager.cpp; path = source/Core/SourceManager.cpp; sourceTree = 
""; };
@@ -3612,6 +3614,7 @@
2321F9381BDD332400BA9A93 /* CMakeLists.txt */,
2321F9391BDD332400BA9A93 /* 
SocketAddressTest.cpp */,
2321F93A1BDD332400BA9A93 /* SocketTest.cpp */,
+   26FCE61B229F00F000D125BD /* 
SocketTestUtilities.cpp */,
2321F9451BDD346100BA9A93 /* TaskPoolTest.cpp */,
);
path = Host;
@@ -7836,6 +7839,7 @@
23CB15411D66DA9300EDDDE1 /* 
StringExtractorTest.cpp in Sources */,
9A2057031F3A605200F6C293 /* VASprintfTest.cpp 
in Sources */,
4C639ED121FA684900A7B957 /* 
OptionsWithRawTest.cpp in Sources */,
+   26FCE61C229F00F000D125BD /* 
SocketTestUtilities.cpp in Sources */,
4C639ED321FA684900A7B957 /* EventTest.cpp in 
Sources */,
9A18903C1F47D5E600394BCA /* TestUtilities.cpp 
in Sources */,
4C639ECD21FA684900A7B957 /* StreamTest.cpp in 
Sources */,


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


[Lldb-commits] [PATCH] D62630: Fix a regression in DWARF access speed caused by svn revision 356190

2019-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: labath, JDevlieghere, zturner, aadsm.
Herald added a subscriber: aprantl.

The issue was caused by the error checking code that was added. It was 
incorrectly adding an extra abbreviation when DWARFEnumState::Complete was 
received since it would push an extra abbreviation onto the list with the 
abbreviation code of zero. This cause m_idx_offset to be set to UINT32_MAX and 
caused every DWARFDebugInfoEntry that would try to get its 
DWARFAbbreviationDeclaration from the CU's DWARFAbbreviationDeclarationSet to 
always linearly search the abbreviation set for a given abbreviation code. Easy 
to see why this would cause things to be slow.

This regression was caused by: https://reviews.llvm.org/D59370. I asked to 
ensure there was no regression is parsing or access speed, but that must not 
have been done. In my test with 40 DWARF files trying to set a breakpoint by 
function name and in a header file, I see a 8% speed improvement with this fix.

There was no regression in correctness, just very inefficient access.

Added full unit testing for DWARFAbbreviationDeclarationSet parsing to ensure 
this doesn't regress.


https://reviews.llvm.org/D62630

Files:
  source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
  unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp

Index: unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
===
--- unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
+++ unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
@@ -15,6 +15,9 @@
 #include "llvm/Support/Path.h"
 
 #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
+#include "Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDataExtractor.h"
+#include "Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h"
 #include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
 #include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
 #include "TestingSupport/TestUtilities.h"
@@ -28,8 +31,13 @@
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/SymbolVendor.h"
 #include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/DataEncoder.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/StreamString.h"
 
+
+
+using namespace lldb;
 using namespace lldb_private;
 
 class SymbolFileDWARFTests : public testing::Test {
@@ -76,3 +84,248 @@
   uint32_t expected_abilities = SymbolFile::kAllAbilities;
   EXPECT_EQ(expected_abilities, symfile->CalculateAbilities());
 }
+
+TEST_F(SymbolFileDWARFTests, TestAbbrevOrder1Start1) {
+  // Test that if we have a .debug_abbrev that contains ordered abbreviation
+  // codes that start at 1, that we get O(1) access.
+  
+  const auto byte_order = eByteOrderLittle;
+  const uint8_t addr_size = 4;
+  StreamString encoder(Stream::eBinary, addr_size, byte_order);
+  encoder.PutULEB128(1); // Abbrev code 1
+  encoder.PutULEB128(DW_TAG_compile_unit);
+  encoder.PutHex8(DW_CHILDREN_yes);
+  encoder.PutULEB128(DW_AT_name);
+  encoder.PutULEB128(DW_FORM_strp);
+  encoder.PutULEB128(0);
+  encoder.PutULEB128(0);
+  
+  encoder.PutULEB128(2); // Abbrev code 2
+  encoder.PutULEB128(DW_TAG_subprogram);
+  encoder.PutHex8(DW_CHILDREN_no);
+  encoder.PutULEB128(DW_AT_name);
+  encoder.PutULEB128(DW_FORM_strp);
+  encoder.PutULEB128(0);
+  encoder.PutULEB128(0);
+  
+  encoder.PutULEB128(0); // Abbrev code 0 (termination)
+ 
+  DWARFDataExtractor data;
+  data.SetData(encoder.GetData(), encoder.GetSize(), byte_order);
+  DWARFAbbreviationDeclarationSet abbrev_set;
+  lldb::offset_t data_offset = 0;
+  llvm::Error error = abbrev_set.extract(data, &data_offset);
+  EXPECT_FALSE(bool(error));
+  // Make sure we have O(1) access to each abbreviation by making sure the
+  // index offset is 1 and not UINT32_MAX
+  EXPECT_EQ(abbrev_set.GetIndexOffset(), 1);
+  
+  auto abbrev1 = abbrev_set.GetAbbreviationDeclaration(1);
+  EXPECT_EQ(abbrev1->Tag(), DW_TAG_compile_unit);
+  EXPECT_TRUE(abbrev1->HasChildren());
+  EXPECT_EQ(abbrev1->NumAttributes(), 1);
+  auto abbrev2 = abbrev_set.GetAbbreviationDeclaration(2);
+  EXPECT_EQ(abbrev2->Tag(), DW_TAG_subprogram);
+  EXPECT_FALSE(abbrev2->HasChildren());
+  EXPECT_EQ(abbrev2->NumAttributes(), 1);
+}
+
+TEST_F(SymbolFileDWARFTests, TestAbbrevOrder1Start5) {
+  // Test that if we have a .debug_abbrev that contains ordered abbreviation
+  // codes that start at 5, that we get O(1) access.
+  
+  const auto byte_order = eByteOrderLittle;
+  const uint8_t addr_size = 4;
+  StreamString encoder(Stream::eBinary, addr_size, byte_order);
+  encoder.PutULEB128(5); // Abbrev code 5
+  encoder.PutULEB128(DW_TAG_compile_unit);
+  encoder.PutHex8(DW_CHILDREN_yes);
+  encoder.PutULEB128(DW_AT_name);
+  encoder.PutULEB128(DW_FORM_strp);
+  encoder.PutULEB128(0);
+  encoder.PutULEB128(0);
+  
+  encoder.PutULEB128(6); // Abbrev code 6
+  encoder.PutULEB128(DW_TAG_subprogram);
+  encoder.PutHex8(

[Lldb-commits] [PATCH] D62570: [WIP] Use LLVM's debug line parser in LLDB

2019-05-29 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Very nice!




Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:874
+  data.GetByteOrder() == eByteOrderLittle, data.GetAddressByteSize());
+}
 

should this be a `getAsLLVM()` member function or even an `operator()`?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62570



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


[Lldb-commits] [PATCH] D62547: (lldb-vscode) Evaluate expressions as LLDB commands when in REPL mode.

2019-05-29 Thread Nathan Lanza via Phabricator via lldb-commits
lanza added a comment.

Yup, clayborg and I talked about the solution I discuss in that request. The 
hopeful eventual goal is for this communication:

- DAP host:  can you support attaching to a pty?
- lldb-vscode: yes
- DAP host: okay, use `/dev/pty123`
- lldb-vscode: `Debugger:RunCommandInterpreter(/dev/pty123)`

and then all of this nonsense goes away.

I do think, however, that it would be reasonable to swap the backtick usage for 
the current command prompt. e.g. `target list` in the `Debug Console` pane 
would run the lldb command `target list` and `'someVaraible` would instead 
evaluate the variable. Then  you could submit the completion PR. Why do you 
think, @clayborg? I think you'd have to handle the `hover` sub-request 
differently, though.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62547



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


[Lldb-commits] [PATCH] D62477: DWARFASTParserClang: Move attribute parsing into a single function

2019-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

As long as the perf is similar I am good.


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

https://reviews.llvm.org/D62477



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


[Lldb-commits] [PATCH] D62570: [WIP] Use LLVM's debug line parser in LLDB

2019-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

overall looks good. See inlined comments.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:929-938
+  llvm::DWARFDebugLine line;
+  llvm::Expected line_table =
+  line.getOrParseLineTable(
+  data, offset, *ctx, ctx->getUnitForOffset(dwarf_cu->GetOffset()),
+  [](llvm::Error e) { llvm::consumeError(std::move(e)); });
+
+  if (!line_table) {

Can we make a function out of this that just returns the "const 
llvm::DWARFDebugLine::LineTable *"? Or make a new location variable that is 
just a "const llvm::DWARFDebugLine::LineTable *" to avoid the "(*line_table)->" 
stuff below?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62570



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


[Lldb-commits] [PATCH] D62634: Improve DWARF parsing and accessing by 1% to 2%

2019-05-29 Thread Greg Clayton via Phabricator via lldb-commits
clayborg created this revision.
clayborg added reviewers: labath, JDevlieghere, aprantl.

When LLDB first started we didn't have our mmap of the DWARF data done 
correctly and if the backing file would change we would get live changes as the 
file changed and it would cause problems. We now mmap correctly and do not run 
into these issues.  There was legacy code in 
DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) that would always 
extract the abbrev index each time the function was called to verify that DWARF 
data hadn't changed and a warning was emitted if it did. We no longer need this 
and the code was removed. The other thing this function did when it parsed the 
abbrev index was give us the offset of the first attribute bytes by adding the 
LEB128 size to the offset. This required an extra parameter to 
DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(...) which is now removed. I 
added "lldb::offset_t DWARFDebugInfoEntry::GetFirstAttributeOffset() const" 
which calculates this when we need it and modified all sites that need the 
offset to call it.

Now that we aren't decoding and verifying the abbrev index, it speeds up DWARF 
access by 1% to 2%.


https://reviews.llvm.org/D62634

Files:
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -12,6 +12,8 @@
 
 #include 
 
+#include "llvm/Support/LEB128.h"
+
 #include "lldb/Core/Module.h"
 #include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -398,15 +400,14 @@
   std::vector die_refs;
   bool set_frame_base_loclist_addr = false;
 
-  lldb::offset_t offset;
-  const DWARFAbbreviationDeclaration *abbrevDecl =
-  GetAbbreviationDeclarationPtr(cu, offset);
+  auto abbrevDecl = GetAbbreviationDeclarationPtr(cu);
 
   SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
   lldb::ModuleSP module = dwarf2Data->GetObjectFile()->GetModule();
 
   if (abbrevDecl) {
 const DWARFDataExtractor &debug_info_data = cu->GetData();
+lldb::offset_t offset = GetFirstAttributeOffset();
 
 if (!debug_info_data.ValidOffset(offset))
   return false;
@@ -720,13 +721,10 @@
 size_t DWARFDebugInfoEntry::GetAttributes(
 const DWARFUnit *cu, DWARFAttributes &attributes,
 uint32_t curr_depth) const {
-  const DWARFAbbreviationDeclaration *abbrevDecl = nullptr;
-  lldb::offset_t offset = 0;
-  if (cu)
-abbrevDecl = GetAbbreviationDeclarationPtr(cu, offset);
-
+  auto abbrevDecl = GetAbbreviationDeclarationPtr(cu);
   if (abbrevDecl) {
 const DWARFDataExtractor &debug_info_data = cu->GetData();
+lldb::offset_t offset = GetFirstAttributeOffset();
 
 const uint32_t num_attributes = abbrevDecl->NumAttributes();
 for (uint32_t i = 0; i < num_attributes; ++i) {
@@ -790,15 +788,14 @@
  form_value, end_attr_offset_ptr,
  check_specification_or_abstract_origin);
 
-  lldb::offset_t offset;
-  const DWARFAbbreviationDeclaration *abbrevDecl =
-  GetAbbreviationDeclarationPtr(cu, offset);
+  auto abbrevDecl = GetAbbreviationDeclarationPtr(cu);
 
   if (abbrevDecl) {
 uint32_t attr_idx = abbrevDecl->FindAttributeIndex(attr);
 
 if (attr_idx != DW_INVALID_INDEX) {
   const DWARFDataExtractor &debug_info_data = cu->GetData();
+  lldb::offset_t offset = GetFirstAttributeOffset();
 
   uint32_t idx = 0;
   while (idx < attr_idx)
@@ -1403,35 +1400,17 @@
   return found_address;
 }
 
+lldb::offset_t DWARFDebugInfoEntry::GetFirstAttributeOffset() const {
+  return GetOffset() + llvm::getULEB128Size(m_abbr_idx);
+}
+
 const DWARFAbbreviationDeclaration *
-DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(
-const DWARFUnit *cu, lldb::offset_t &offset) const {
+DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(const DWARFUnit *cu) const {
   if (cu) {
-offset = GetOffset();
-
 const DWARFAbbreviationDeclarationSet *abbrev_set = cu->GetAbbreviations();
-if (abbrev_set) {
-  const DWARFAbbreviationDeclaration *abbrev_decl =
-  abbrev_set->GetAbbreviationDeclaration(m_abbr_idx);
-  if (abbrev_decl) {
-// Make sure the abbreviation code still matches. If it doesn't and the
-// DWARF data was mmap'ed, the backing file might have been modified
-// which is bad news.
-const uint64_t abbrev_code = cu->GetData().GetULEB128(&offset);
-
-if (abbrev_decl->Code() == abbrev_code)
-  return abbrev_decl;
-
-SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
-
-dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected(
-"0x%8.8x: the DWARF debug information has been modified (abbrev "
-"code was %u, and

[Lldb-commits] [lldb] r362042 - [Commands] Remove commented out code

2019-05-29 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Wed May 29 16:25:44 2019
New Revision: 362042

URL: http://llvm.org/viewvc/llvm-project?rev=362042&view=rev
Log:
[Commands] Remove commented out code

Modified:
lldb/trunk/source/Commands/CommandObjectType.cpp

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=362042&r1=362041&r2=362042&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Wed May 29 16:25:44 2019
@@ -2841,10 +2841,6 @@ public:
  exe_ctx))
 return false;
 
-// TargetSP
-// target_sp(GetCommandInterpreter().GetDebugger().GetSelectedTarget());
-// const bool fill_all_in = true;
-// ExecutionContext exe_ctx(target_sp.get(), fill_all_in);
 ExecutionContextScope *best_scope = exe_ctx.GetBestExecutionContextScope();
 
 bool any_found = false;


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


[Lldb-commits] [PATCH] D62630: Fix a regression in DWARF access speed caused by svn revision 356190

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



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp:32
   dw_uleb128_t prev_abbr_code = 0;
-  DWARFEnumState state = DWARFEnumState::MoreItems;
-  while (state == DWARFEnumState::MoreItems) {
+  while (true) {
 llvm::Expected es =

Not being too familiar with the API I still find the control flow in this loop 
to be hard to follow. Is `offset_ptr` incremented by `extract()`?



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h:48
 
+  // Unit test accessor functions
+  uint32_t GetIndexOffset() const { return m_idx_offset; }

FYI I think the proper way to doxygenify this is:

```
/// Unit test accessor functions.
/// @{
 ...
/// @}
```


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

https://reviews.llvm.org/D62630



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


[Lldb-commits] [PATCH] D62634: Improve DWARF parsing and accessing by 1% to 2%

2019-05-29 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Out of curiosity, what was that change in the mmap call that fixed this?


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

https://reviews.llvm.org/D62634



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


[Lldb-commits] [PATCH] D62634: Improve DWARF parsing and accessing by 1% to 2%

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

Great!


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

https://reviews.llvm.org/D62634



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


[Lldb-commits] [lldb] r362044 - [crashlog] Add a missing call to decode.

2019-05-29 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed May 29 17:35:43 2019
New Revision: 362044

URL: http://llvm.org/viewvc/llvm-project?rev=362044&view=rev
Log:
[crashlog] Add a missing call to decode.



Modified:
lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=362044&r1=362043&r2=362044&view=diff
==
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Wed May 29 17:35:43 2019
@@ -257,7 +257,7 @@ class CrashLog(symbolication.Symbolicato
 
 def find_matching_slice(self):
 dwarfdump_cmd_output = subprocess.check_output(
-'dwarfdump --uuid "%s"' % self.path, shell=True)
+'dwarfdump --uuid "%s"' % self.path, 
shell=True).decode("utf-8")
 self_uuid = self.get_uuid()
 for line in dwarfdump_cmd_output.splitlines():
 match = self.dwarfdump_uuid_regex.search(line)


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


[Lldb-commits] [lldb] r362049 - DWARFDebugInfoEntry: delete unused Extract() and rename FastExtract() to Extract()

2019-05-29 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Wed May 29 18:51:16 2019
New Revision: 362049

URL: http://llvm.org/viewvc/llvm-project?rev=362049&view=rev
Log:
DWARFDebugInfoEntry: delete unused Extract() and rename FastExtract() to 
Extract()

The function Extract() is almost a duplicate of FastExtract() but is not used.
Delete it and rename FastExtract() to Extract().

Reviewed By: JDevlieghere

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=362049&r1=362048&r2=362049&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Wed May 
29 18:51:16 2019
@@ -31,9 +31,12 @@ using namespace lldb_private;
 using namespace std;
 extern int g_verbose;
 
-bool DWARFDebugInfoEntry::FastExtract(
-const DWARFDataExtractor &debug_info_data, const DWARFUnit *cu,
-lldb::offset_t *offset_ptr) {
+// Extract a debug info entry for a given compile unit from the .debug_info and
+// .debug_abbrev data within the SymbolFileDWARF class starting at the given
+// offset
+bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &debug_info_data,
+  const DWARFUnit *cu,
+  lldb::offset_t *offset_ptr) {
   m_offset = *offset_ptr;
   m_parent_idx = 0;
   m_sibling_idx = 0;
@@ -196,168 +199,6 @@ bool DWARFDebugInfoEntry::FastExtract(
   }
 
   return false;
-}
-
-// Extract
-//
-// Extract a debug info entry for a given compile unit from the .debug_info and
-// .debug_abbrev data within the SymbolFileDWARF class starting at the given
-// offset
-bool DWARFDebugInfoEntry::Extract(const DWARFUnit *cu,
-  lldb::offset_t *offset_ptr) {
-  const DWARFDataExtractor &debug_info_data = cu->GetData();
-  //const DWARFDataExtractor& debug_str_data =
-  //dwarf2Data->get_debug_str_data();
-  const uint32_t cu_end_offset = cu->GetNextUnitOffset();
-  lldb::offset_t offset = *offset_ptr;
-  //  if (offset >= cu_end_offset)
-  //  Log::Status("DIE at offset 0x%8.8x is beyond the end of the current
-  //  compile unit (0x%8.8x)", m_offset, cu_end_offset);
-  if ((offset < cu_end_offset) && debug_info_data.ValidOffset(offset)) {
-m_offset = offset;
-
-const uint64_t abbr_idx = debug_info_data.GetULEB128(&offset);
-lldbassert(abbr_idx <= UINT16_MAX);
-m_abbr_idx = abbr_idx;
-if (abbr_idx) {
-  const DWARFAbbreviationDeclaration *abbrevDecl =
-  cu->GetAbbreviations()->GetAbbreviationDeclaration(abbr_idx);
-
-  if (abbrevDecl) {
-m_tag = abbrevDecl->Tag();
-m_has_children = abbrevDecl->HasChildren();
-
-bool isCompileUnitTag = (m_tag == DW_TAG_compile_unit ||
- m_tag == DW_TAG_partial_unit);
-if (cu && isCompileUnitTag)
-  const_cast(cu)->SetBaseAddress(0);
-
-// Skip all data in the .debug_info for the attributes
-const uint32_t numAttributes = abbrevDecl->NumAttributes();
-for (uint32_t i = 0; i < numAttributes; ++i) {
-  DWARFFormValue form_value(cu);
-  dw_attr_t attr;
-  abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value);
-  dw_form_t form = form_value.Form();
-
-  if (isCompileUnitTag &&
-  ((attr == DW_AT_entry_pc) || (attr == DW_AT_low_pc))) {
-if (form_value.ExtractValue(debug_info_data, &offset)) {
-  if (attr == DW_AT_low_pc || attr == DW_AT_entry_pc)
-const_cast(cu)->SetBaseAddress(
-form_value.Address());
-}
-  } else {
-bool form_is_indirect = false;
-do {
-  form_is_indirect = false;
-  uint32_t form_size = 0;
-  switch (form) {
-  // Blocks if inlined data that have a length field and the data
-  // bytes inlined in the .debug_info
-  case DW_FORM_exprloc:
-  case DW_FORM_block:
-form_size = debug_info_data.GetULEB128(&offset);
-break;
-  case DW_FORM_block1:
-form_size = debug_info_data.GetU8(&offset);
-break;
-  case DW_FORM_block2:
-form_size = debug_info_data.GetU16(&offset);
-break;
-  case DW_FORM_block4:
-form_size = debug_info_data.GetU32(&offset);
-break;
-
-  // Inlined NULL terminated C-strings
-

[Lldb-commits] [PATCH] D62593: DWARFDebugInfoEntry: delete unused Extract() and rename FastExtract() to Extract()

2019-05-29 Thread Fangrui Song via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB362049: DWARFDebugInfoEntry: delete unused Extract() and 
rename FastExtract() to… (authored by MaskRay, committed by ).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62593?vs=201916&id=202095#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62593

Files:
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -31,9 +31,12 @@
 using namespace std;
 extern int g_verbose;
 
-bool DWARFDebugInfoEntry::FastExtract(
-const DWARFDataExtractor &debug_info_data, const DWARFUnit *cu,
-lldb::offset_t *offset_ptr) {
+// Extract a debug info entry for a given compile unit from the .debug_info and
+// .debug_abbrev data within the SymbolFileDWARF class starting at the given
+// offset
+bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &debug_info_data,
+  const DWARFUnit *cu,
+  lldb::offset_t *offset_ptr) {
   m_offset = *offset_ptr;
   m_parent_idx = 0;
   m_sibling_idx = 0;
@@ -198,168 +201,6 @@
   return false;
 }
 
-// Extract
-//
-// Extract a debug info entry for a given compile unit from the .debug_info and
-// .debug_abbrev data within the SymbolFileDWARF class starting at the given
-// offset
-bool DWARFDebugInfoEntry::Extract(const DWARFUnit *cu,
-  lldb::offset_t *offset_ptr) {
-  const DWARFDataExtractor &debug_info_data = cu->GetData();
-  //const DWARFDataExtractor& debug_str_data =
-  //dwarf2Data->get_debug_str_data();
-  const uint32_t cu_end_offset = cu->GetNextUnitOffset();
-  lldb::offset_t offset = *offset_ptr;
-  //  if (offset >= cu_end_offset)
-  //  Log::Status("DIE at offset 0x%8.8x is beyond the end of the current
-  //  compile unit (0x%8.8x)", m_offset, cu_end_offset);
-  if ((offset < cu_end_offset) && debug_info_data.ValidOffset(offset)) {
-m_offset = offset;
-
-const uint64_t abbr_idx = debug_info_data.GetULEB128(&offset);
-lldbassert(abbr_idx <= UINT16_MAX);
-m_abbr_idx = abbr_idx;
-if (abbr_idx) {
-  const DWARFAbbreviationDeclaration *abbrevDecl =
-  cu->GetAbbreviations()->GetAbbreviationDeclaration(abbr_idx);
-
-  if (abbrevDecl) {
-m_tag = abbrevDecl->Tag();
-m_has_children = abbrevDecl->HasChildren();
-
-bool isCompileUnitTag = (m_tag == DW_TAG_compile_unit ||
- m_tag == DW_TAG_partial_unit);
-if (cu && isCompileUnitTag)
-  const_cast(cu)->SetBaseAddress(0);
-
-// Skip all data in the .debug_info for the attributes
-const uint32_t numAttributes = abbrevDecl->NumAttributes();
-for (uint32_t i = 0; i < numAttributes; ++i) {
-  DWARFFormValue form_value(cu);
-  dw_attr_t attr;
-  abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value);
-  dw_form_t form = form_value.Form();
-
-  if (isCompileUnitTag &&
-  ((attr == DW_AT_entry_pc) || (attr == DW_AT_low_pc))) {
-if (form_value.ExtractValue(debug_info_data, &offset)) {
-  if (attr == DW_AT_low_pc || attr == DW_AT_entry_pc)
-const_cast(cu)->SetBaseAddress(
-form_value.Address());
-}
-  } else {
-bool form_is_indirect = false;
-do {
-  form_is_indirect = false;
-  uint32_t form_size = 0;
-  switch (form) {
-  // Blocks if inlined data that have a length field and the data
-  // bytes inlined in the .debug_info
-  case DW_FORM_exprloc:
-  case DW_FORM_block:
-form_size = debug_info_data.GetULEB128(&offset);
-break;
-  case DW_FORM_block1:
-form_size = debug_info_data.GetU8(&offset);
-break;
-  case DW_FORM_block2:
-form_size = debug_info_data.GetU16(&offset);
-break;
-  case DW_FORM_block4:
-form_size = debug_info_data.GetU32(&offset);
-break;
-
-  // Inlined NULL terminated C-strings
-  case DW_FORM_string:
-debug_info_data.GetCStr(&offset);
-break;
-
-  // Compile unit address sized values
-  case DW_FORM_addr:
-form_size = cu->GetAddressByteSize();
-break;
- 

[Lldb-commits] [PATCH] D62500: Add support to read aux vector values

2019-05-29 Thread António Afonso via Phabricator via lldb-commits
aadsm marked an inline comment as done.
aadsm added inline comments.



Comment at: lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp:2091-2093
+DataExtractor auxv_data(buffer_or_error.get()->getBufferStart(),
+buffer_or_error.get()->getBufferSize(),
+GetByteOrder(), GetAddressByteSize());

clayborg wrote:
> We need to get a copy of the data here right? I believe the "buffer_or_error" 
> local variable will go out of scope and the data pointed to will be freed. 
> You can use:
> ```
>   lldb::offset_t DataExtractor::CopyData(lldb::offset_t offset, 
> lldb::offset_t length, void *dst) const;
> ```
> which will copy of the data and internally own it in a DataBufferSP. Or you 
> can create a DataBufferSP yourself using DataBufferHeap and placing it into a 
> DataBufferSP and then passing that to the DataExtractor constructor or 
> SetData method.
> 
Forgot to answer this, this is actually not needed because the ELFAuxVector 
copies what's given to it, it doesn't keep a a reference to the passed data.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62500



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