[Lldb-commits] [PATCH] D63268: Make UniqueCStringMap work with non-default-constructible types and other improvements/cleanups

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

Thanks for the heads up. This should be fixed with r363653.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63268



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


Re: [Lldb-commits] [PATCH] D63441: [zorg] Add lldb-arm-ubuntu builder

2019-06-18 Thread Omair Javaid via lldb-commits
On Mon, 17 Jun 2019 at 22:30, Jan Kratochvil via Phabricator
 wrote:
>
> jankratochvil added a comment.
>
> > It ll run on staging master until tests become stable.
>
> BTW the silent master is now dead since 2019-06-13.

I thought its down temporarily. Any idea if it is permanently dead?

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


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


[Lldb-commits] [PATCH] D63441: [zorg] Add lldb-arm-ubuntu builder

2019-06-18 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363659: [zorg] Add lldb-arm-ubuntu builder (authored by 
omjavaid, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63441?vs=205101&id=205296#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63441

Files:
  zorg/trunk/buildbot/osuosl/master/config/builders.py
  zorg/trunk/buildbot/osuosl/master/config/slaves.py
  zorg/trunk/buildbot/osuosl/master/config/status.py


Index: zorg/trunk/buildbot/osuosl/master/config/status.py
===
--- zorg/trunk/buildbot/osuosl/master/config/status.py
+++ zorg/trunk/buildbot/osuosl/master/config/status.py
@@ -279,7 +279,7 @@
 extraRecipients = ["omair.jav...@linaro.org"],
 subject="Build %(builder)s Failure",
 mode = "failing",
-builders = ["lldb-aarch64-ubuntu"],
+builders = ["lldb-arm-ubuntu","lldb-aarch64-ubuntu"],
 addLogs=False),
 InformativeMailNotifier(
 fromaddr = "llvm.buildmas...@lab.llvm.org",
Index: zorg/trunk/buildbot/osuosl/master/config/slaves.py
===
--- zorg/trunk/buildbot/osuosl/master/config/slaves.py
+++ zorg/trunk/buildbot/osuosl/master/config/slaves.py
@@ -40,6 +40,7 @@
 # sure we have plenty CPU cycle to satisfy timing assumptions.
 create_slave("linaro-armv8-01-arm-libcxx", properties={'jobs' : 1}, 
max_builds=1),
 create_slave("linaro-armv8-01-arm-libcxx-noeh", properties={'jobs' : 
1}, max_builds=1),
+create_slave("linaro-armv8-01-lldb-arm", properties={'jobs' : 64}, 
max_builds=1),
 # Packet.Net ThunderX1 for LLDB buildbot - Ubuntu Xenial 16.04 arm64 
container
 create_slave("linaro-thx1-lldb-aarch64", properties={'jobs': 16}, 
max_builds=1),
 
Index: zorg/trunk/buildbot/osuosl/master/config/builders.py
===
--- zorg/trunk/buildbot/osuosl/master/config/builders.py
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py
@@ -856,6 +856,17 @@
   '-DLLVM_USE_LINKER=gold',
   '-DCMAKE_C_COMPILER=clang',
   '-DCMAKE_CXX_COMPILER=clang++'])},
+{'name': "lldb-arm-ubuntu",
+ 'slavenames': ["linaro-armv8-01-lldb-arm"],
+ 'builddir': "lldb-cmake-arm",
+ 'category' : 'lldb',
+ 'factory': LLDBBuilder.getLLDBCMakeBuildFactory(
+test=True,
+extra_cmake_args=['-DLLVM_ENABLE_ASSERTIONS=True',
+  '-DLLVM_LIT_ARGS="-sv --threads=8"',
+  '-DLLVM_USE_LINKER=gold',
+  '-DCMAKE_C_COMPILER=clang',
+  '-DCMAKE_CXX_COMPILER=clang++'])},
 {'name': "lldb-x64-windows-ninja",
  'slavenames': ["win-py3-buildbot"],
  'builddir': "lldb-x64-windows-ninja",


Index: zorg/trunk/buildbot/osuosl/master/config/status.py
===
--- zorg/trunk/buildbot/osuosl/master/config/status.py
+++ zorg/trunk/buildbot/osuosl/master/config/status.py
@@ -279,7 +279,7 @@
 extraRecipients = ["omair.jav...@linaro.org"],
 subject="Build %(builder)s Failure",
 mode = "failing",
-builders = ["lldb-aarch64-ubuntu"],
+builders = ["lldb-arm-ubuntu","lldb-aarch64-ubuntu"],
 addLogs=False),
 InformativeMailNotifier(
 fromaddr = "llvm.buildmas...@lab.llvm.org",
Index: zorg/trunk/buildbot/osuosl/master/config/slaves.py
===
--- zorg/trunk/buildbot/osuosl/master/config/slaves.py
+++ zorg/trunk/buildbot/osuosl/master/config/slaves.py
@@ -40,6 +40,7 @@
 # sure we have plenty CPU cycle to satisfy timing assumptions.
 create_slave("linaro-armv8-01-arm-libcxx", properties={'jobs' : 1}, max_builds=1),
 create_slave("linaro-armv8-01-arm-libcxx-noeh", properties={'jobs' : 1}, max_builds=1),
+create_slave("linaro-armv8-01-lldb-arm", properties={'jobs' : 64}, max_builds=1),
 # Packet.Net ThunderX1 for LLDB buildbot - Ubuntu Xenial 16.04 arm64 container
 create_slave("linaro-thx1-lldb-aarch64", properties={'jobs': 16}, max_builds=1),
 
Index: zorg/trunk/buildbot/osuosl/master/config/builders.py
===
--- zorg/trunk/buildbot/osuosl/master/config/builders.py
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py
@@ -856,6 +856,17 @@
   '-DLLVM_USE_LI

Re: [Lldb-commits] [PATCH] D63441: [zorg] Add lldb-arm-ubuntu builder

2019-06-18 Thread Jan Kratochvil via lldb-commits
On Tue, 18 Jun 2019 12:17:52 +0200, Omair Javaid wrote:
> On Mon, 17 Jun 2019 at 22:30, Jan Kratochvil via Phabricator 
>  wrote:
> > BTW the silent master is now dead since 2019-06-13.
> 
> I thought its down temporarily. Any idea if it is permanently dead?

sorry for the wording, I did not mean it is permanently dead.

Galina, could you resurrect the silent buildbot master?
http://lab.llvm.org:8014/


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


[Lldb-commits] [PATCH] D63428: DWARF: Add "dwo_num" field to the DIERef class

2019-06-18 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 7 inline comments as done.
labath added a comment.

I've been thinking about the DIERef class a lot while doing this, and the more 
I thought about it, the more I became convinced that forcing everything to go 
through DIERefs is not a good idea. It is kind of useful to have it as a sort 
of exchange currency between various components, but that means it forces an 
particular access pattern for the debug info, one which may not be always 
optimal. For example, there's no reason why the manual index would need to use 
offsets of anything. Offsets require binary search, but the manual index has 
already gone through the debug info once, so it can easily remember the indexes 
of everything. Indexes don't need binary search, and they can be stored more 
compactly. Even for the debug_names index, which does use offsets, the DIERef 
representation is not the ideal form. That's because it uses unit-relative die 
indexes while DIERef stores the absolute index. This means it still has to look 
up the DWO unit in order to correctly construct an absolute die offset.

So, I was thinking that instead of the indexes handing vectors of DIERef, they 
could provide an iterator api that would return DWARFDIEs directly. This way 
each index would be completely free to use whatever internal representation it 
wants. All it would need to do is to be able to convert it to a DWARFDIE 
eventually. The reason I've put putting it off for now is that the iterators, 
when combined with the polymorphism of the index class can get a bit messy, and 
so I wasn't sure if this is worth that effort. However, I agree that the size 
of the manual index is important, so I am going to post a dumbed-down version 
of this idea, which uses a compact representation internally, but then still 
converts it to an array of DIERefs.




Comment at: source/Plugins/SymbolFile/DWARF/DIERef.h:59-62
+  unsigned m_dwo_num : 31;
   unsigned m_section : 1;
   dw_offset_t m_unit_offset;
   dw_offset_t m_die_offset;

clayborg wrote:
> I'm a bit concerned about increasing the size by 4 bytes here. All of our 
> indexes are using maps of name to DIERef objects right? 
I would say only the manual index is affected by this. All the indexes *return* 
results as a DIERef, but I don't think that's a problem because they don't 
store them this way internally.



Comment at: source/Plugins/SymbolFile/DWARF/DIERef.h:64
 };
+static_assert(sizeof(DIERef) == 12, "");
 

clayborg wrote:
> Insert a message here? 
What would you have me say? I can't think of anything that wouldn't already be 
obvious from the assert condition. I think that's one of the reasons why 
c++>=14 makes the message optional..



Comment at: source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:245-246
 
-DIERef ref(unit.GetDebugSection(), cu_offset, die.GetOffset());
+DIERef ref(unit.GetSymbolFileDWARF().GetDwoNum(), unit.GetDebugSection(),
+   unit.GetOffset(), die.GetOffset());
 switch (tag) {

clayborg wrote:
> Make a DWARFDIE accessor function?:
> ```
> DIERef DWARFDIE::GetDIERef() const;
> ```
Actually, there is one already, I just forgot to use it.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1494
+return DebugInfo()
+->GetUnitAtIndex(*die_ref.dwo_num())
+->GetDwoSymbolFile()

clayborg wrote:
> Can a DWO file be missing and ever return NULL here?
Given that the DWO numbers are completely made up and handed out by 
SymbolFileDWARFDwos, the only way you can get a valid dwo number is if you 
already had a SymbolFileDWARFDwo to give it to you. That means we can assume 
that the unit at the given index will be a skeleton unit and that it will 
contain a valid dwo symbol file.


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

https://reviews.llvm.org/D63428



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


[Lldb-commits] [PATCH] D63428: DWARF: Add "dwo_num" field to the DIERef class

2019-06-18 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 205319.
labath marked 2 inline comments as done.
labath added a comment.

- use the existing function for DWARFDIE->DIERef conversion
- fix a bug where we were ignoring the dwo_num and section fields when 
searching for all entries in a given unit. Technically, this was incorrect even 
when we introduced the "section" field, but there it did not matter because 
this function is only used for searching for global variables, and those don't 
appear in a type unit. Add a test.


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

https://reviews.llvm.org/D63428

Files:
  lit/SymbolFile/DWARF/find-variable-file.cpp
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/DIERef.cpp
  source/Plugins/SymbolFile/DWARF/DIERef.h
  source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  source/Plugins/SymbolFile/DWARF/NameToDIE.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  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
@@ -44,6 +44,8 @@
 
   DWARFCompileUnit *GetBaseCompileUnit() override { return &m_base_dwarf_cu; }
 
+  llvm::Optional GetDwoNum() override { return GetID() >> 32; }
+
 protected:
   void LoadSectionData(lldb::SectionType sect_type,
lldb_private::DWARFDataExtractor &data) override;
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -124,8 +124,7 @@
 
 DWARFDIE
 SymbolFileDWARFDwo::GetDIE(const DIERef &die_ref) {
-  lldbassert(!die_ref.unit_offset() ||
- *die_ref.unit_offset() == m_base_dwarf_cu.GetOffset());
-  return DebugInfo()->GetDIEForDIEOffset(die_ref.section(),
- die_ref.die_offset());
+  if (*die_ref.dwo_num() == GetDwoNum())
+return DebugInfo()->GetDIE(die_ref);
+  return GetBaseSymbolFile().GetDIE(die_ref);
 }
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -293,6 +293,8 @@
   // the method returns a pointer to the base compile unit.
   virtual DWARFCompileUnit *GetBaseCompileUnit() { return nullptr; }
 
+  virtual llvm::Optional GetDwoNum() { return llvm::None; }
+
   static bool
   DIEInDeclContext(const lldb_private::CompilerDeclContext *parent_decl_ctx,
const DWARFDIE &die);
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1216,24 +1216,20 @@
 debug_map->GetOSOIndexFromUserID(uid));
 return DecodedUID{
 *dwarf,
-{DIERef::Section::DebugInfo, DW_INVALID_OFFSET, dw_offset_t(uid)}};
+{llvm::None, DIERef::Section::DebugInfo, llvm::None, dw_offset_t(uid)}};
   }
-  DIERef::Section section =
-  uid >> 63 ? DIERef::Section::DebugTypes : DIERef::Section::DebugInfo;
-  uint32_t dwarf_id = uid >> 32 & 0x7fff;
   dw_offset_t die_offset = uid;
-
   if (die_offset == DW_INVALID_OFFSET)
 return llvm::None;
 
-  SymbolFileDWARF *dwarf = this;
-  if (DebugInfo()) {
-if (DWARFUnit *unit = DebugInfo()->GetUnitAtIndex(dwarf_id)) {
-  if (unit->GetDwoSymbolFile())
-dwarf = unit->GetDwoSymbolFile();
-}
-  }
-  return DecodedUID{*dwarf, {section, DW_INVALID_OFFSET, die_offset}};
+  DIERef::Section section =
+  uid >> 63 ? DIERef::Section::DebugTypes : DIERef::Section::DebugInfo;
+
+  llvm::Optional dwo_num = uid >> 32 & 0x7fff;
+  if (*dwo_num == 0x7fff)
+dwo_num = llvm::None;
+
+  return DecodedUID{*this, {dwo_num, section, llvm::None, die_offset}};
 }
 
 DWARF

[Lldb-commits] [PATCH] D63491: DWARF: Use a more compact internal representation in the manual dwarf index

2019-06-18 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, JDevlieghere, aprantl.
Herald added a subscriber: arphaman.
labath added a parent revision: D63428: DWARF: Add "dwo_num" field to the 
DIERef class.

Reduce the size of the manual index by storing the entries in a more
compact form. This introduces the CompressedRef class, which is similar
to the DIERef class, but it is more compact because it lacks the
unit_offset field (which is not necessary now, as the unit is uniquely
identified by the rest of the fields). The user_id_t representation
would have the same size, but I did not use that here because:

- it's more complicated to convert it to/from a DIERef
- it's more clunky to handle as it is just an integer

The new class is for internal use only. It is converted to a regular
DIERef before returning it to the outside world.


https://reviews.llvm.org/D63491

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

Index: source/Plugins/SymbolFile/DWARF/NameToDIE.h
===
--- source/Plugins/SymbolFile/DWARF/NameToDIE.h
+++ source/Plugins/SymbolFile/DWARF/NameToDIE.h
@@ -46,8 +46,39 @@
  const DIERef &die_ref)> const
   &callback) const;
 
-protected:
-  lldb_private::UniqueCStringMap m_map;
+private:
+  class CompressedRef {
+  public:
+CompressedRef(const DIERef &ref)
+: m_dwo_num(ref.dwo_num().getValueOr(invalid_dwo_num)),
+  m_section(ref.section()), m_die_offset(ref.die_offset()) {}
+
+operator DIERef() const {
+  return DIERef(dwo_num(), section(), llvm::None, die_offset());
+}
+
+llvm::Optional dwo_num() const {
+  if (m_dwo_num < invalid_dwo_num)
+return m_dwo_num;
+  return llvm::None;
+}
+
+DIERef::Section section() const {
+  return static_cast(m_section);
+}
+
+dw_offset_t die_offset() const { return m_die_offset; }
+
+  private:
+static constexpr uint32_t invalid_dwo_num = 0x7fff;
+
+unsigned m_dwo_num : 31;
+unsigned m_section : 1;
+dw_offset_t m_die_offset;
+  };
+  static_assert(sizeof(CompressedRef) == 8, "");
+
+  lldb_private::UniqueCStringMap m_map;
 };
 
 #endif // SymbolFileDWARF_NameToDIE_h_
Index: source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
===
--- source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -23,17 +23,24 @@
 }
 
 void NameToDIE::Insert(ConstString name, const DIERef &die_ref) {
-  assert(die_ref.unit_offset().hasValue());
   m_map.Append(name, die_ref);
 }
 
 size_t NameToDIE::Find(ConstString name, DIEArray &info_array) const {
-  return m_map.GetValues(name, info_array);
+  std::vector compressed;
+  size_t result = m_map.GetValues(name, compressed);
+  for (const CompressedRef &ref : compressed)
+info_array.push_back(ref);
+  return result;
 }
 
 size_t NameToDIE::Find(const RegularExpression ®ex,
DIEArray &info_array) const {
-  return m_map.GetValues(regex, info_array);
+  std::vector compressed;
+  size_t result = m_map.GetValues(regex, compressed);
+  for (const CompressedRef &ref : compressed)
+info_array.push_back(ref);
+  return result;
 }
 
 size_t NameToDIE::FindAllEntriesForUnit(const DWARFUnit &unit,
@@ -41,11 +48,12 @@
   const size_t initial_size = info_array.size();
   const uint32_t size = m_map.GetSize();
   for (uint32_t i = 0; i < size; ++i) {
-const DIERef &die_ref = m_map.GetValueAtIndexUnchecked(i);
-if (unit.GetSymbolFileDWARF().GetDwoNum() == die_ref.dwo_num() &&
-unit.GetDebugSection() == die_ref.section() &&
-unit.GetOffset() == *die_ref.unit_offset())
-  info_array.push_back(die_ref);
+const CompressedRef &ref = m_map.GetValueAtIndexUnchecked(i);
+if (unit.GetSymbolFileDWARF().GetDwoNum() == ref.dwo_num() &&
+unit.GetDebugSection() == ref.section() &&
+unit.GetOffset() <= ref.die_offset() &&
+ref.die_offset() < unit.GetNextUnitOffset())
+  info_array.push_back(ref);
   }
   return info_array.size() - initial_size;
 }
@@ -53,7 +61,7 @@
 void NameToDIE::Dump(Stream *s) {
   const uint32_t size = m_map.GetSize();
   for (uint32_t i = 0; i < size; ++i) {
-s->Format("{0} \"{1}\"\n", m_map.GetValueAtIndexUnchecked(i),
+s->Format("{0} \"{1}\"\n", DIERef(m_map.GetValueAtIndexUnchecked(i)),
   m_map.GetCStringAtIndexUnchecked(i));
   }
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D63491: DWARF: Use a more compact internal representation in the manual dwarf index

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

I made this depend on the DIERef patch instead of the other way around because 
the cleaner separation between dwo identifiers and compile unit offsets 
implemented in that patch makes it easier to implement this. It would still be 
possible to implement it the other way around, but the logic would be more 
complex, and it would have to be redone anyway once the DIERef patch lands.

Another possibility would be to just remove the unit_offset field from the 
DIERef class, and have the manual index keep using DIERefs. Once we introduce 
the dwo identifier, the unit offset is strictly optional, as the unit is 
uniquely identified by the other coordinates.


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

https://reviews.llvm.org/D63491



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


[Lldb-commits] [PATCH] D63491: DWARF: Use a more compact internal representation in the manual dwarf index

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

In D63491#1548238 , @labath wrote:

> I made this depend on the DIERef patch instead of the other way around 
> because the cleaner separation between dwo identifiers and compile unit 
> offsets implemented in that patch makes it easier to implement this. It would 
> still be possible to implement it the other way around, but the logic would 
> be more complex, and it would have to be redone anyway once the DIERef patch 
> lands.
>
> Another possibility would be to just remove the unit_offset field from the 
> DIERef class, and have the manual index keep using DIERefs. Once we introduce 
> the dwo identifier, the unit offset is strictly optional, as the unit is 
> uniquely identified by the other coordinates.


Lets just fix the DIERef class and remove the unit_offset field? No need for 
yet another minimal DIE reference class.


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

https://reviews.llvm.org/D63491



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


[Lldb-commits] [PATCH] D63491: DWARF: Use a more compact internal representation in the manual dwarf index

2019-06-18 Thread Pavel Labath via Phabricator via lldb-commits
labath abandoned this revision.
labath added a comment.

Ok, sounds good. In that case, I think I can squeeze that change into the 
previous patch in this series.


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

https://reviews.llvm.org/D63491



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


[Lldb-commits] [PATCH] D63491: DWARF: Use a more compact internal representation in the manual dwarf index

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

In D63491#1548400 , @labath wrote:

> Ok, sounds good. In that case, I think I can squeeze that change into the 
> previous patch in this series.


That will be great, thanks.


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

https://reviews.llvm.org/D63491



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


[Lldb-commits] [PATCH] D63110: Fix a crash in option parsing.

2019-06-18 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

This test is extremely flaky on Windows - it looks like it passes on the bot 
less than 10% of the time: 
http://lab.llvm.org:8011/buildslaves/win-py3-buildbot.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63110



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


[Lldb-commits] [PATCH] D63268: Make UniqueCStringMap work with non-default-constructible types and other improvements/cleanups

2019-06-18 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

Thanks!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63268



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


[Lldb-commits] [lldb] r363697 - [Reproducers] Make reproducer relocatable

2019-06-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Jun 18 09:20:17 2019
New Revision: 363697

URL: http://llvm.org/viewvc/llvm-project?rev=363697&view=rev
Log:
[Reproducers] Make reproducer relocatable

Before this patch, reproducers weren't relocatable. The reproducer
contained hard coded paths in the VFS mapping, as well in the yaml file
listing the different input files for the command interpreter. This
patch changes that:

 - Use relative paths for the DataCollector.
 - Use an overlay prefix for the FileCollector.

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

Modified:
lldb/trunk/include/lldb/Utility/FileCollector.h
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/lit/Reproducer/TestReuseDirectory.test
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Utility/FileCollector.cpp
lldb/trunk/unittests/Utility/FileCollectorTest.cpp

Modified: lldb/trunk/include/lldb/Utility/FileCollector.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileCollector.h?rev=363697&r1=363696&r2=363697&view=diff
==
--- lldb/trunk/include/lldb/Utility/FileCollector.h (original)
+++ lldb/trunk/include/lldb/Utility/FileCollector.h Tue Jun 18 09:20:17 2019
@@ -25,7 +25,7 @@ namespace lldb_private {
 /// the VFS.
 class FileCollector {
 public:
-  FileCollector(const FileSpec &root);
+  FileCollector(const FileSpec &root, const FileSpec &overlay);
 
   void AddFile(const llvm::Twine &file);
   void AddFile(const FileSpec &file) { return AddFile(file.GetPath()); }
@@ -59,6 +59,9 @@ protected:
   /// The root directory where files are copied.
   FileSpec m_root;
 
+  /// The root directory where the VFS overlay lives.
+  FileSpec m_overlay_root;
+
   /// Tracks already seen files so they can be skipped.
   llvm::StringSet<> m_seen;
 

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=363697&r1=363696&r2=363697&view=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Tue Jun 18 09:20:17 2019
@@ -91,7 +91,8 @@ public:
 
   FileProvider(const FileSpec &directory)
   : Provider(directory),
-m_collector(directory.CopyByAppendingPathComponent("root")) {}
+m_collector(directory.CopyByAppendingPathComponent("root"), directory) 
{
+  }
 
   FileCollector &GetFileCollector() { return m_collector; }
 
@@ -132,8 +133,8 @@ public:
 class DataRecorder {
 public:
   DataRecorder(const FileSpec &filename, std::error_code &ec)
-  : m_filename(std::move(filename)),
-m_os(m_filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) 
{}
+  : m_filename(filename.GetFilename().GetStringRef()),
+m_os(filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) {}
 
   static llvm::Expected>
   Create(const FileSpec &filename);

Modified: lldb/trunk/lit/Reproducer/TestReuseDirectory.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestReuseDirectory.test?rev=363697&r1=363696&r2=363697&view=diff
==
--- lldb/trunk/lit/Reproducer/TestReuseDirectory.test (original)
+++ lldb/trunk/lit/Reproducer/TestReuseDirectory.test Tue Jun 18 09:20:17 2019
@@ -8,3 +8,10 @@
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path 
%t.repro %t.out | FileCheck %S/TestGDBRemoteRepro.test --check-prefix CHECK 
--check-prefix CAPTURE
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path 
%t.repro %t.out | FileCheck %S/TestGDBRemoteRepro.test --check-prefix CHECK 
--check-prefix CAPTURE
 # RUN: %lldb --replay %t.repro | FileCheck %S/TestGDBRemoteRepro.test 
--check-prefix CHECK --check-prefix REPLAY
+
+# Test that we can replay from a different location, i.e. that the reproducer
+# is relocatable.
+
+# RUN: rm -rf %t.repro_moved
+# RUN: mv %t.repro %t.repro_moved
+# RUN: %lldb --replay %t.repro_moved | FileCheck %S/TestGDBRemoteRepro.test 
--check-prefix CHECK --check-prefix REPLAY

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=363697&r1=363696&r2=363697&view=diff
==
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Tue Jun 18 09:20:17 2019
@@ -82,6 +82,12 @@ public:
 if (auto err = yin.error())
   return {};
 
+for (auto &file : files) {
+  FileSpec absolute_path =
+  loader->GetRoot().CopyByAppendingPathComponent(file);
+  file = absolute_path.GetPath();
+}
+
 return llvm::make_unique(std::move(files));
   }
 

Modified: lldb/trunk/source/Host/com

[Lldb-commits] [PATCH] D63467: [Reproducers] Make reproducer relocatable

2019-06-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363697: [Reproducers] Make reproducer relocatable (authored 
by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D63467?vs=205230&id=205373#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63467

Files:
  lldb/trunk/include/lldb/Utility/FileCollector.h
  lldb/trunk/include/lldb/Utility/Reproducer.h
  lldb/trunk/lit/Reproducer/TestReuseDirectory.test
  lldb/trunk/source/API/SBDebugger.cpp
  lldb/trunk/source/Host/common/FileSystem.cpp
  lldb/trunk/source/Utility/FileCollector.cpp
  lldb/trunk/unittests/Utility/FileCollectorTest.cpp

Index: lldb/trunk/lit/Reproducer/TestReuseDirectory.test
===
--- lldb/trunk/lit/Reproducer/TestReuseDirectory.test
+++ lldb/trunk/lit/Reproducer/TestReuseDirectory.test
@@ -8,3 +8,10 @@
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %S/TestGDBRemoteRepro.test --check-prefix CHECK --check-prefix CAPTURE
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %S/TestGDBRemoteRepro.test --check-prefix CHECK --check-prefix CAPTURE
 # RUN: %lldb --replay %t.repro | FileCheck %S/TestGDBRemoteRepro.test --check-prefix CHECK --check-prefix REPLAY
+
+# Test that we can replay from a different location, i.e. that the reproducer
+# is relocatable.
+
+# RUN: rm -rf %t.repro_moved
+# RUN: mv %t.repro %t.repro_moved
+# RUN: %lldb --replay %t.repro_moved | FileCheck %S/TestGDBRemoteRepro.test --check-prefix CHECK --check-prefix REPLAY
Index: lldb/trunk/include/lldb/Utility/FileCollector.h
===
--- lldb/trunk/include/lldb/Utility/FileCollector.h
+++ lldb/trunk/include/lldb/Utility/FileCollector.h
@@ -25,7 +25,7 @@
 /// the VFS.
 class FileCollector {
 public:
-  FileCollector(const FileSpec &root);
+  FileCollector(const FileSpec &root, const FileSpec &overlay);
 
   void AddFile(const llvm::Twine &file);
   void AddFile(const FileSpec &file) { return AddFile(file.GetPath()); }
@@ -59,6 +59,9 @@
   /// The root directory where files are copied.
   FileSpec m_root;
 
+  /// The root directory where the VFS overlay lives.
+  FileSpec m_overlay_root;
+
   /// Tracks already seen files so they can be skipped.
   llvm::StringSet<> m_seen;
 
Index: lldb/trunk/include/lldb/Utility/Reproducer.h
===
--- lldb/trunk/include/lldb/Utility/Reproducer.h
+++ lldb/trunk/include/lldb/Utility/Reproducer.h
@@ -91,7 +91,8 @@
 
   FileProvider(const FileSpec &directory)
   : Provider(directory),
-m_collector(directory.CopyByAppendingPathComponent("root")) {}
+m_collector(directory.CopyByAppendingPathComponent("root"), directory) {
+  }
 
   FileCollector &GetFileCollector() { return m_collector; }
 
@@ -132,8 +133,8 @@
 class DataRecorder {
 public:
   DataRecorder(const FileSpec &filename, std::error_code &ec)
-  : m_filename(std::move(filename)),
-m_os(m_filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) {}
+  : m_filename(filename.GetFilename().GetStringRef()),
+m_os(filename.GetPath(), ec, llvm::sys::fs::F_Text), m_record(true) {}
 
   static llvm::Expected>
   Create(const FileSpec &filename);
Index: lldb/trunk/unittests/Utility/FileCollectorTest.cpp
===
--- lldb/trunk/unittests/Utility/FileCollectorTest.cpp
+++ lldb/trunk/unittests/Utility/FileCollectorTest.cpp
@@ -105,7 +105,7 @@
 TEST(FileCollectorTest, AddFile) {
   ScopedDir root("add_file_root", true);
   FileSpec root_fs(root.Path);
-  TestingFileCollector file_collector(root_fs);
+  TestingFileCollector file_collector(root_fs, root_fs);
 
   file_collector.AddFile(FileSpec("/path/to/a"));
   file_collector.AddFile(FileSpec("/path/to/b"));
@@ -132,7 +132,7 @@
   // Create file collector and add files.
   ScopedDir root("copy_files_root", true);
   FileSpec root_fs(root.Path);
-  TestingFileCollector file_collector(root_fs);
+  TestingFileCollector file_collector(root_fs, root_fs);
   file_collector.AddFile(a.Path);
   file_collector.AddFile(b.Path);
   file_collector.AddFile(c.Path);
@@ -174,7 +174,7 @@
   // Root where files are copied to.
   ScopedDir reproducer_root("reproducer_root", true);
   FileSpec root_fs(reproducer_root.Path);
-  TestingFileCollector file_collector(root_fs);
+  TestingFileCollector file_collector(root_fs, root_fs);
 
   // Add all the files to the collector.
   file_collector.AddFile(a.Path);
Index: lldb/trunk/source/API/SBDebugger.cpp
===
--- lldb/trunk/source/API/SBDebugger.cpp
+++ lldb/

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

2019-06-18 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour updated this revision to Diff 205390.
kusmour added a comment.

the OS check in SysV x64 ABI broke the test `SymbolFile/DWARF/debug_loc.s`
added a restriction `lld` to `#REQUIRES`


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213

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

Index: lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp
+++ lldb/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,
+  eRegisterIndexXmm7,
+  eRegisterIndexXmm8,
+  eRegisterIndexXmm9,
+  eRegisterIndexXmm10,
+  eRegisterIndexXmm11,
+  eRegisterIndexXmm12,
+  eRegisterIndexXmm13,
+  eRegisterIndexXmm14,
+  eRegisterIndexXmm15
 };
 
 // Array of all register information supported by Windows x86
@@ -133,14 +155,14 @@
  nullptr,
  0},
 {DEFINE_GPR(r10, nullptr),
- {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_REGNUM_GENERIC_ARG5,
+ {dwarf_r10_x86_64, dwarf_r10_x86_64, LLDB_INVALID_REGNUM,
   LLDB_INVALID_REGNUM, lldb_r10_x86_64},
  nullptr,
  nullptr,
  nullptr,
  0},
 {DEFINE_GPR(r11, nullptr),
- {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_REGNUM_GENERIC_ARG6,
+ {dwarf_r11_x86_64, dwarf_r11_x86_64, LLDB_INVALID_REGNUM,
   LLDB_INVALID_REGNUM, lldb_r11_x86_64},
  nullptr,
  nullptr,
@@ -188,6 +210,22 @@
  nullptr,
  nullptr,
  0},
+{DEFINE_FPU_XMM(xmm0)},
+{DEFINE_FPU_XMM(xmm1)},
+{DEFINE_FPU_XMM(xmm2)},
+{DEFINE_FPU_XMM(xmm3)},
+{DEFINE_FPU_XMM(xmm4)},
+{DEFINE_FPU_XMM(xmm5)},
+{DEFINE_FPU_XMM(xmm6)},
+{DEFINE_FPU_XMM(xmm7)},
+{DEFINE_FPU_XMM(xmm8)},
+{DEFINE_FPU_XMM(xmm9)},
+{DEFINE_FPU_XMM(xmm10)},
+{DEFINE_FPU_XMM(xmm11)},
+{DEFINE_FPU_XMM(xmm12)},
+{DEFINE_FPU_XMM(xmm13)},
+{DEFINE_FPU_XMM(xmm14)},
+{DEFINE_FPU_XMM(xmm15)}
 };
 
 static size_t k_num_register_infos = llvm::array_lengthof(g_register_infos);
@@ -202,10 +240,20 @@
 eRegisterIndexR12, eRegisterIndexR13, eRegisterIndexR14,
 eRegisterIndexR15, eRegisterIndexRip, eRegisterIndexRflags};
 
+uint32_t g_fpu_reg_indices[] = {
+eRegisterIndexXmm0,  eRegisterIndexXmm1,  eRegisterIndexXmm2,
+eRegisterIndexXmm3,  eRegisterIndexXmm4,  eRegisterIndexXmm5,
+eRegisterIndexXmm6,  eRegisterIndexXmm7,  eRegisterIndexXmm8,
+eRegisterIndexXmm9,  eRegisterIndexXmm10, eRegisterIndexXmm11,
+eRegisterIndexXmm12, eRegisterIndexXmm13, eRegisterIndexXmm14,
+eRegisterIndexXmm15
+};
+
 RegisterSet g_register_sets[] = {
 {"General Purpose Registers", "gpr",
  llvm::array_lengthof(g_gpr_reg_indices), g_gpr_reg_indices},
-};
+{"Floating Point Registers", "fpu",
+ llvm::array_lengthof(g_fpu_reg_indices), g_fpu_reg_indices}};
 }
 
 // Constructors and Destructors
@@ -242,7 +290,9 @@
   if (reg_info == nullptr)
 return false;
 
-  switch (reg_info->kinds[eRegisterKindLLDB]) {
+  const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+
+  switch (reg) {
   case lldb_rax_x86_64:
 reg_value.SetUInt64(m_context.Rax);
 break;
@@ -297,6 +347,70 @@
   case lldb_rflags_x86_64:
 reg_value.SetUInt64(m_context.EFlags);
 break;
+  case lldb_xmm0_x86_64:
+reg_value.SetBytes(&m_context.Xmm0,
+   reg_info->byte_size, endian::InlHostByteOrder());
+break;
+  case lldb_xmm1_x86_64:
+reg_value.SetBytes(&m_context.Xmm1,

[Lldb-commits] [PATCH] D62502: Implement xfer:libraries-svr4:read packet

2019-06-18 Thread António Afonso via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363707: Implement xfer:libraries-svr4:read packet (authored 
by aadsm, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62502?vs=204850&id=205400#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62502

Files:
  lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/main.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_a.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_a.mk
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_b_quote.cpp
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/svr4lib_b_quote.mk
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
  lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.h
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Index: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
===
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
@@ -32,6 +32,14 @@
 class MemoryRegionInfo;
 class ResumeActionList;
 
+struct SVR4LibraryInfo {
+  std::string name;
+  lldb::addr_t link_map;
+  lldb::addr_t base_addr;
+  lldb::addr_t ld_addr;
+  lldb::addr_t next;
+};
+
 // NativeProcessProtocol
 class NativeProcessProtocol {
 public:
@@ -86,6 +94,12 @@
 
   virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0;
 
+  virtual llvm::Expected>
+  GetLoadedSVR4Libraries() {
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "Not implemented");
+  }
+
   virtual bool IsAlive() const;
 
   virtual size_t UpdateThreads() = 0;
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -513,7 +513,8 @@
 self,
 inferior_args=None,
 inferior_sleep_seconds=3,
-inferior_exe_path=None):
+inferior_exe_path=None,
+inferior_env=None):
 """Prep the debug monitor, the inferior, and the expected packet stream.
 
 Handle the separate cases of using the debug monitor in attach-to-inferior mode
@@ -576,6 +577,9 @@
 
 # Build the expected protocol stream
 self.add_no_ack_remote_stream()
+if inferior_env:
+for name, value in inferior_env.items():
+self.add_set_environment_packets(name, value)
 if self._inferior_startup == self._STARTUP_LAUNCH:
 self.add_verified_launch_packets(launch_args)
 
@@ -656,6 +660,12 @@
  {"direction": "send", "regex": r"^\$(.+)#[0-9a-fA-F]{2}$", "capture": {1: "process_info_raw"}}],
 True)
 
+def add_set_environment_packets(self, name, value):
+self.test_sequence.add_log_lines(
+["read packet: $QEnvironment:" + name + "=" + value + "#00",
+ "send packet: $OK#00",
+ ], True)
+
 _KNOWN_PROCESS_INFO_KEYS = [
 "pid",
 "parent-pid",
@@ -816,6 +826,7 @@
 "error"])
 self.assertIsNotNone(val)
 
+mem_region_dict["name"] = seven.unhexlify(mem_region_dict.get("name", ""))
 # Return the dictionary of key-value pairs for the memory region.
 return mem_region_dict
 
@@ -1000,6 +1011,22 @@
 
 return context
 
+def continue_process_and_wait_for_stop(self):
+self.test_sequence.add_log_lines(
+[
+"read packet: $vCont;c#a8",
+{
+"direction": "send",
+"regex": r"^\$T([0-9a-fA-F]{2})(.*)#[0-9a-fA-F]{2}$",
+"capture": {1: "stop_signo", 2: "stop_key_val_text"},
+},
+],
+True,
+

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

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

In D62213#1548788 , @kusmour wrote:

> the OS check in SysV x64 ABI broke the test `SymbolFile/DWARF/debug_loc.s`


Can you elaborate on that? How exactly did it break this test?

> added a restriction `lld` to `#REQUIRES`

That definitely is not the right solution here. If you add lld to your checkout 
on windows, then "REQUIRES: lld" will be satisfied, but the test will (I guess) 
still fail. "XFAIL: system-windows" is probably what you want here, but it 
would be good to understand why this starts to fail now. Is it because we fail 
to detect that the file in question there is a linux file, and so the triple 
comes out like "x86_64--" or something? Maybe we should make the SysV abi 
plugin match unknown oss too... The only format where we have trouble 
determining the OS is ELF, and it's a pretty good bet that any elf file will be 
using the "SysV" ABI...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213



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


[Lldb-commits] [PATCH] D63370: Specify log level for CMake messages (less stderr)

2019-06-18 Thread Christoph Siedentop via Phabricator via lldb-commits
siedentop added a comment.

@sgraenitz I cannot merge the changes myself, could you please commit them for 
me?


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

https://reviews.llvm.org/D63370



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


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

2019-06-18 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour added a comment.

@labath Hi, you're right about the `lld`, it didn't make the test pass, instead 
it became unsupported.

In D62213#1548835 , @labath wrote:

> Can you elaborate on that? How exactly did it break this test?


So the problem here is that, `llvm-mc` constructs the Triple correctly, but 
lldb does not preserve all the information from it, at least it does not know 
about the OS type.

> Maybe we should make the SysV abi plugin match unknown oss too...

I'm not sure this is the right thing to do, but this should fix the problem.

> The only format where we have trouble determining the OS is ELF, and it's a 
> pretty good bet that any elf file will be using the "SysV" ABI...

Can you provide more information about this? It sounds like a bug


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213



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


Re: [Lldb-commits] [PATCH] D62948: lit/Register: Avoid stdio in register write tests

2019-06-18 Thread Jim Ingham via lldb-commits


> On Jun 7, 2019, at 2:47 AM, Pavel Labath via Phabricator via lldb-commits 
>  wrote:
> 
> labath planned changes to this revision.
> labath added a comment.
> 
> It looks like this problem is more widespread than we originally thought (a 
> bunch of other tests are affected too). I'll need to think whether we can 
> come up with a more general solution.
> 
> In D62948#1533088 , @jgorbe wrote:
> 
>> About %T not working for "process launch", what about something like `RUN: 
>> %lldb -b --one-line-before-file "process launch --stdout 
>> %T/x86-zmm-write.out" -s %s %t` and then FileCheck-ing?
> 
> 
> There are two issues with that. The first one is that with --one-line, lldb 
> stops processing commands after hitting the int3 instruction. I think this is 
> related to the fact that lldb aborts the script if the inferior crashes, and 
> it considers an unexpected int3 instruction to be a "crash". However, it's 
> not clear to me why should the behavior depend on whether the command is in 
> the script or on the command line, so this may be a bug actually.

You are running lldb with the -b option.  The -b option tells lldb to exit 
after all commands are read UNLESS the process crashes.  An unexplained int3 
(i.e. not one of our breakpoints) is considered a crash and lldb should return 
control to the user in that case.  All the commands from the -o and -s options 
get glommed together in order and then run through, so it shouldn't matter 
which of those you specified the launch for.  Note, however, that you are 
putting the process launch in the -O not the -o option, which seems odd to me.

When I try something like that in lldb on the command-line:

> lldb --one-line-before-file "process launch /bin/ls" /bin/ls
(lldb) process launch /bin/ls
error: invalid target, create a target using the 'target create' command
(lldb) target create "/bin/ls"
Current executable set to '/bin/ls' (x86_64).

Which makes sense, you told lldb to launch a process before creating a target 
for it from the filename argument you also passed to lldb.  So lldb could 
either 

(a) make a target up on the fly, make /bin/ls the executable and launch using 
that target.
 Note that if we did this, then the file specified by the %t would create a 
SECOND target - which would be the selected one - and which would not be the 
one that is running
(b) give an error because you were trying to launch a process w/o having made a 
target first.

Neither of these seem to me  something you want to do.

You seem to be seeing different behavior from this, however, so I'm not sure 
why b isn't behaving as expected.

Jim

> 
> The second one is that putting complex commands on the command line creates a 
> bit of a quoting nightmare, as the command is quote-processed both by the 
> shell and by lldb. And shells (particularly windows ones) differ in how they 
> handle that. If %T doesn't contain any funny characters, then everything is 
> fine (and I expect a lot of our tests would fail if it did, so we kind of 
> already assume that). However, I am reluctant to recommend that as the best 
> practice for handling these kinds of things.
> 
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D62948/new/
> 
> https://reviews.llvm.org/D62948
> 
> 
> 
> ___
> 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] [PATCH] D62503: Add ReadCStringFromMemory for faster string reads

2019-06-18 Thread António Afonso via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363750: Add ReadCStringFromMemory for faster string reads 
(authored by aadsm, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D62503?vs=205211&id=205464#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62503

Files:
  lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
  lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
  lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
  lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp

Index: lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp
===
--- lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp
+++ lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp
@@ -9,6 +9,7 @@
 #include "TestingSupport/Host/NativeProcessTestUtils.h"
 
 #include "lldb/Host/common/NativeProcessProtocol.h"
+#include "llvm/Support/Process.h"
 #include "llvm/Testing/Support/Error.h"
 #include "gmock/gmock.h"
 
@@ -96,3 +97,53 @@
   EXPECT_THAT_EXPECTED(Process.ReadMemoryWithoutTrap(4, 2),
llvm::HasValue(std::vector{4, 5}));
 }
+
+TEST(NativeProcessProtocolTest, ReadCStringFromMemory) {
+  NiceMock DummyDelegate;
+  MockProcess Process(DummyDelegate,
+ ArchSpec("aarch64-pc-linux"));
+  FakeMemory M({'h', 'e', 'l', 'l', 'o', 0, 'w', 'o'});
+  EXPECT_CALL(Process, ReadMemory(_, _))
+  .WillRepeatedly(Invoke(&M, &FakeMemory::Read));
+
+  char string[1024];
+  size_t bytes_read;
+  EXPECT_THAT_EXPECTED(Process.ReadCStringFromMemory(
+   0x0, &string[0], sizeof(string), bytes_read),
+   llvm::HasValue(llvm::StringRef("hello")));
+  EXPECT_EQ(bytes_read, 6UL);
+}
+
+TEST(NativeProcessProtocolTest, ReadCStringFromMemory_MaxSize) {
+  NiceMock DummyDelegate;
+  MockProcess Process(DummyDelegate,
+ ArchSpec("aarch64-pc-linux"));
+  FakeMemory M({'h', 'e', 'l', 'l', 'o', 0, 'w', 'o'});
+  EXPECT_CALL(Process, ReadMemory(_, _))
+  .WillRepeatedly(Invoke(&M, &FakeMemory::Read));
+
+  char string[4];
+  size_t bytes_read;
+  EXPECT_THAT_EXPECTED(Process.ReadCStringFromMemory(
+   0x0, &string[0], sizeof(string), bytes_read),
+   llvm::HasValue(llvm::StringRef("hel")));
+  EXPECT_EQ(bytes_read, 3UL);
+}
+
+TEST(NativeProcessProtocolTest, ReadCStringFromMemory_CrossPageBoundary) {
+  NiceMock DummyDelegate;
+  MockProcess Process(DummyDelegate,
+ ArchSpec("aarch64-pc-linux"));
+  unsigned string_start = llvm::sys::Process::getPageSizeEstimate() - 3;
+  FakeMemory M({'h', 'e', 'l', 'l', 'o', 0, 'w', 'o'}, string_start);
+  EXPECT_CALL(Process, ReadMemory(_, _))
+  .WillRepeatedly(Invoke(&M, &FakeMemory::Read));
+
+  char string[1024];
+  size_t bytes_read;
+  EXPECT_THAT_EXPECTED(Process.ReadCStringFromMemory(string_start, &string[0],
+ sizeof(string),
+ bytes_read),
+   llvm::HasValue(llvm::StringRef("hello")));
+  EXPECT_EQ(bytes_read, 6UL);
+}
\ No newline at end of file
Index: lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
===
--- lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
+++ lldb/trunk/source/Plugins/Process/POSIX/NativeProcessELF.cpp
@@ -118,14 +118,13 @@
 return error.ToError();
 
   char name_buffer[PATH_MAX];
-  error = ReadMemory(link_map.l_name, &name_buffer, sizeof(name_buffer),
- bytes_read);
-  if (!error.Success())
-return error.ToError();
-  name_buffer[PATH_MAX - 1] = '\0';
+  llvm::Expected string_or_error = ReadCStringFromMemory(
+  link_map.l_name, &name_buffer[0], sizeof(name_buffer), bytes_read);
+  if (!string_or_error)
+return string_or_error.takeError();
 
   SVR4LibraryInfo info;
-  info.name = std::string(name_buffer);
+  info.name = string_or_error->str();
   info.link_map = link_map_addr;
   info.base_addr = link_map.l_addr;
   info.ld_addr = link_map.l_ld;
Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -2076,4 +2076,4 @@
   m_processor_trace_monitor.erase(iter);
 
   return error;
-}
\ No newline at end of file
+}
Index: lldb/trunk/source/Host/common/NativeProcessProtocol.cpp
===

[Lldb-commits] [PATCH] D63530: [swig] Define attribute(ref) instead of accessing swig internals.

2019-06-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
Herald added a project: LLDB.

As of SWIG 4.0, `__swig_getmethods__` and `__swig_setmethods__` are no longer 
defined. The solution is to stop using these internal swig dictionaries and use 
`%attribute` and `%attributeref` instead. I plan on doing this incrementally, 
with this differential serving as an example.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D63530

Files:
  lldb/scripts/interface/SBAddress.i


Index: lldb/scripts/interface/SBAddress.i
===
--- lldb/scripts/interface/SBAddress.i
+++ lldb/scripts/interface/SBAddress.i
@@ -6,6 +6,8 @@
 //
 
//===--===//
 
+%include 
+
 namespace lldb {
 
 %feature("docstring",
@@ -162,39 +164,20 @@
 '''Convert the address to an hex string'''
 return '0x%x' % int(self)
 
-__swig_getmethods__["module"] = GetModule
-if _newclass: module = property(GetModule, None, doc='''A read only 
property that returns an lldb object that represents the module (lldb.SBModule) 
that this address resides within.''')
-
-__swig_getmethods__["compile_unit"] = GetCompileUnit
-if _newclass: compile_unit = property(GetCompileUnit, None, doc='''A 
read only property that returns an lldb object that represents the compile unit 
(lldb.SBCompileUnit) that this address resides within.''')
-
-__swig_getmethods__["line_entry"] = GetLineEntry
-if _newclass: line_entry = property(GetLineEntry, None, doc='''A read 
only property that returns an lldb object that represents the line entry 
(lldb.SBLineEntry) that this address resides within.''')
-
-__swig_getmethods__["function"] = GetFunction
-if _newclass: function = property(GetFunction, None, doc='''A read 
only property that returns an lldb object that represents the function 
(lldb.SBFunction) that this address resides within.''')
-
-__swig_getmethods__["block"] = GetBlock
-if _newclass: block = property(GetBlock, None, doc='''A read only 
property that returns an lldb object that represents the block (lldb.SBBlock) 
that this address resides within.''')
-
-__swig_getmethods__["symbol"] = GetSymbol
-if _newclass: symbol = property(GetSymbol, None, doc='''A read only 
property that returns an lldb object that represents the symbol (lldb.SBSymbol) 
that this address resides within.''')
-
-__swig_getmethods__["offset"] = GetOffset
-if _newclass: offset = property(GetOffset, None, doc='''A read only 
property that returns the section offset in bytes as an integer.''')
-
-__swig_getmethods__["section"] = GetSection
-if _newclass: section = property(GetSection, None, doc='''A read only 
property that returns an lldb object that represents the section 
(lldb.SBSection) that this address resides within.''')
-
-__swig_getmethods__["file_addr"] = GetFileAddress
-if _newclass: file_addr = property(GetFileAddress, None, doc='''A read 
only property that returns file address for the section as an integer. This is 
the address that represents the address as it is found in the object file that 
defines it.''')
-
-__swig_getmethods__["load_addr"] = __get_load_addr_property__
-__swig_setmethods__["load_addr"] = __set_load_addr_property__
-if _newclass: load_addr = property(__get_load_addr_property__, 
__set_load_addr_property__, doc='''A read/write property that gets/sets the 
SBAddress using load address. The setter resolves SBAddress using the SBTarget 
from lldb.target so this property can ONLY be used in the interactive script 
interpreter (i.e. under the lldb script command) and not in Python based 
commands, or breakpoint commands.''')
 
 %}
 
 };
 
+%attributeref(lldb::SBAddress, lldb::SBModule, module, GetModule);
+%attributeref(lldb::SBAddress, lldb::SBCompileUnit, compile_unit, 
GetCompileUnit);
+%attributeref(lldb::SBAddress, lldb::SBLineEntry, line_entry, GetLineEntry);
+%attributeref(lldb::SBAddress, lldb::SBFunction, function, GetFunction);
+%attributeref(lldb::SBAddress, lldb::SBBlock, block, GetBlock);
+%attributeref(lldb::SBAddress, lldb::SBSymbol, symbol, GetSymbol);
+%attributeref(lldb::SBAddress, lldb::SBSection, section, GetSection);
+%attribute(lldb::SBAddress, lldb::addr_t, symbol, GetOffset);
+%attribute(lldb::SBAddress, lldb::addr_t, file_addr, GetFileAddress);
+%attribute(lldb::SBAddress, lldb::addr_t, load_addr, GetLoadAddress, 
SetLoadAddress);
+
 } // namespace lldb


Index: lldb/scripts/interface/SBAddress.i
===
--- lldb/scripts/interface/SBAddress.i
+++ lldb/scripts/interface/SBAddress.i
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+%include 
+
 namespace lldb {
 
 %feature("docstring",
@@ -162,39 +164,2

[Lldb-commits] [PATCH] D63530: [swig] Define attribute(ref) instead of accessing swig internals.

2019-06-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 205474.

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

https://reviews.llvm.org/D63530

Files:
  lldb/scripts/interface/SBAddress.i
  lldb/scripts/interface/SBBlock.i

Index: lldb/scripts/interface/SBBlock.i
===
--- lldb/scripts/interface/SBBlock.i
+++ lldb/scripts/interface/SBBlock.i
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+%include 
+
 namespace lldb {
 
 %feature("docstring",
@@ -143,34 +145,17 @@
 def get_call_site(self):
 return declaration(self.GetInlinedCallSiteFile(), self.GetInlinedCallSiteLine(), self.GetInlinedCallSiteColumn())
 
-__swig_getmethods__["parent"] = GetParent
-if _newclass: parent = property(GetParent, None, doc='''A read only property that returns the same result as GetParent().''')
-
-__swig_getmethods__["first_child"] = GetFirstChild
-if _newclass: first_child = property(GetFirstChild, None, doc='''A read only property that returns the same result as GetFirstChild().''')
-
-__swig_getmethods__["call_site"] = get_call_site
-if _newclass: call_site = property(get_call_site, None, doc='''A read only property that returns a lldb.declaration object that contains the inlined call site file, line and column.''')
-
-__swig_getmethods__["sibling"] = GetSibling
-if _newclass: sibling = property(GetSibling, None, doc='''A read only property that returns the same result as GetSibling().''')
-
-__swig_getmethods__["name"] = GetInlinedName
-if _newclass: name = property(GetInlinedName, None, doc='''A read only property that returns the same result as GetInlinedName().''')
-
-__swig_getmethods__["inlined_block"] = GetContainingInlinedBlock
-if _newclass: inlined_block = property(GetContainingInlinedBlock, None, doc='''A read only property that returns the same result as GetContainingInlinedBlock().''')
-
-__swig_getmethods__["range"] = get_ranges_access_object
-if _newclass: range = property(get_ranges_access_object, None, doc='''A read only property that allows item access to the address ranges for a block by integer (range = block.range[0]) and by lldb.SBAdddress (find the range that contains the specified lldb.SBAddress like "pc_range = lldb.frame.block.range[frame.addr]").''')
-
-__swig_getmethods__["ranges"] = get_ranges_array
-if _newclass: ranges = property(get_ranges_array, None, doc='''A read only property that returns a list() object that contains all of the address ranges for the block.''')
-
-__swig_getmethods__["num_ranges"] = GetNumRanges
-if _newclass: num_ranges = property(GetNumRanges, None, doc='''A read only property that returns the same result as GetNumRanges().''')
+call_site = property(get_call_site)
+range = property(get_ranges_access_object)
+ranges = property(get_ranges_array)
 %}
-
 };
 
+%attributeref(lldb::SBBlock, lldb::SBBlock, parent, GetParent);
+%attributeref(lldb::SBBlock, lldb::SBBlock, first_child, GetFirstChild);
+%attributeref(lldb::SBBlock, lldb::SBBlock, sibling, GetSibling);
+%attributeref(lldb::SBBlock, lldb::SBBlock, inlined_block, GetContainingInlinedBlock);
+%attribute(lldb::SBBlock, const char*, name, GetInlinedName);
+%attribute(lldb::SBBlock, uint32_t, num_ranges, GetNumRanges);
+
 } // namespace lldb
Index: lldb/scripts/interface/SBAddress.i
===
--- lldb/scripts/interface/SBAddress.i
+++ lldb/scripts/interface/SBAddress.i
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+%include 
+
 namespace lldb {
 
 %feature("docstring",
@@ -162,39 +164,20 @@
 '''Convert the address to an hex string'''
 return '0x%x' % int(self)
 
-__swig_getmethods__["module"] = GetModule
-if _newclass: module = property(GetModule, None, doc='''A read only property that returns an lldb object that represents the module (lldb.SBModule) that this address resides within.''')
-
-__swig_getmethods__["compile_unit"] = GetCompileUnit
-if _newclass: compile_unit = property(GetCompileUnit, None, doc='''A read only property that returns an lldb object that represents the compile unit (lldb.SBCompileUnit) that this address resides within.''')
-
-__swig_getmethods__["line_entry"] = GetLineEntry
-if _newclass: line_entry = property(GetLineEntry, None, doc='''A read only property that returns an lldb object that represents the line entry (lldb.SBLineEntry) that this address resides within.''')
-
-__swig_getmethods__["function"] = GetFunction
-if _newclass: function = property(GetFunction, None, doc='''A read only property that returns an lldb object that represents the function (lldb.SBFunction) that this add

[Lldb-commits] [PATCH] D63181: [Target] Decouple ObjCLanguageRuntime from LanguageRuntime

2019-06-18 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D63181#1539292 , @xiaobai wrote:

> In D63181#1539291 , @JDevlieghere 
> wrote:
>
> > Have you considered making just `AddExceptionPrecondition` virtual? 
> > Wouldn't that solve the problem too, without the code duplication of making 
> > `CreateExceptionBreakpoint` virtual?
>
>
> I don't believe so. As I understand it, you might not have a process yet when 
> you call `LanguageRuntime::CreateExceptionBreakpoint` from `Target`, so you 
> won't have an instance of LanguageRuntime. You could create an instance of a 
> LanguageRuntime object with a nullptr process just to invoke it as an 
> instance method, but that seems like the wrong choice to me. All this 
> combined has led me to believe that `AddExceptionPrecondition` needs to get a 
> callback to a static function from PluginManager.


That's right.  The reason that this is necessary is that there were MacOS 
versions for a while where both the ObjC V1 and ObjC V2 runtimes were available 
on the same system.  And since you could have a C main executable that loaded 
ObjC code after it was launched, you couldn't a priori tell what ObjC runtime 
was going to be in force till you saw the runtime actually get loaded.  Since 
you could set an ObjC throw breakpoint, then run the process, we have to delay 
everything about choosing the actual exception breakpoint and its associated 
behaviors till after the process was launched.

That's also why setting exception breakpoints is a little contorted as well.

In the fullness of time we should get an lldb that could debug more than one 
version of swift in a single lldb, putting us back in this situation again.  So 
I think we should maintain this bit of complexity.

> 
> 
>> Also, I think it's totally reasonable to hoist `BreakpointPrecondition` out 
>> of `Breakpoint`. After having had to deal with the nuisance of not being 
>> able to forward declare nested classes, I try to avoid them in general.
> 
> Yeah, I was kinda iffy on this, but if you (and possibly others) think this 
> is reasonable, I might go with this option. The only thing that would change 
> is the callback would return a `BreakpointPreconditionSP` instead of `void`, 
> and `AddExceptionPrecondition` would be the one to modify the breakpoint. I 
> don't think the core idea would change much but the implementation might be 
> slightly nicer. Let me know if you prefer that.


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

https://reviews.llvm.org/D63181



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


[Lldb-commits] [PATCH] D63181: [Target] Decouple ObjCLanguageRuntime from LanguageRuntime

2019-06-18 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This looks fine to me.


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

https://reviews.llvm.org/D63181



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


[Lldb-commits] [PATCH] D63530: [swig] Define attribute(ref) instead of accessing swig internals.

2019-06-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 205479.
JDevlieghere added a comment.

Add more classes and keep documentation on properties.


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

https://reviews.llvm.org/D63530

Files:
  lldb/scripts/interface/SBAddress.i
  lldb/scripts/interface/SBBlock.i
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBCompileUnit.i
  lldb/scripts/interface/SBData.i

Index: lldb/scripts/interface/SBData.i
===
--- lldb/scripts/interface/SBData.i
+++ lldb/scripts/interface/SBData.i
@@ -6,6 +6,7 @@
 //
 //===--===//
 
+%include 
 
 namespace lldb {
 
@@ -264,78 +265,31 @@
 def _read_all_double(self):
 return self._make_helper_double().all()
 
-__swig_getmethods__["uint8"] = _make_helper_uint8
-if _newclass: uint8 = property(_make_helper_uint8, None, doc='''A read only property that returns an array-like object out of which you can read uint8 values.''')
-
-__swig_getmethods__["uint16"] = _make_helper_uint16
-if _newclass: uint16 = property(_make_helper_uint16, None, doc='''A read only property that returns an array-like object out of which you can read uint16 values.''')
-
-__swig_getmethods__["uint32"] = _make_helper_uint32
-if _newclass: uint32 = property(_make_helper_uint32, None, doc='''A read only property that returns an array-like object out of which you can read uint32 values.''')
-
-__swig_getmethods__["uint64"] = _make_helper_uint64
-if _newclass: uint64 = property(_make_helper_uint64, None, doc='''A read only property that returns an array-like object out of which you can read uint64 values.''')
-
-__swig_getmethods__["sint8"] = _make_helper_sint8
-if _newclass: sint8 = property(_make_helper_sint8, None, doc='''A read only property that returns an array-like object out of which you can read sint8 values.''')
-
-__swig_getmethods__["sint16"] = _make_helper_sint16
-if _newclass: sint16 = property(_make_helper_sint16, None, doc='''A read only property that returns an array-like object out of which you can read sint16 values.''')
-
-__swig_getmethods__["sint32"] = _make_helper_sint32
-if _newclass: sint32 = property(_make_helper_sint32, None, doc='''A read only property that returns an array-like object out of which you can read sint32 values.''')
-
-__swig_getmethods__["sint64"] = _make_helper_sint64
-if _newclass: sint64 = property(_make_helper_sint64, None, doc='''A read only property that returns an array-like object out of which you can read sint64 values.''')
-
-__swig_getmethods__["float"] = _make_helper_float
-if _newclass: float = property(_make_helper_float, None, doc='''A read only property that returns an array-like object out of which you can read float values.''')
-
-__swig_getmethods__["double"] = _make_helper_double
-if _newclass: double = property(_make_helper_double, None, doc='''A read only property that returns an array-like object out of which you can read double values.''')
-
-__swig_getmethods__["uint8s"] = _read_all_uint8
-if _newclass: uint8s = property(_read_all_uint8, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint8 values.''')
-
-__swig_getmethods__["uint16s"] = _read_all_uint16
-if _newclass: uint16s = property(_read_all_uint16, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint16 values.''')
-
-__swig_getmethods__["uint32s"] = _read_all_uint32
-if _newclass: uint32s = property(_read_all_uint32, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint32 values.''')
-
-__swig_getmethods__["uint64s"] = _read_all_uint64
-if _newclass: uint64s = property(_read_all_uint64, None, doc='''A read only property that returns an array with all the contents of this SBData represented as uint64 values.''')
-
-__swig_getmethods__["sint8s"] = _read_all_sint8
-if _newclass: sint8s = property(_read_all_sint8, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint8 values.''')
-
-__swig_getmethods__["sint16s"] = _read_all_sint16
-if _newclass: sint16s = property(_read_all_sint16, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint16 values.''')
-
-__swig_getmethods__["sint32s"] = _read_all_sint32
-if _newclass: sint32s = property(_read_all_sint32, None, doc='''A read only property that returns an array with all the contents of this SBData represented as sint32 values.''')
-
-__swig_getmethods__["sint64s"] = _re

[Lldb-commits] [PATCH] D63363: [Signals] Create a plugin directory just for signals

2019-06-18 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D63363#1545427 , @labath wrote:

> Although this is technically correct and pretty consistent with our other 
> "plugins", I can't help but feel that it's incredibly wasteful. Each of the 
> XXXSignals.cpp files is less than a 100 lines long (with the licence header 
> and all bolierplate) and it's unlikely to ever grow beyond that. And 
> essentially, all these files do is define a single enum. The reason they are 
> this long is because the UnixSignals class is already over-engineered (e.g. I 
> don't see why LinuxSignals needs to be a separate class, or why it needs to 
> repeat the descriptions/default stop values for each of the signals). Making 
> this a plugin would just add another chunk of boilerplate on top of that.
>
> I don't know about others, but I'd rather us move in a direction which 
> reduces the amount of boilerplate instead of adding more of it. In my ideal 
> world, each of these signal definitions would just be a bunch of (number, 
> name) pairs. This doesn't have/need to be a class or a plugin; a single 
> constexpr variable would suffice for that. Then we'd just cross-reference 
> this mapping with another one which gives the default stop values and 
> descriptions for each of the signals, and that's it.
>
> I know I am repeating myself, but each time I say this, it's because I find 
> another reason for it: I think we should start a new library which I would 
> roughly define as "utilities for describing and manipulating various 
> low-level aspects of processes, but which is agnostic of any actual process 
> class". The idea would be that we can shove here all classes which are shared 
> between lldb-server liblldb. UnixSignals would be one candidate for it. 
> AuxVector, MemoryRegionInfo are others. `Plugins/Process/Utility` (where most 
> of the signal classes live) would be a pretty good place for it already, were 
> it not for the "Plugins" part (it would be weird for non-plugin code to 
> depend on something called a "plugin"). However, maybe we could just create a 
> new top-level library called "ProcessUtil" (or whatever name we come up with) 
> and move the relevant stuff there.
>
> Anyway, TL;DR: I think this should be handled differently. However, if others 
> are fine with this approach, then feel free to ignore me.


How would you bind a particular variant of UnixSignals to the process plugin 
that it goes along with in this scenario?


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

https://reviews.llvm.org/D63363



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


[Lldb-commits] [PATCH] D63530: [swig] Define attribute(ref) instead of accessing swig internals.

2019-06-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 205483.

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

https://reviews.llvm.org/D63530

Files:
  lldb/scripts/interface/SBAddress.i
  lldb/scripts/interface/SBBlock.i
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBCompileUnit.i
  lldb/scripts/interface/SBData.i
  lldb/scripts/interface/SBDeclaration.i
  lldb/scripts/interface/SBError.i
  lldb/scripts/interface/SBExecutionContext.i
  lldb/scripts/interface/SBFileSpec.i
  lldb/scripts/interface/SBFrame.i

Index: lldb/scripts/interface/SBFrame.i
===
--- lldb/scripts/interface/SBFrame.i
+++ lldb/scripts/interface/SBFrame.i
@@ -6,6 +6,8 @@
 //
 //===--===//
 
+%include 
+
 namespace lldb {
 
 %feature("docstring",
@@ -328,86 +330,34 @@
 
 return registers_access(self.registers)
 
-__swig_getmethods__["pc"] = GetPC
-__swig_setmethods__["pc"] = SetPC
-if _newclass: pc = property(GetPC, SetPC)
-
-__swig_getmethods__["addr"] = GetPCAddress
-if _newclass: addr = property(GetPCAddress, None, doc='''A read only property that returns the program counter (PC) as a section offset address (lldb.SBAddress).''')
-
-__swig_getmethods__["fp"] = GetFP
-if _newclass: fp = property(GetFP, None, doc='''A read only property that returns the frame pointer (FP) as an unsigned integer.''')
-
-__swig_getmethods__["sp"] = GetSP
-if _newclass: sp = property(GetSP, None, doc='''A read only property that returns the stack pointer (SP) as an unsigned integer.''')
-
-__swig_getmethods__["module"] = GetModule
-if _newclass: module = property(GetModule, None, doc='''A read only property that returns an lldb object that represents the module (lldb.SBModule) for this stack frame.''')
-
-__swig_getmethods__["compile_unit"] = GetCompileUnit
-if _newclass: compile_unit = property(GetCompileUnit, None, doc='''A read only property that returns an lldb object that represents the compile unit (lldb.SBCompileUnit) for this stack frame.''')
-
-__swig_getmethods__["function"] = GetFunction
-if _newclass: function = property(GetFunction, None, doc='''A read only property that returns an lldb object that represents the function (lldb.SBFunction) for this stack frame.''')
-
-__swig_getmethods__["symbol"] = GetSymbol
-if _newclass: symbol = property(GetSymbol, None, doc='''A read only property that returns an lldb object that represents the symbol (lldb.SBSymbol) for this stack frame.''')
-
-__swig_getmethods__["block"] = GetBlock
-if _newclass: block = property(GetBlock, None, doc='''A read only property that returns an lldb object that represents the block (lldb.SBBlock) for this stack frame.''')
-
-__swig_getmethods__["is_inlined"] = IsInlined
-if _newclass: is_inlined = property(IsInlined, None, doc='''A read only property that returns an boolean that indicates if the block frame is an inlined function.''')
-
-__swig_getmethods__["name"] = GetFunctionName
-if _newclass: name = property(GetFunctionName, None, doc='''A read only property that retuns the name for the function that this frame represents. Inlined stack frame might have a concrete function that differs from the name of the inlined function (a named lldb.SBBlock).''')
-
-__swig_getmethods__["line_entry"] = GetLineEntry
-if _newclass: line_entry = property(GetLineEntry, None, doc='''A read only property that returns an lldb object that represents the line table entry (lldb.SBLineEntry) for this stack frame.''')
-
-__swig_getmethods__["thread"] = GetThread
-if _newclass: thread = property(GetThread, None, doc='''A read only property that returns an lldb object that represents the thread (lldb.SBThread) for this stack frame.''')
-
-__swig_getmethods__["disassembly"] = Disassemble
-if _newclass: disassembly = property(Disassemble, None, doc='''A read only property that returns the disassembly for this stack frame as a python string.''')
-
-__swig_getmethods__["idx"] = GetFrameID
-if _newclass: idx = property(GetFrameID, None, doc='''A read only property that returns the zero based stack frame index.''')
-
-__swig_getmethods__["variables"] = get_all_variables
-if _newclass: variables = property(get_all_variables, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the variables in this stack frame.''')
-
-__swig_getmethods__["vars"] = get_all_variables
-if _newclass: vars = property(get_all_variables, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the variables in this stack frame.''')
-
-__swig_getmet

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

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

In D62213#1549190 , @kusmour wrote:

> > Maybe we should make the SysV abi plugin match unknown oss too...
>
> I'm not sure this is the right thing to do, but this should fix the problem.


It would at least preserve status quo. Not much, but it is something...

>> The only format where we have trouble determining the OS is ELF, and it's a 
>> pretty good bet that any elf file will be using the "SysV" ABI...
> 
> Can you provide more information about this? It sounds like a bug

Well.. you could consider it a bug, but it's quite hard to say where that bug 
is (it's definitely not a bug in lldb or llvm-mc). A sad fact of life is that 
the ELF files don't usually carry enough information to properly identify the 
os/environment they were intended to run on. If you run `readelf -e` on the 
file generated in the test, you'll get something like

  ELF Header:
Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
Class: ELF64
Data:  2's complement, little endian
Version:   1 (current)
OS/ABI:UNIX - System V
ABI Version:   0
Type:  REL (Relocatable file)
Machine:   Advanced Micro Devices X86-64
Version:   0x1
Entry point address:   0x0
Start of program headers:  0 (bytes into file)
Start of section headers:  648 (bytes into file)
Flags: 0x0
Size of this header:   64 (bytes)
Size of program headers:   0 (bytes)
Number of program headers: 0
Size of section headers:   64 (bytes)
Number of section headers: 9
Section header string table index: 1
  
  Section Headers:
[Nr] Name  Type Address   Offset
 Size  EntSize  Flags  Link  Info  Align
[ 0]   NULL   
      0 0 0
[ 1] .strtab   STRTAB     0238
 004e     0 0 1
[ 2] .text PROGBITS   0040
 0003    AX   0 0 4
[ 3] .debug_strPROGBITS   0043
 001b  0001  MS   0 0 1
[ 4] .debug_locPROGBITS   005e
 0036     0 0 1
[ 5] .debug_abbrev PROGBITS   0094
 002d     0 0 1
[ 6] .debug_info   PROGBITS   00c1
 003d     0 0 1
[ 7] .rela.debug_info  RELA   0190
 00a8  0018   8 6 8
[ 8] .symtab   SYMTAB     0100
 0090  0018   1 6 8
  Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
l (large), p (processor specific)
  
  There are no program headers in this file.

The elf header has this OS/ABI field which could be used to specify linux, but 
here it's just set to the generic "none" value (which gets printed as "unix 
sysv"). There is a value for ELFOSABI_LINUX/ELFOSABI_GNU, which could be used 
to say "linux", but it seems nobody uses it (I'm not sure what's the background 
there). I guess that usually wasn't a problem, because tools would just assume 
they are dealing with binaries for the host platform, but lldb has a strong 
desire to know what platform is a binary intended for without assuming anything 
about the environment it's being run it. That desire is understandable, but it 
kind of collides with reality. Over time, lldb has developed a bunch of 
heuristics to determine the right OS for a file, but these are just heuristics, 
and they fail on extremely simple files like the ones used in this test, 
because they have nothing to go on.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D62213



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


[Lldb-commits] [PATCH] D63530: [swig] Define attribute(ref) instead of accessing swig internals.

2019-06-18 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I'm not terribly familiar with this, but it definitely looks like a more 
idiomatic way to do these things.


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

https://reviews.llvm.org/D63530



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