[Lldb-commits] [PATCH] D63622: [Target] Hoist LanguageRuntime::GetDeclVendor

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D63622#1553978 , @jingham wrote:

> The runtime DeclVendor gives runtimes a way to produce type information from 
> runtime metadata.  For instance, the ObjC runtime tables actually have fairly 
> good type information for all ObjC classes - both instance variables, 
> properties and methods.  It is a little lossy, but for instance it knows the 
> return types of methods so with this augmentation users can call ObjC methods 
> without requiring casting...  This is just the code to query the runtime's 
> DeclVendors to see if they know anything about a given typename.
>
> ObjC is a bit obnoxious, because you can define instance variables and 
> methods in the implementation of a class as well as its interface.  So even 
> though you might have a debug info definition for the type - gotten from 
> including the interface header file - that may not be as good as what you can 
> get from the runtime.  But the runtime type info is, as I said, lossy so if 
> you DO have debug info it will be better.  That means for ObjC you have to do 
> some kind of merge operation to get the best information for a type.  That 
> complexity doesn't affect this patch, but I couldn't resist the opportunity 
> to moan about it a bit since it's given US so much grief over the years!


Thanks for the explanation/background. :)




Comment at: include/lldb/Target/LanguageRuntime.h:137
 
+  virtual DeclVendor *GetDeclVendor() { return nullptr; }
+

jingham wrote:
> compnerd wrote:
> > Can this not be `const`?  Seems like retrieving the vendor should not 
> > mutate the runtime.
> The vendor is computed lazily, so calling this could cause the vendor to get 
> built.  So formally this is not a const operation.
That depends on how you look at it. If something behaves like "const" from the 
outside (i.e. doesn't change the abstract state of the object), then I'd be 
fine with marking it as const even if it needs to modify some internal 
variables. Lazy evaluation/caching is one of the few valid uses for the [[ 
https://en.cppreference.com/w/cpp/language/cv | mutable ]] keyword.

However, that wouldn't be very consistent with how the this is done in the rest 
of lldb.


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

https://reviews.llvm.org/D63622



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


[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h:45-49
+  NativeProcessWindows(ProcessLaunchInfo &launch_info, NativeDelegate 
&delegate,
+   llvm::Error &E);
+
+  NativeProcessWindows(lldb::pid_t pid, int terminal_fd,
+   NativeDelegate &delegate, llvm::Error &E);

I guess these shouldn't be public as these object should be constructed through 
the factory, right?



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp:31-36
+  if (!data_sp) {
+error.SetErrorStringWithFormat(
+"failed to allocate DataBufferHeap instance of size %" PRIu64,
+data_size);
+return error;
+  }

`new` doesn't fail. This is dead code.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp:52-57
+  if (dst == nullptr) {
+error.SetErrorStringWithFormat("DataBufferHeap instance of size %" PRIu64
+   " returned a null pointer",
+   data_size);
+return error;
+  }

This can't ever be true.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.cpp:68-89
+  if (!data_sp) {
+error.SetErrorStringWithFormat(
+"NativeRegisterContextWindows::%s invalid data_sp provided",
+__FUNCTION__);
+return error;
+  }
+

These look like they should be operating invariants (at most guarded by an 
assertion, but probably even that is not needed). Right now, they're just 
making it hard to figure out what this function actually does...



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp:82
+  ::WOW64_CONTEXT tls_context;
+  NativeThreadWindows *wthread = static_cast(&m_thread);
+

How about a helper method like `NativeThreadWindows &GetThread()` to hide the 
static_cast everywhere. You could also change the constructor argument to 
`NativeThreadWindows&` to make it clear that the register context is only to be 
constructed with threads of this type.

a `GetThreadHandle` might be nice too since fetching the thread seems to be 
invariably followed by the 
`GetHostThread().GetNativeThread().GetSystemHandle()` blurb.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp:80-84
+Status NativeThreadWindows::DoDestroy() {
+  m_state = eStateExited;
+  m_stop_info.reason = StopReason::eStopReasonThreadExiting;
+  return Status();
+}

What's the purpose of this function? It seems to be only called immediately 
before deleting the thread, so nobody gets to read it's stop reason anyway...



Comment at: source/Plugins/Process/Windows/Common/NativeProcessWindows.h:31
+class NativeProcessWindows : public NativeProcessProtocol,
+ public ProcessDebugger {
+

Hui wrote:
> labath wrote:
> > Hui wrote:
> > > labath wrote:
> > > > I'm not sure this multiple inheritance is really helping anything here. 
> > > > While looking through the code i kept wondering "why doesn't this 
> > > > function just do the job itself instead of delegating to somebody else" 
> > > > only to have to remind myself that the function it is delegating to is 
> > > > actually a different object, which does not know anything about the 
> > > > bigger picture.
> > > > 
> > > > If using composition here wouldn't introduce additional 
> > > > complexities/code (which it doesn't look like it would), I think it 
> > > > might be better to do that instead.
> > > Do you mean to move what is in ProcessDebugger into nativeprocess 
> > > instead?  
> > No, just instead of inheriting from a ProcessDebugger, making it a member 
> > variable instead. Unless there are reasons which make that 
> > hard/impossible...
> Debug event callback in ProcessDebugger need to be overridden by both 
> processwindows and nativeprocess. Not sure if the change is doable. Also same 
> change is required to processwindows. That will make the patch a little 
> bigger.
Ok, let's leave it like that for now. However, I find it very weird that the 
`ProcessDebugger` class takes a "delegate" object *and* it requires you to 
inherit from it to override some of it's methods. Seems like one of these 
extension mechanisms ought to be enough.



Comment at: 
source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h:31
+protected:
+  Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp,
+   const size_t data_size);

labath wrote:
> Hui wrote:
> > labath wrote:
> > > Is this overriding something? Can you please use `override` to indicate 
> > > that (throughout this patch)?
> > No, it doesn't override anything. It has different 

[Lldb-commits] [PATCH] D63643: DWARF: Add support for type units+split dwarf combo

2019-06-24 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/SymbolFileDWARFDwo.cpp:77
+llvm::dyn_cast(debug_info->GetUnitAtIndex(i))) {
+  if (cu)
+return nullptr;

JDevlieghere wrote:
> Is this here to ensure that there's no two candidates? Initially I was pretty 
> confused by this, I think it's worth a comment. 
Yes, that's it. If you know of a nicer way to implement that search, I'd like 
to hear it. For now, I've just put some comments around this.


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

https://reviews.llvm.org/D63643



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


[Lldb-commits] [PATCH] D63643: DWARF: Add support for type units+split dwarf combo

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 206168.
labath marked an inline comment as done.
labath added a comment.

Add some comments in SymbolFileDWARFDwo::ComputeCompileUnit


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

https://reviews.llvm.org/D63643

Files:
  lit/SymbolFile/DWARF/debug-types-basic.test
  lit/SymbolFile/DWARF/debug-types-expressions.test
  lit/SymbolFile/DWARF/split-dwarf-multiple-cu.ll
  source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -19,7 +19,7 @@
 
   lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu) override;
 
-  DWARFUnit *GetCompileUnit();
+  DWARFCompileUnit *GetCompileUnit();
 
   DWARFUnit *
   GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) override;
@@ -69,8 +69,11 @@
 
   SymbolFileDWARF &GetBaseSymbolFile();
 
+  DWARFCompileUnit *ComputeCompileUnit();
+
   lldb::ObjectFileSP m_obj_file_sp;
   DWARFCompileUnit &m_base_dwarf_cu;
+  DWARFCompileUnit *m_cu = nullptr;
 };
 
 #endif // SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Utility/LLDBAssert.h"
+#include "llvm/Support/Casting.h"
 
 #include "DWARFCompileUnit.h"
 #include "DWARFDebugInfo.h"
@@ -54,12 +55,34 @@
   return GetBaseSymbolFile().ParseCompileUnit(m_base_dwarf_cu);
 }
 
-DWARFUnit *SymbolFileDWARFDwo::GetCompileUnit() {
-  // Only dwo files with 1 compile unit is supported
-  if (GetNumCompileUnits() == 1)
-return DebugInfo()->GetUnitAtIndex(0);
-  else
+DWARFCompileUnit *SymbolFileDWARFDwo::GetCompileUnit() {
+  if (!m_cu)
+m_cu = ComputeCompileUnit();
+  return m_cu;
+}
+
+DWARFCompileUnit *SymbolFileDWARFDwo::ComputeCompileUnit() {
+  DWARFDebugInfo *debug_info = DebugInfo();
+  if (!debug_info)
 return nullptr;
+
+  // Right now we only support dwo files with one compile unit. If we don't have
+  // type units, we can just check for the unit count.
+  if (!debug_info->ContainsTypeUnits() && debug_info->GetNumUnits() == 1)
+return llvm::cast(debug_info->GetUnitAtIndex(0));
+
+  // Otherwise, we have to run through all units, and find the compile unit that
+  // way.
+  DWARFCompileUnit *cu = nullptr;
+  for (size_t i = 0; i < debug_info->GetNumUnits(); ++i) {
+if (auto *candidate =
+llvm::dyn_cast(debug_info->GetUnitAtIndex(i))) {
+  if (cu)
+return nullptr; // More that one CU found.
+  cu = candidate;
+}
+  }
+  return cu;
 }
 
 DWARFUnit *
Index: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
===
--- source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -104,9 +104,10 @@
 
   IndexUnitImpl(unit, cu_language, set);
 
-  SymbolFileDWARFDwo *dwo_symbol_file = unit.GetDwoSymbolFile();
-  if (dwo_symbol_file && dwo_symbol_file->GetCompileUnit()) {
-IndexUnitImpl(*dwo_symbol_file->GetCompileUnit(), cu_language, set);
+  if (SymbolFileDWARFDwo *dwo_symbol_file = unit.GetDwoSymbolFile()) {
+DWARFDebugInfo &dwo_info = *dwo_symbol_file->DebugInfo();
+for (size_t i = 0; i < dwo_info.GetNumUnits(); ++i)
+  IndexUnitImpl(*dwo_info.GetUnitAtIndex(i), cu_language, set);
   }
 }
 
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -363,7 +363,10 @@
   else if (gnu_ranges_base)
 dwo_cu->SetRangesBase(*gnu_ranges_base);
 
-  SetDwoStrOffsetsBase(dwo_cu);
+  for (size_t i = 0; i < m_dwo_symbol_file->DebugInfo()->GetNumUnits(); ++i) {
+DWARFUnit *unit = m_dwo_symbol_file->DebugInfo()->GetUnitAtIndex(i);
+SetDwoStrOffsetsBase(unit);
+  }
 }
 
 DWARFDIE DWARFUnit::LookupAddress(const dw_addr_t address) {
Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -19,13 +19,14 @@
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Utility/Stream.h"
 
-#include

[Lldb-commits] [PATCH] D63591: DWARFDebugLoc: Make parsing and error reporting more robust

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 206205.
labath added a comment.

Leave a TODO in the code.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63591

Files:
  include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  lib/DebugInfo/DWARF/DWARFDie.cpp
  test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s
  test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s

Index: test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s
===
--- /dev/null
+++ test/DebugInfo/X86/dwarfdump-debug-loclists-error-cases.s
@@ -0,0 +1,62 @@
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o
+# RUN: llvm-dwarfdump -debug-loclists %t1.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE2=0 -o %t2.o
+# RUN: llvm-dwarfdump -debug-loclists %t2.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE3=0 -o %t3.o
+# RUN: llvm-dwarfdump -debug-loclists %t3.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE4=0 -o %t4.o
+# RUN: llvm-dwarfdump -debug-loclists %t4.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE5=0 -o %t5.o
+# RUN: llvm-dwarfdump -debug-loclists %t5.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE6=0 -o %t6.o
+# RUN: llvm-dwarfdump -debug-loclists %t6.o 2>&1 | FileCheck %s --check-prefix=UNIMPL
+
+# CHECK: error: location list overflows the debug_loclists section
+
+# UNIMPL: error: LLE of kind 47 not implemented
+
+.section  .debug_loclists,"",@progbits
+  .long  .Ldebug_loclist_table_end0-.Ldebug_loclist_table_start0
+.Ldebug_loclist_table_start0:
+ .short 5# Version.
+ .byte 8 # Address size.
+ .byte 0 # Segment selector size.
+ .long 0 # Offset entry count.
+.Lloclists_table_base0:
+.Ldebug_loc0:
+.ifdef CASE1
+  .byte  4   # DW_LLE_offset_pair
+.endif
+.ifdef CASE2
+  .byte  4   # DW_LLE_offset_pair
+  .uleb128 0x0   #   starting offset
+.endif
+.ifdef CASE3
+  .byte  4   # DW_LLE_offset_pair
+  .uleb128 0x0   #   starting offset
+  .uleb128 0x10  #   ending offset
+.endif
+.ifdef CASE4
+  .byte  4   # DW_LLE_offset_pair
+  .uleb128 0x0   #   starting offset
+  .uleb128 0x10  #   ending offset
+  .byte  1   # Loc expr size
+.endif
+.ifdef CASE5
+  .byte  4   # DW_LLE_offset_pair
+  .uleb128 0x0   #   starting offset
+  .uleb128 0x10  #   ending offset
+  .byte  1   # Loc expr size
+  .byte  117 # DW_OP_breg5
+.endif
+.ifdef CASE6
+  .byte 0x47
+.endif
+
+.Ldebug_loclist_table_end0:
+
Index: test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s
===
--- /dev/null
+++ test/DebugInfo/X86/dwarfdump-debug-loc-error-cases.s
@@ -0,0 +1,52 @@
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE1=0 -o %t1.o
+# RUN: llvm-dwarfdump -debug-loc %t1.o 2>&1 | FileCheck %s --check-prefix=CONSUME
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE2=0 -o %t2.o
+# RUN: llvm-dwarfdump -debug-loc %t2.o 2>&1 | FileCheck %s --check-prefix=CONSUME
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE3=0 -o %t3.o
+# RUN: llvm-dwarfdump -debug-loc %t3.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE4=0 -o %t4.o
+# RUN: llvm-dwarfdump -debug-loc %t4.o 2>&1 | FileCheck %s
+
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux --defsym CASE5=0 -o %t5.o
+# RUN: llvm-dwarfdump -debug-loc %t5.o 2>&1 | FileCheck %s
+
+# CONSUME: error: failed to consume entire .debug_loc section
+
+# CHECK: error: location list overflows the debug_loc section
+
+.section  .debug_loc,"",@progbits
+.ifdef CASE1
+  .byte  1   # bogus
+.endif
+.ifdef CASE2
+  .long  0   # starting offset
+.endif
+.ifdef CASE3
+  .long  0   # starting offset
+  .long  1   # ending offset
+.endif
+.ifdef CASE4
+  .long  0   # starting offset
+  .long  1   # ending offset
+  .word  0   # Loc expr size
+.endif
+.ifdef CASE5
+  .long  0   # starting offset
+  .long  1   # ending offset
+  .word  0   # Loc expr size
+  .long  0   # starting offset
+.endif
+
+# A minimal compile unit is needed to deduce the address size of the location
+# lists

[Lldb-commits] [PATCH] D63591: DWARFDebugLoc: Make parsing and error reporting more robust

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D63591#1553757 , @dblaikie wrote:

> Given figuring out error handling for DataExtractor is perhaps a wider issue 
> - if you want to go ahead with this change (continue with the review & defer 
> error handling improvements for later, leave a FIXME, etc) that seems fine.


How about this ? Theoretically I could also back out the SavedOffset changes. 
The main thing I was trying to fix is the stderr messages, this is just 
something I found while trying to write tests for the error handling code. I'm 
not too worried about the extra "zero" location lists being reported, as those 
are unlikely to be valid (but it would definitely be nice to fix them).

I also have a kind of a WIP patch for doing the error handling in a better way. 
I'm going to put that up separately so we can discuss it there.

PS: I'm going to have about two more patches here to make this stuff usable 
from lldb.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63591



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


[Lldb-commits] [PATCH] D63591: DWARFDebugLoc: Make parsing and error reporting more robust

2019-06-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

DataExtractor is a copy of the one from LLDB from a while back and changes have 
been made to adapt it to llvm. DataExtractor was designed so that you can have 
one of them (like for .debug_info or any other DWARF section) and use this same 
extractor from multiple threads. This is why it is currently stateless.

One solution to allowing for correct error handling would be to replace the 
current "uint32_t *offset_ptr" arguments to DataExtractor decoding functions 
with a "DataCursor &Pos" where DataCursor is something like:

  class DataCursor {
llvm::Expected OffsetOrError;
  };

Then all of the state like the offset and any error state. Or it could be two 
members, an offset and an error.

The main issues is to not decrease parsing performance by introducing error 
checking on each byte. The current DataExtractor will return zeroes when things 
fail to extract, which is kind of tuned for DWARF since zeros are not valid 
DW_TAG, DW_AT,  DW_FORM and many other DWARF values. But it does allow for fast 
parsing. The idea was to quickly try and parse a bunch of data, and then make 
sure things are ok after doing some work (like parsing an entire DIE). So be 
careful with any changes to ensure DWARF parsing doesn't seriously regress.




Comment at: lib/DebugInfo/DWARF/DWARFDebugLoc.cpp:190
+switch (E.Kind) {
+case dwarf::DW_LLE_startx_length:
   // Pre-DWARF 5 has different interpretation of the length field. We have

We should switch the LEB functions in DataExtractor over to use the ones from:

```
#include https://reviews.llvm.org/D63591/new/

https://reviews.llvm.org/D63591



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


[Lldb-commits] [PATCH] D63240: [Core] Generalize ValueObject::IsRuntimeSupportValue

2019-06-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Core/ValueObject.cpp:1719
+// artificial.
 return GetVariable() && GetVariable()->IsArtificial();
   }

Things brings the questions: do we really need to filter these variables? I 
wouldn't mind seeing "_cmd" and any other defaulted objective C variables in 
the IDE. This seems like a lot of work to go through to just stop showing 
"_cmd". Any variables for the language object ("self" for ObjC or "this" for 
C++) are marked as artificial so we want to see these. If that is the case, we 
can remove this all together.


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

https://reviews.llvm.org/D63240



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


[Lldb-commits] [PATCH] D63240: [Core] Generalize ValueObject::IsRuntimeSupportValue

2019-06-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: source/Core/ValueObject.cpp:1719
+// artificial.
 return GetVariable() && GetVariable()->IsArtificial();
   }

clayborg wrote:
> Things brings the questions: do we really need to filter these variables? I 
> wouldn't mind seeing "_cmd" and any other defaulted objective C variables in 
> the IDE. This seems like a lot of work to go through to just stop showing 
> "_cmd". Any variables for the language object ("self" for ObjC or "this" for 
> C++) are marked as artificial so we want to see these. If that is the case, 
> we can remove this all together.
The reason for having a whitelist as well as suppressing artificial variables 
is so that we can show self & _cmd while still suppressing the really 
artificial variables like the ones used to track dynamic array sizes and swift 
metadata symbols.  I don't think we want to show the latter.


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

https://reviews.llvm.org/D63240



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


[Lldb-commits] [PATCH] D63240: [Core] Generalize ValueObject::IsRuntimeSupportValue

2019-06-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Core/ValueObject.cpp:1719
+// artificial.
 return GetVariable() && GetVariable()->IsArtificial();
   }

jingham wrote:
> clayborg wrote:
> > Things brings the questions: do we really need to filter these variables? I 
> > wouldn't mind seeing "_cmd" and any other defaulted objective C variables 
> > in the IDE. This seems like a lot of work to go through to just stop 
> > showing "_cmd". Any variables for the language object ("self" for ObjC or 
> > "this" for C++) are marked as artificial so we want to see these. If that 
> > is the case, we can remove this all together.
> The reason for having a whitelist as well as suppressing artificial variables 
> is so that we can show self & _cmd while still suppressing the really 
> artificial variables like the ones used to track dynamic array sizes and 
> swift metadata symbols.  I don't think we want to show the latter.
Sounds good, my objection is removed. Still kind of weird that we 
runtime->IsRuntimeSupportValue() from one language and 
runtime->IsWhitelistedRuntimeValue() from another. I know why we do it, but it 
still seems a bit weird.


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

https://reviews.llvm.org/D63240



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


[Lldb-commits] [lldb] r364210 - Move common functionality from processwindows into processdebugger

2019-06-24 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Mon Jun 24 10:43:47 2019
New Revision: 364210

URL: http://llvm.org/viewvc/llvm-project?rev=364210&view=rev
Log:
Move common functionality from processwindows into processdebugger

Summary:
This change extracts functionalities from processwindows into a
introduced processdebugger that can be reused in native process
debugging. 

The main reason is that the native process debugging
can't directly be based on processwindows or be implemented
as a pass-through to this plugin since the plugin has ties to
Target and Process classes that are needed in host debugging but
not necessary in native debugging.

Reviewers: labath, Hui, jfb, clayborg, amccarth

Reviewed By: labath

Subscribers: amccarth, dexonsmith, mgorny, lldb-commits

Tags: #lldb

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

Added:
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.h
Modified:
lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt?rev=364210&r1=364209&r2=364210&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt Mon Jun 24 
10:43:47 2019
@@ -1,6 +1,7 @@
 set(PROC_WINDOWS_COMMON_SOURCES
   DebuggerThread.cpp
   LocalDebugDelegate.cpp
+  ProcessDebugger.cpp
   ProcessWindows.cpp
   ProcessWindowsLog.cpp
   RegisterContextWindows.cpp

Added: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp?rev=364210&view=auto
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp (added)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp Mon 
Jun 24 10:43:47 2019
@@ -0,0 +1,572 @@
+//===-- ProcessDebugger.cpp -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ProcessDebugger.h"
+
+// Windows includes
+#include "lldb/Host/windows/windows.h"
+#include 
+
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostNativeProcessBase.h"
+#include "lldb/Host/HostProcess.h"
+#include "lldb/Host/HostThread.h"
+#include "lldb/Host/ProcessLaunchInfo.h"
+#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Target/Process.h"
+#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/Error.h"
+
+#include "DebuggerThread.h"
+#include "ExceptionRecord.h"
+#include "ProcessWindowsLog.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static DWORD ConvertLldbToWinApiProtect(uint32_t protect) {
+  // We also can process a read / write permissions here, but if the debugger
+  // will make later a write into the allocated memory, it will fail. To get
+  // around it is possible inside DoWriteMemory to remember memory permissions,
+  // allow write, write and restore permissions, but for now we process only
+  // the executable permission.
+  //
+  // TODO: Process permissions other than executable
+  if (protect & ePermissionsExecutable)
+return PAGE_EXECUTE_READWRITE;
+
+  return PAGE_READWRITE;
+}
+
+// The Windows page protection bits are NOT independent masks that can be
+// bitwise-ORed together.  For example, PAGE_EXECUTE_READ is not (PAGE_EXECUTE
+// | PAGE_READ).  To test for an access type, it's necessary to test for any of
+// the bits that provide that access type.
+static bool IsPageReadable(uint32_t protect) {
+  return (protect & PAGE_NOACCESS) == 0;
+}
+
+static bool IsPageWritable(uint32_t protect) {
+  return (protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY |
+ PAGE_READWRITE | PAGE_WRITECOPY)) != 0;
+}
+
+static bool IsPageExecutable(uint32_t protect) {
+  return (protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE 
|
+ PAGE_EXECUTE_WRITECOPY)) != 0;
+}
+
+namespace lldb_private {
+
+lldb::pid_t ProcessDebugger::GetDebuggedProcessId() const {
+  if (m_session_data)
+return m_session_data->m_debugger->GetProcess().GetProcessId();
+  return LLDB_INVALID_PROCESS_ID;
+}
+
+Status ProcessDebugger::DetachProcess() {
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  D

[Lldb-commits] [PATCH] D63730: Remove core loading timeout

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: jingham, clayborg.
Herald added a subscriber: aprantl.

If target.preload-symbols is false, waiting for the process to "stop"
can take an arbitrarily long amount of time, because it will cause all
the debug info to be parsed (to compute the stop message showing the
function, its arguments, etc).

We were previously waiting for 10 seconds for the stop even to arrive,
which is a pretty long time, but it's not that hard to overcome with
huge debug info.

Since any arbitrary limit can be theoretically overcome with huge
debug_info and/or slow machine, and the stop even was sent 3 lines above
the wait, if we ever do not receive the stop even means we've got a bug
in lldb. Therefore, I remove the timeout on this wait completely.

No test because I don't know how to reproduce this without a
multi-gigabyte symbol file.


https://reviews.llvm.org/D63730

Files:
  source/Target/Process.cpp


Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -2687,7 +2687,7 @@
 // Wait for a stopped event since we just posted one above...
 lldb::EventSP event_sp;
 StateType state =
-WaitForProcessToStop(seconds(10), &event_sp, true, listener_sp);
+WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp);
 
 if (!StateIsStoppedState(state, false)) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));


Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -2687,7 +2687,7 @@
 // Wait for a stopped event since we just posted one above...
 lldb::EventSP event_sp;
 StateType state =
-WaitForProcessToStop(seconds(10), &event_sp, true, listener_sp);
+WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp);
 
 if (!StateIsStoppedState(state, false)) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r364216 - [ABI] Implement Windows ABI for x86_64

2019-06-24 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jun 24 11:21:05 2019
New Revision: 364216

URL: http://llvm.org/viewvc/llvm-project?rev=364216&view=rev
Log:
[ABI] Implement Windows ABI for x86_64

Summary:
Implement the ABI for WIndows-x86_64 including register info and calling 
convention.
Handled nested struct returned in register (SysV doesn't have it supported)

Reviewers: xiaobai, compnerd

Reviewed By: compnerd

Subscribers: labath, jasonmolenda, fedor.sergeev, mgorny, teemperor, 
lldb-commits

Tags: #lldb

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

Added:
lldb/trunk/source/Plugins/ABI/Windows-x86_64/
lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
lldb/trunk/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
Modified:

lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Plugins/ABI/CMakeLists.txt
lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp

lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py?rev=364216&r1=364215&r2=364216&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
 Mon Jun 24 11:21:05 2019
@@ -26,7 +26,6 @@ class RegistersIteratorTestCase(TestBase
 'main.cpp', '// Set break point at this line.')
 
 @add_test_categories(['pyapi'])
-@expectedFailureAll(oslist=["windows"])
 def test_iter_registers(self):
 """Test iterator works correctly for lldbutil.iter_registers()."""
 self.build()

Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=364216&r1=364215&r2=364216&view=diff
==
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Mon Jun 24 11:21:05 2019
@@ -34,6 +34,7 @@
 #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
 #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
+#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
 #include "Plugins/Architecture/Arm/ArchitectureArm.h"
 #include "Plugins/Architecture/Mips/ArchitectureMips.h"
 #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
@@ -186,6 +187,7 @@ llvm::Error SystemInitializerFull::Initi
   ABISysV_mips::Initialize();
   ABISysV_mips64::Initialize();
   ABISysV_s390x::Initialize();
+  ABIWindows_x86_64::Initialize();
 
   ArchitectureArm::Initialize();
   ArchitectureMips::Initialize();
@@ -299,6 +301,7 @@ void SystemInitializerFull::Terminate()
   ABISysV_mips::Terminate();
   ABISysV_mips64::Terminate();
   ABISysV_s390x::Terminate();
+  ABIWindows_x86_64::Terminate();
   DisassemblerLLVMC::Terminate();
 
   JITLoaderGDB::Terminate();

Modified: lldb/trunk/source/Plugins/ABI/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/CMakeLists.txt?rev=364216&r1=364215&r2=364216&view=diff
==
--- lldb/trunk/source/Plugins/ABI/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ABI/CMakeLists.txt Mon Jun 24 11:21:05 2019
@@ -11,3 +11,4 @@ add_subdirectory(SysV-x86_64)
 add_subdirectory(MacOSX-i386)
 add_subdirectory(MacOSX-arm)
 add_subdirectory(MacOSX-arm64)
+add_subdirectory(Windows-x86_64)

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=364216&r1=364215&r2=364216&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Mon Jun 24 
11:21:05 2019
@@ -220,8 +220,19 @@ size_t ABISysV_x86_64::GetRedZoneSize()
 
 ABISP
 ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec 
&arch) {
-  if (arch.GetTriple().getArch() == llvm::Triple::x86_64) {
-return ABISP(new ABISysV_x86_64(process_sp));
+  const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
+  const llvm::Triple::OSType os_type = arch.GetTriple().getOS();
+  if (arch_type == llvm::Triple::x86_64) {
+

[Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-06-24 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364216: [ABI] Implement Windows ABI for x86_64 (authored by 
xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62213?vs=205640&id=206270#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62213

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
  lldb/trunk/source/API/SystemInitializerFull.cpp
  lldb/trunk/source/Plugins/ABI/CMakeLists.txt
  lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
  lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
  lldb/trunk/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
  lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
  
lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp

Index: lldb/trunk/source/API/SystemInitializerFull.cpp
===
--- lldb/trunk/source/API/SystemInitializerFull.cpp
+++ lldb/trunk/source/API/SystemInitializerFull.cpp
@@ -34,6 +34,7 @@
 #include "Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h"
 #include "Plugins/ABI/SysV-s390x/ABISysV_s390x.h"
 #include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h"
+#include "Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h"
 #include "Plugins/Architecture/Arm/ArchitectureArm.h"
 #include "Plugins/Architecture/Mips/ArchitectureMips.h"
 #include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
@@ -186,6 +187,7 @@
   ABISysV_mips::Initialize();
   ABISysV_mips64::Initialize();
   ABISysV_s390x::Initialize();
+  ABIWindows_x86_64::Initialize();
 
   ArchitectureArm::Initialize();
   ArchitectureMips::Initialize();
@@ -299,6 +301,7 @@
   ABISysV_mips::Terminate();
   ABISysV_mips64::Terminate();
   ABISysV_s390x::Terminate();
+  ABIWindows_x86_64::Terminate();
   DisassemblerLLVMC::Terminate();
 
   JITLoaderGDB::Terminate();
Index: lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
@@ -21,7 +21,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-const DWORD kWinContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
+const DWORD kWinContextFlags = CONTEXT_ALL;
 
 // Constructors and Destructors
 RegisterContextWindows::RegisterContextWindows(Thread &thread,
@@ -114,8 +114,18 @@
 return true;
 
   TargetThreadWindows &wthread = static_cast(m_thread);
-  memset(&m_context, 0, sizeof(m_context));
-  m_context.ContextFlags = kWinContextFlags;
+  uint8_t buffer[2048];
+  memset(buffer, 0, sizeof(buffer));
+  PCONTEXT tmpContext = NULL;
+  DWORD contextLength = (DWORD)sizeof(buffer);
+  if (!::InitializeContext(buffer, kWinContextFlags, &tmpContext,
+   &contextLength)) {
+return false;
+  }
+  memcpy(&m_context, tmpContext, sizeof(m_context));
+  if (!::SuspendThread(wthread.GetHostThread().GetNativeThread().GetSystemHandle())) {
+return false;
+  }
   if (!::GetThreadContext(
   wthread.GetHostThread().GetNativeThread().GetSystemHandle(),
   &m_context)) {
@@ -125,6 +135,9 @@
 ::GetLastError());
 return false;
   }
+  if (!::ResumeThread(wthread.GetHostThread().GetNativeThread().GetSystemHandle())) {
+return false;
+  }
   LLDB_LOG(log, "successfully updated the register values.");
   m_context_stale = false;
   return true;
Index: lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
@@ -24,6 +24,11 @@
 
 #define DEFINE_GPR(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatHexUppercase
 #define DEFINE_GPR_BIN(reg, alt) #reg, alt, 8, 0, eEncodingUint, eFormatBinary
+#define DEFINE_FPU_XMM(reg)\
+  #reg, NULL, 16, 0, eEncodingUint, eFormatVectorOfUInt64, \
+  {dwarf_##reg##_x86_64, dwarf_##reg##_x86_64, LLDB_INVALID_REGNUM,\
+   LLDB_INVALID_REGNUM, lldb_##reg##_x86_64},  \
+  nullptr, nullptr, nullptr, 0
 
 namespace {
 
@@ -51,7 +56,24 @@
   eRegisterIndexR14,
   eRegisterIndexR15,
   eRegisterIndexRip,
-  eRegisterIndexRflags
+  eRegisterIndexRflags,
+
+  eRegisterIndexXmm0,
+  eRegisterIndexXmm1,
+  eRegisterIndexXmm2,
+  eRegisterIndexXmm3,
+  eRegisterIndexXmm4,
+  eRegisterIndexXmm5,
+  eRegisterIndexXmm6,
+  eRegis

Re: [Lldb-commits] [PATCH] D62213: [ABI] Implement Windows ABI for x86_64

2019-06-24 Thread Rumeet Dhindsa via lldb-commits
Hi Alex,

It seems that the two variables in file ABIWindows_x86_64.cpp are unused:

Line 1656: field_bit_width
Line 1666: field_byte_flags

On Mon, Jun 24, 2019 at 11:23 AM Alex Langford via Phabricator via
lldb-commits  wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL364216: [ABI] Implement Windows ABI for x86_64
> (authored by xiaobai, committed by ).
> Herald added a project: LLVM.
> Herald added a subscriber: llvm-commits.
>
> Changed prior to commit:
>   https://reviews.llvm.org/D62213?vs=205640&id=206270#toc
>
> Repository:
>   rL LLVM
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D62213/new/
>
> https://reviews.llvm.org/D62213
>
> Files:
>
> lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
>   lldb/trunk/source/API/SystemInitializerFull.cpp
>   lldb/trunk/source/Plugins/ABI/CMakeLists.txt
>   lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
>   lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
>   lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h
>   lldb/trunk/source/Plugins/ABI/Windows-x86_64/CMakeLists.txt
>
> lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
>
> lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r364223 - [ABI] Remove unused variables in ABIWindows_x86_64

2019-06-24 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jun 24 12:43:22 2019
New Revision: 364223

URL: http://llvm.org/viewvc/llvm-project?rev=364223&view=rev
Log:
[ABI] Remove unused variables in ABIWindows_x86_64

Modified:
lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp

Modified: lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp?rev=364223&r1=364222&r2=364223&view=diff
==
--- lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp 
(original)
+++ lldb/trunk/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp Mon Jun 
24 12:43:22 2019
@@ -1653,8 +1653,6 @@ ValueObjectSP ABIWindows_x86_64::GetRetu
   uint32_t field_byte_width = (uint32_t) 
(*field_compiler_type.GetByteSize(&thread));
   uint32_t field_byte_offset = aggregate_field_offsets[idx];
 
-  uint32_t field_bit_width = field_byte_width * 8;
-
   // this is unlikely w/o the overall size being greater than 8 bytes
   // For now, return a nullptr return value object.
   if (used_bytes >= 8 || used_bytes + field_byte_width > 8) {
@@ -1663,8 +1661,6 @@ ValueObjectSP ABIWindows_x86_64::GetRetu
 
   DataExtractor *copy_from_extractor = nullptr;
   uint32_t copy_from_offset = 0;
-  const uint32_t field_byte_flags = field_compiler_type.GetTypeInfo();
-
   if (field_compiler_type.IsIntegerOrEnumerationType(is_signed) ||
   field_compiler_type.IsPointerType() ||
   field_compiler_type.IsFloatingPointType(count, is_complex)) {


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


[Lldb-commits] [lldb] r364229 - [Target] Hoist LanguageRuntime::GetDeclVendor

2019-06-24 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Mon Jun 24 13:33:09 2019
New Revision: 364229

URL: http://llvm.org/viewvc/llvm-project?rev=364229&view=rev
Log:
[Target] Hoist LanguageRuntime::GetDeclVendor

Summary:
It's possible that each LanguageRuntime could have its own DeclVendor,
so let's hoist that out of ObjCLanguageRuntime into LanguageRuntime.

Additionally, this gives the opportunity to remove SBTarget's dependency
on ObjCLanguageRuntime.

Reviewers: JDevlieghere, labath, compnerd, davide

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=364229&r1=364228&r2=364229&view=diff
==
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Mon Jun 24 13:33:09 2019
@@ -16,6 +16,7 @@
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Expression/LLVMUserExpression.h"
+#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/lldb-private.h"
 #include "lldb/lldb-public.h"
@@ -132,6 +133,8 @@ public:
 
   Target &GetTargetRef() { return m_process->GetTarget(); }
 
+  virtual DeclVendor *GetDeclVendor() { return nullptr; }
+
   virtual lldb::BreakpointResolverSP
   CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
 

Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=364229&r1=364228&r2=364229&view=diff
==
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Mon Jun 24 13:33:09 
2019
@@ -20,7 +20,6 @@
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/ThreadSafeDenseMap.h"
 #include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
@@ -276,8 +275,6 @@ public:
 
   virtual ObjCISA GetParentClass(ObjCISA isa);
 
-  virtual DeclVendor *GetDeclVendor() { return nullptr; }
-
   // Finds the byte offset of the child_type ivar in parent_type.  If it can't
   // find the offset, returns LLDB_INVALID_IVAR_OFFSET.
 

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=364229&r1=364228&r2=364229&view=diff
==
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon Jun 24 13:33:09 2019
@@ -53,7 +53,6 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -1847,25 +1846,18 @@ lldb::SBType SBTarget::FindFirstType(con
   }
 }
 
-// Didn't find the type in the symbols; try the Objective-C runtime if one
-// is installed
-
-ProcessSP process_sp(target_sp->GetProcessSP());
-
-if (process_sp) {
-  ObjCLanguageRuntime *objc_language_runtime =
-  ObjCLanguageRuntime::Get(*process_sp);
-
-  if (objc_language_runtime) {
-DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor();
-
-if (objc_decl_vendor) {
+// Didn't find the type in the symbols; Try the loaded language runtimes
+// FIXME: This depends on clang, but should be able to support any
+// TypeSystem/compiler.
+if (auto process_sp = target_sp->GetProcessSP()) {
+  for (auto *runtime : process_sp->GetLanguageRuntimes()) {
+if (auto vendor = runtime->GetDeclVendor()) {
   std::vector decls;
-
-  if (objc_decl_vendor->FindDecls(const_typename, true, 1, decls) > 0) 
{
-if (CompilerType type = ClangASTContext::GetTypeForDecl(decls[0])) 
{
+  if (vendor->FindDecls(const_typename, /*append*/ true,
+/*max_matches*/ 1, decls) > 0) {
+if (CompilerType type =
+ClangASTContext::GetTypeForDecl(decls.front()))
   return LLDB_RECORD_RESULT(SBType(type));
-}
   }
 }
   }
@@ -1918,25 +1910,18 @@ lldb::SBTypeList SBTarget::FindTypes(con
   }
 }
 
-// Try the Objective-C runtime if one is installed
-
-ProcessSP process_sp(target_sp->GetProcessSP());
-
-if (process_sp) {
-  ObjCLanguageRuntime *objc_language_runtime

[Lldb-commits] [PATCH] D63622: [Target] Hoist LanguageRuntime::GetDeclVendor

2019-06-24 Thread Alex Langford 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 rL364229: [Target] Hoist LanguageRuntime::GetDeclVendor 
(authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63622?vs=206054&id=206293#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63622

Files:
  lldb/trunk/include/lldb/Target/LanguageRuntime.h
  lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
  lldb/trunk/source/API/SBTarget.cpp

Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h
===
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h
@@ -16,6 +16,7 @@
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Expression/LLVMUserExpression.h"
+#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/lldb-private.h"
 #include "lldb/lldb-public.h"
@@ -132,6 +133,8 @@
 
   Target &GetTargetRef() { return m_process->GetTarget(); }
 
+  virtual DeclVendor *GetDeclVendor() { return nullptr; }
+
   virtual lldb::BreakpointResolverSP
   CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) = 0;
 
Index: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
===
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
@@ -20,7 +20,6 @@
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/ThreadSafeDenseMap.h"
 #include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
@@ -276,8 +275,6 @@
 
   virtual ObjCISA GetParentClass(ObjCISA isa);
 
-  virtual DeclVendor *GetDeclVendor() { return nullptr; }
-
   // Finds the byte offset of the child_type ivar in parent_type.  If it can't
   // find the offset, returns LLDB_INVALID_IVAR_OFFSET.
 
Index: lldb/trunk/source/API/SBTarget.cpp
===
--- lldb/trunk/source/API/SBTarget.cpp
+++ lldb/trunk/source/API/SBTarget.cpp
@@ -53,7 +53,6 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -1847,25 +1846,18 @@
   }
 }
 
-// Didn't find the type in the symbols; try the Objective-C runtime if one
-// is installed
-
-ProcessSP process_sp(target_sp->GetProcessSP());
-
-if (process_sp) {
-  ObjCLanguageRuntime *objc_language_runtime =
-  ObjCLanguageRuntime::Get(*process_sp);
-
-  if (objc_language_runtime) {
-DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor();
-
-if (objc_decl_vendor) {
+// Didn't find the type in the symbols; Try the loaded language runtimes
+// FIXME: This depends on clang, but should be able to support any
+// TypeSystem/compiler.
+if (auto process_sp = target_sp->GetProcessSP()) {
+  for (auto *runtime : process_sp->GetLanguageRuntimes()) {
+if (auto vendor = runtime->GetDeclVendor()) {
   std::vector decls;
-
-  if (objc_decl_vendor->FindDecls(const_typename, true, 1, decls) > 0) {
-if (CompilerType type = ClangASTContext::GetTypeForDecl(decls[0])) {
+  if (vendor->FindDecls(const_typename, /*append*/ true,
+/*max_matches*/ 1, decls) > 0) {
+if (CompilerType type =
+ClangASTContext::GetTypeForDecl(decls.front()))
   return LLDB_RECORD_RESULT(SBType(type));
-}
   }
 }
   }
@@ -1918,25 +1910,18 @@
   }
 }
 
-// Try the Objective-C runtime if one is installed
-
-ProcessSP process_sp(target_sp->GetProcessSP());
-
-if (process_sp) {
-  ObjCLanguageRuntime *objc_language_runtime =
-  ObjCLanguageRuntime::Get(*process_sp);
-
-  if (objc_language_runtime) {
-DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor();
-
-if (objc_decl_vendor) {
+// Try the loaded language runtimes
+// FIXME: This depends on clang, but should be able to support any
+// TypeSystem/compiler.
+if (auto process_sp = target_sp->GetProcessSP()) {
+  for (auto *runtime : process_sp->GetLanguageRuntimes()) {
+if (auto *vendor = runtime->GetDeclVendor()) {
   std::vector decls;
-
-  if (objc_decl_vendor->FindDecls(const_typename, true, 1, decls) > 0) {
-for (clang::N

[Lldb-commits] [lldb] r364240 - Add windows abi plugin, breakpointprecondition.

2019-06-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Jun 24 14:48:13 2019
New Revision: 364240

URL: http://llvm.org/viewvc/llvm-project?rev=364240&view=rev
Log:
Add windows abi plugin, breakpointprecondition.

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=364240&r1=364239&r2=364240&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jun 24 14:48:13 2019
@@ -91,6 +91,7 @@
267F684A1CC02DED0086832B /* ABISysV_s390x.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 267F68471CC02DED0086832B /* ABISysV_s390x.cpp 
*/; };
267F684B1CC02DED0086832B /* ABISysV_s390x.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 267F68481CC02DED0086832B /* ABISysV_s390x.h */; 
};
26DB3E1F1379E7AD0080DC73 /* ABISysV_x86_64.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26DB3E131379E7AD0080DC73 /* ABISysV_x86_64.cpp 
*/; };
+   AF352EDE22C17BD800D058B6 /* ABIWindows_x86_64.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = AF352EDB22C17BD700D058B6 /* 
ABIWindows_x86_64.cpp */; };
2689006713353E0E00698AC0 /* ASTDumper.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4906FD4012F2255300A2A77C /* ASTDumper.cpp */; };
2689006813353E0E00698AC0 /* ASTResultSynthesizer.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 49A8A39F11D568A300AD3B68 /* 
ASTResultSynthesizer.cpp */; };
2689006913353E0E00698AC0 /* ASTStructExtractor.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 491193501226386000578B7F /* 
ASTStructExtractor.cpp */; };
@@ -145,6 +146,7 @@
2689FFFB13353DB600698AC0 /* BreakpointLocationList.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1010F1B83100F91463 /* 
BreakpointLocationList.cpp */; };
4CAA19E61F5A40040099E692 /* BreakpointName.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4C7D48281F509CCD005314B4 /* BreakpointName.cpp 
*/; };
2689FFFD13353DB600698AC0 /* BreakpointOptions.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 26BC7E1110F1B83100F91463 /* 
BreakpointOptions.cpp */; };
+   AF352EE122C17C0D00D058B6 /* BreakpointPrecondition.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = AF352EE022C17C0C00D058B6 /* 
BreakpointPrecondition.cpp */; };
268913353DB600698AC0 /* BreakpointResolver.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 26BC7E1210F1B83100F91463 /* 
BreakpointResolver.cpp */; };
2689000113353DB600698AC0 /* BreakpointResolverAddress.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 26D0DD5310FE555900271C65 /* 
BreakpointResolverAddress.cpp */; };
2689000313353DB600698AC0 /* BreakpointResolverFileLine.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 26D0DD5410FE555900271C65 /* 
BreakpointResolverFileLine.cpp */; };
@@ -1419,6 +1421,8 @@
267F68481CC02DED0086832B /* ABISysV_s390x.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
ABISysV_s390x.h; sourceTree = ""; };
26DB3E131379E7AD0080DC73 /* ABISysV_x86_64.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ABISysV_x86_64.cpp; sourceTree = ""; };
26DB3E141379E7AD0080DC73 /* ABISysV_x86_64.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
ABISysV_x86_64.h; sourceTree = ""; };
+   AF352EDB22C17BD700D058B6 /* ABIWindows_x86_64.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = ABIWindows_x86_64.cpp; sourceTree = ""; };
+   AF352EDC22C17BD700D058B6 /* ABIWindows_x86_64.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
ABIWindows_x86_64.h; sourceTree = ""; };
264A12FF137252C700875C42 /* ARM64_DWARF_Registers.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ARM64_DWARF_Registers.h; path = source/Utility/ARM64_DWARF_Registers.h; 
sourceTree = ""; };
B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = ""; };
B23DD24F12EDFAC1000C3894 /* ARMUtils.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ARMUtils.h; path = Utility/ARMUtils.h; sourceTree = ""; };
@@ -1523,6 +1527,7 @@
4C7D482B1F509CF5005314B4 /* BreakpointName.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
BreakpointName.h; path = include/lldb/Breakpoint/Break

[Lldb-commits] [lldb] r364243 - Don't link against the DebugSymbols private framework; try to dlopen

2019-06-24 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Jun 24 15:08:43 2019
New Revision: 364243

URL: http://llvm.org/viewvc/llvm-project?rev=364243&view=rev
Log:
Don't link against the DebugSymbols private framework; try to dlopen
+ dlsym the two functions we need from there at runtime.

I'm not maintaining a negative cache if DebugSymbols is absent, so
we'll try to dlopen() it on every call to
LocateMacOSXFilesUsingDebugSymbols but this file is only built on
mac and iOS type systems, so there's a slight perf impact running
lldb on an iOS type system.

I store the function pointer results in two global variables without
any locking; two threads calling into LocateMacOSXFilesUsingDebugSymbols
for the first time will both try to set these fptrs, but they'll be
setting them to the same value, so I'm not too worried.

I didn't see where in the cmake build configurations we link against
DebugSymbols, but I removed the dependency from the xcode project
file.

 




Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Symbol/LocateSymbolFileMacOSX.cpp

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=364243&r1=364242&r2=364243&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Jun 24 15:08:43 2019
@@ -1824,7 +1824,6 @@
6D0F613C1C80AA8900A4ECEE /* DebugMacros.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
DebugMacros.h; path = include/lldb/Symbol/DebugMacros.h; sourceTree = 
""; };
AF116BED20CF234B0071093F /* DebugNamesDWARFIndex.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DebugNamesDWARFIndex.cpp; sourceTree = ""; };
AF116BEE20CF234B0071093F /* DebugNamesDWARFIndex.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DebugNamesDWARFIndex.h; sourceTree = ""; };
-   265ABF6210F42EE900531910 /* DebugSymbols.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
DebugSymbols.framework; path = 
/System/Library/PrivateFrameworks/DebugSymbols.framework; sourceTree = 
""; };
263664921140A4930075843B /* Debugger.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
lineEnding = 0; name = Debugger.cpp; path = source/Core/Debugger.cpp; 
sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
263664941140A4C10075843B /* Debugger.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
lineEnding = 0; name = Debugger.h; path = include/lldb/Core/Debugger.h; 
sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; 
};
49B01A2D15F67B1700666829 /* DeclVendor.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DeclVendor.h; path 
= include/lldb/Symbol/DeclVendor.h; sourceTree = ""; };
@@ -6056,7 +6055,6 @@
isa = PBXGroup;
children = (
26F5C39010F3FA26009D5894 /* 
CoreFoundation.framework */,
-   265ABF6210F42EE900531910 /* 
DebugSymbols.framework */,
260C876910F538E700BB2B04 /* 
Foundation.framework */,
26709E311964A34000B94724 /* 
LaunchServices.framework */,
26F5C32A10F3DFDD009D5894 /* libedit.dylib */,
@@ -9173,8 +9171,6 @@
"-framework",
Foundation,
"-framework",
-   DebugSymbols,
-   "-framework",
Security,
"-framework",
CoreServices,
@@ -9213,8 +9209,6 @@
"-framework",
Foundation,
"-framework",
-   DebugSymbols,
-   "-framework",
Security,
"-framework",
CoreServices,
@@ -9253,8 +9247,6 @@
"-framework",
Foundation,
"-framework",
-   DebugSymbols,
-   "-framework",
Security,
"-framework",
   

[Lldb-commits] [PATCH] D63240: [Core] Generalize ValueObject::IsRuntimeSupportValue

2019-06-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: include/lldb/Target/LanguageRuntime.h:157
+  virtual bool IsRuntimeSupportValue(ValueObject &valobj) {
+return valobj.GetVariable() && valobj.GetVariable()->IsArtificial();
+  }

I think this function should not be part of LanguageRuntime any more since 
there is nothing runtime-specific about it any more.Instead, it should probably 
be a function implemented by ValueObjectVariable. The Whitelist make still 
sense in the runtime of course.


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

https://reviews.llvm.org/D63240



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


[Lldb-commits] [PATCH] D62183: [Windows] Fix race condition between state changes

2019-06-24 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

zturner is not a regular here anymore.  I think he pops in from time-to-time, 
but I wouldn't depend on just him for a review.

Are you still wanting to land this?  If you rebase and add me as a reviewer, 
I'd be happy to take a look.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62183



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


[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere 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/D63745/new/

https://reviews.llvm.org/D63745



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


[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Davide Italiano via Phabricator via lldb-commits
davide created this revision.
davide added reviewers: JDevlieghere, sgraenitz, aprantl, friss.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63745

Files:
  lldb/CMakeLists.txt


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -72,6 +72,20 @@
 message(FATAL_ERROR "LLDB test compilers not specified.  Tests will not 
run")
   endif()
 
+  # On MacOS, debugserver needs to be codesigned. Check if we have a 
certificate instead
+  # of failing in the middle of the build.
+  if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND TARGET debugserver)
+execute_process(
+  COMMAND security find-certificate -Z -p -c lldb_codesign 
/Library/Keychains/System.keychain
+  RESULT_VARIABLE cert_return
+  OUTPUT_QUIET
+  ERROR_QUIET)
+
+if (cert_return)
+  message(FATAL_ERROR "Certificate for debugserver not found. Run 
scripts/macos-setup-codesign.sh")
+endif()
+  endif()
+
   set(LLDB_TEST_DEPS lldb)
 
   # darwin-debug is an hard dependency for the testsuite.


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -72,6 +72,20 @@
 message(FATAL_ERROR "LLDB test compilers not specified.  Tests will not run")
   endif()
 
+  # On MacOS, debugserver needs to be codesigned. Check if we have a certificate instead
+  # of failing in the middle of the build.
+  if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND TARGET debugserver)
+execute_process(
+  COMMAND security find-certificate -Z -p -c lldb_codesign /Library/Keychains/System.keychain
+  RESULT_VARIABLE cert_return
+  OUTPUT_QUIET
+  ERROR_QUIET)
+
+if (cert_return)
+  message(FATAL_ERROR "Certificate for debugserver not found. Run scripts/macos-setup-codesign.sh")
+endif()
+  endif()
+
   set(LLDB_TEST_DEPS lldb)
 
   # darwin-debug is an hard dependency for the testsuite.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

rdar://problem/52078735


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63745



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


[Lldb-commits] [PATCH] D63240: [Core] Generalize ValueObject::IsRuntimeSupportValue

2019-06-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai marked an inline comment as done.
xiaobai added inline comments.



Comment at: include/lldb/Target/LanguageRuntime.h:157
+  virtual bool IsRuntimeSupportValue(ValueObject &valobj) {
+return valobj.GetVariable() && valobj.GetVariable()->IsArtificial();
+  }

aprantl wrote:
> I think this function should not be part of LanguageRuntime any more since 
> there is nothing runtime-specific about it any more.Instead, it should 
> probably be a function implemented by ValueObjectVariable. The Whitelist make 
> still sense in the runtime of course.
I think you're right. No LanguageRuntime currently overrides this and 
ValueObject uses this anyway as a fallback. If any language runtime needs to 
implement this kind of behavior, we can add it back at that time.


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

https://reviews.llvm.org/D63240



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


[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

On second thought, let's check that LLDB_CODESIGN_IDENTITY equals 
`lldb_codesign` before doing this check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63745



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


[Lldb-commits] [lldb] r364260 - Reapply "Fix a crash in option parsing."

2019-06-24 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Mon Jun 24 17:55:27 2019
New Revision: 364260

URL: http://llvm.org/viewvc/llvm-project?rev=364260&view=rev
Log:
Reapply "Fix a crash in option parsing."

with an additional read-out-of-bounds bugfix applied.

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

Added:
lldb/trunk/lit/Driver/Inputs/process_attach_pid.in
lldb/trunk/lit/Driver/TestProcessAttach.test
Modified:
lldb/trunk/source/Interpreter/Options.cpp

Added: lldb/trunk/lit/Driver/Inputs/process_attach_pid.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/process_attach_pid.in?rev=364260&view=auto
==
--- lldb/trunk/lit/Driver/Inputs/process_attach_pid.in (added)
+++ lldb/trunk/lit/Driver/Inputs/process_attach_pid.in Mon Jun 24 17:55:27 2019
@@ -0,0 +1,2 @@
+process attach --pid
+

Added: lldb/trunk/lit/Driver/TestProcessAttach.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestProcessAttach.test?rev=364260&view=auto
==
--- lldb/trunk/lit/Driver/TestProcessAttach.test (added)
+++ lldb/trunk/lit/Driver/TestProcessAttach.test Mon Jun 24 17:55:27 2019
@@ -0,0 +1,2 @@
+# RUN: %lldb -x -b -S %S/Inputs/process_attach_pid.in 2>&1 | FileCheck %s
+# CHECK: last option requires an argument

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=364260&r1=364259&r2=364260&view=diff
==
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Mon Jun 24 17:55:27 2019
@@ -1355,13 +1355,23 @@ llvm::Expected Options::Parse(cons
 }
   }
   std::vector argv = GetArgvForParsing(args);
+  // If the last option requires an argument but doesn't have one,
+  // some implementations of getopt_long will still try to read it.
+  char overflow = 0;
+  argv.push_back(&overflow);
   std::unique_lock lock;
   OptionParser::Prepare(lock);
   int val;
   while (true) {
 int long_options_index = -1;
-val = OptionParser::Parse(argv.size(), &*argv.begin(), sstr.GetString(),
+val = OptionParser::Parse(argv.size() - 1, &*argv.begin(), 
sstr.GetString(),
   long_options, &long_options_index);
+
+if ((size_t)OptionParser::GetOptionIndex() > argv.size() - 1) {
+  error.SetErrorStringWithFormat("last option requires an argument");
+  break;
+}
+
 if (val == -1)
   break;
 
@@ -1439,6 +1449,7 @@ llvm::Expected Options::Parse(cons
   if (error.Fail())
 return error.ToError();
 
+  argv.pop_back();
   argv.erase(argv.begin(), argv.begin() + OptionParser::GetOptionIndex());
   return ReconstituteArgsAfterParsing(argv, args);
 }


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


[Lldb-commits] [PATCH] D63240: [Core] Generalize ValueObject::IsRuntimeSupportValue

2019-06-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 206351.
xiaobai added a comment.

Address feedback


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

https://reviews.llvm.org/D63240

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

Index: source/Target/ObjCLanguageRuntime.cpp
===
--- source/Target/ObjCLanguageRuntime.cpp
+++ source/Target/ObjCLanguageRuntime.cpp
@@ -46,19 +46,6 @@
   return name == g_self || name == g_cmd;
 }
 
-bool ObjCLanguageRuntime::IsRuntimeSupportValue(ValueObject &valobj) {
-  // All runtime support values have to be marked as artificial by the
-  // compiler. But not all artificial variables should be hidden from
-  // the user.
-  if (!valobj.GetVariable())
-return false;
-  if (!valobj.GetVariable()->IsArtificial())
-return false;
-
-  // Whitelist "self" and "_cmd".
-  return !IsWhitelistedRuntimeValue(valobj.GetName());
-}
-
 bool ObjCLanguageRuntime::AddClass(ObjCISA isa,
const ClassDescriptorSP &descriptor_sp,
const char *class_name) {
Index: source/Target/CPPLanguageRuntime.cpp
===
--- source/Target/CPPLanguageRuntime.cpp
+++ source/Target/CPPLanguageRuntime.cpp
@@ -43,20 +43,8 @@
 CPPLanguageRuntime::CPPLanguageRuntime(Process *process)
 : LanguageRuntime(process) {}
 
-bool CPPLanguageRuntime::IsRuntimeSupportValue(ValueObject &valobj) {
-  // All runtime support values have to be marked as artificial by the
-  // compiler. But not all artificial variables should be hidden from
-  // the user.
-  if (!valobj.GetVariable())
-return false;
-  if (!valobj.GetVariable()->IsArtificial())
-return false;
-
-  // Whitelist "this" and since there is no ObjC++ runtime, any ObjC names.
-  ConstString name = valobj.GetName();
-  if (name == g_this)
-return false;
-  return !ObjCLanguageRuntime::IsWhitelistedRuntimeValue(name);
+bool CPPLanguageRuntime::IsWhitelistedRuntimeValue(ConstString name) {
+  return name == g_this;
 }
 
 bool CPPLanguageRuntime::GetObjectDescription(Stream &str,
Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -1696,15 +1696,21 @@
 bool ValueObject::IsRuntimeSupportValue() {
   Process *process(GetProcessSP().get());
   if (process) {
-LanguageRuntime *runtime =
-process->GetLanguageRuntime(GetObjectRuntimeLanguage());
-if (!runtime)
-  runtime = ObjCLanguageRuntime::Get(*process);
-if (runtime)
-  return runtime->IsRuntimeSupportValue(*this);
-// If there is no language runtime, trust the compiler to mark all
-// runtime support variables as artificial.
-return GetVariable() && GetVariable()->IsArtificial();
+bool marked_as_runtime_support_val = GetVariable() && GetVariable()->IsArtificial();
+
+// It's possible we have more than one language involved here. For example,
+// in ObjC `_cmd` is a whitelisted runtime variable name, but
+// GetObjectRuntimeLanguage will say it's a C variable since it's just a
+// cstring.
+for (auto *runtime : process->GetLanguageRuntimes()) {
+  if (marked_as_runtime_support_val && runtime->IsWhitelistedRuntimeValue(GetName()))
+return false;
+}
+
+// If no language runtime claims that this is a whitelisted runtime support
+// value, then we trust that the compiler did the right thing and marked
+// runtime support values as artificial.
+return marked_as_runtime_support_val;
   }
   return false;
 }
Index: include/lldb/Target/ObjCLanguageRuntime.h
===
--- include/lldb/Target/ObjCLanguageRuntime.h
+++ include/lldb/Target/ObjCLanguageRuntime.h
@@ -301,8 +301,7 @@
 
   /// Check whether the name is "self" or "_cmd" and should show up in
   /// "frame variable".
-  static bool IsWhitelistedRuntimeValue(ConstString name);
-  bool IsRuntimeSupportValue(ValueObject &valobj) override;
+  bool IsWhitelistedRuntimeValue(ConstString name) override;
 
 protected:
   // Classes that inherit from ObjCLanguageRuntime can see and modify these
Index: include/lldb/Target/LanguageRuntime.h
===
--- include/lldb/Target/LanguageRuntime.h
+++ include/lldb/Target/LanguageRuntime.h
@@ -152,9 +152,9 @@
   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.
-  virtua

[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This code should go to `tools/debugserver/source/CMakeLists.txt` so that it is 
next to the code which performs the actual code signing. Doing that will make 
it easier to keep it in sync with changes to code signing, as well as make it 
obvious that it is not in sync with them right now (there's a pretty complex 
interaction of various cmake options (LLDB_CODESIGN_IDENTITY, 
LLVM_CODESIGNING_IDENTITY, LLDB_USE_SYSTEM_DEBUGSERVER, etc.) which affects 
code signing, and this code is ignoring all of those)...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63745



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


[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D63745#1556773 , @JDevlieghere 
wrote:

> On second thought, let's check that LLDB_CODESIGN_IDENTITY equals 
> `lldb_codesign` before doing this check.


This question isn't important but I'm kind of curious: Does it have to be 
called lldb_codesign? Could you have an arbitrary identity and then sign with 
that, assuming the cert exists, or does debugserver expect a cert with that 
name exactly?




Comment at: lldb/CMakeLists.txt:77
+  # of failing in the middle of the build.
+  if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND TARGET debugserver)
+execute_process(

I think `CMAKE_SYSTEM_NAME MATCHES "Darwin"` is redundant because debugserver 
should only be a target if you're running on Darwin, per the logic in 
`tools/CMakeLists.txt`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63745



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


[Lldb-commits] [PATCH] D63745: [CMake] Check that a certificate for lldb is present at build time.

2019-06-24 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D63745#1556941 , @labath wrote:

> This code should go to `tools/debugserver/source/CMakeLists.txt` so that it 
> is next to the code which performs the actual code signing. Doing that will 
> make it easier to keep it in sync with changes to code signing, as well as 
> make it obvious that it is not in sync with them right now (there's a pretty 
> complex interaction of various cmake options (LLDB_CODESIGN_IDENTITY, 
> LLVM_CODESIGNING_IDENTITY, LLDB_USE_SYSTEM_DEBUGSERVER, etc.) which affects 
> code signing, and this code is ignoring all of those)...


+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63745



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