[Lldb-commits] [PATCH] D53834: [FileSystem] Remove ResolveExecutableLocation() from FileSpec

2018-10-31 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Why did you change the function name? I think it would be nice to keep 
"executable" or something to that effect in the name (e.g. the llvm function 
has "program"), given that the underlying function checks for the executable 
bit, and so it cannot be used for general searches.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D53834



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


[Lldb-commits] [PATCH] D53532: [FileSystem] Extend file system and have it use the VFS.

2018-10-31 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.

Thanks for bearing with me. I am very happy with how this turned out in the 
end. I have more suggestion on how to clean up the initialization, which you 
can incorporate if you like it, but I don't want to hold up the patch over that.




Comment at: include/lldb/Host/FileSystem.h:21
 
+#include 
 #include 

Not needed anymore?



Comment at: include/lldb/Utility/FileSpec.h:423
   /// @return
-  /// Returns a std::string with the directory and filename
+  /// Retuthe rns a std::string with the directory and filename
   /// concatenated.

labath wrote:
> accidental change?
It seems this is still here... :(



Comment at: source/Host/common/FileSystem.cpp:32
+  FileSystem &instance = Instance();
+  instance.m_initialized = true;
+}

Instead of manual `m_initialized` management, what would you say to this:
- have a private `InstanceImpl` (or whatever) function, which returns an 
`Optional &`
- `Initialize` does `InstanceImpl().emplace(VFS);` (it can check that the value 
is `None` beforehand if you want, but I am not worried about people 
accidentally calling `Initialize` twice).
- `Terminate` does `InstanceImpl().reset();`
- `Instance` does `return *InstanceImpl();`

I think this would be a bit cleaner as it would allow is to specify the VFS 
directly during construction. We would avoid having to construct a `FileSystem` 
object with a dummy VFS, only to replace it with another one later. And also 
you wouldn't need to subclass FileSystem in the unit tests just to change the 
implementation.



Comment at: unittests/Host/FileSystemTest.cpp:302-310
+  EXPECT_EQ(visited.size(), (size_t)4);
+  EXPECT_TRUE(std::find(visited.begin(), visited.end(), "/foo") !=
+  visited.end());
+  EXPECT_TRUE(std::find(visited.begin(), visited.end(), "/bar") !=
+  visited.end());
+  EXPECT_TRUE(std::find(visited.begin(), visited.end(), "/baz") !=
+  visited.end());

You can write this more concisely (and with better error messages) as 
`EXPECT_THAT(visited, testing::UnorderedElementsAre("/foo", "/bar", "/baz", 
"/qux"));` (you need to include `gmock.h` for that to work).


https://reviews.llvm.org/D53532



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


[Lldb-commits] [PATCH] D52461: [PDB] Introduce `MSVCUndecoratedNameParser`

2018-10-31 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

In https://reviews.llvm.org/D52461#1281742, @zturner wrote:

> What do you think?


Yes, it's a really cool idea! When I was starting the implementation of the 
parser from this patch, I thought that it would be good to have mangled names 
instead - then we could retrieve fully structured names (with all its scope 
specifiers, template parameters etc.), but I didn't know that we actually have 
them on the lower level!

I want to join the development of the new PDB plugin, but some time later - may 
be in a month or two. I want to contribute now all changes I made to support 
expressions on Windows, and then I have some LLVM unrelated work to do. But I 
think that the way you suggest to solve the problem from the patch is the 
really right way to do it, and I'm planning to implement it when I'll join the 
new plugin development.

But is the MSVC demangled names parsing really necessary for 
`CPlusPlusLanguage`? Can such names ever somehow occur there? May be (if they 
can't) we could move this parser back to the old PDB plugin, and then drop it 
as a weirder solution when the new plugin will be done? Then we could commit 
this as a solution for the old PDB plugin to proceed with some dependent (and 
not related to the old PDB plugin) patches?


https://reviews.llvm.org/D52461



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


[Lldb-commits] [lldb] r345706 - [LLDB] - Add support for DW_FORM_addrx[1-4]? forms.

2018-10-31 Thread George Rimar via lldb-commits
Author: grimar
Date: Wed Oct 31 03:14:03 2018
New Revision: 345706

URL: http://llvm.org/viewvc/llvm-project?rev=345706&view=rev
Log:
[LLDB] - Add support for DW_FORM_addrx[1-4]? forms.

This adds the support for DW_FORM_addrx, DW_FORM_addrx1, 
DW_FORM_addrx2, DW_FORM_addrx3, DW_FORM_addrx4 forms.

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

Added:
lldb/trunk/lit/Breakpoint/Inputs/debug_addrx.yaml
lldb/trunk/lit/Breakpoint/debug_addrx.test
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Added: lldb/trunk/lit/Breakpoint/Inputs/debug_addrx.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/Inputs/debug_addrx.yaml?rev=345706&view=auto
==
--- lldb/trunk/lit/Breakpoint/Inputs/debug_addrx.yaml (added)
+++ lldb/trunk/lit/Breakpoint/Inputs/debug_addrx.yaml Wed Oct 31 03:14:03 2018
@@ -0,0 +1,57 @@
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:   0x00201000
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x00201000
+AddressAlign:0x0010
+Content: 
31ED4989D15E4889E24883E4F0505449C7C08011200048C7C11011200048C7C700112000E89701F455B810202000483D102020004889E57417B84885C0740D5DBF10202000FFE00F1F445DC3660F1F44BE10202000554881EE102020004889E548C1FE034889F048C1E83F4801C648D1FE7415B84885C0740B5DBF10202000FFE00F1F005DC3660F1F44803D592F007517554889E5E87EFFC605472F015DC30F1F44F3C30F1F4000662E0F1F8400554889E55DEB89CCC3CCC3CC31C0C3CC415741564189FF415541544C8D25E61E55488D2DE61E534989F64989D54C29E54883EC0848C1FD03E843004885ED742031DB0F1F84004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F8400F3C3
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 
440005006B005F003A000E001A001E0093002E001600670005009A008E0069009500
+  - Name:.debug_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x0001
+Content: 
74686973005F5A336261723141005F76707472244100666F6F00696E74005F5F7674626C5F7074725F74797065005F5A4E314133666F6F4576002F686F6D652F756D622F74657374735F323031382F3131326C6C64625F726C657461677300746573742E63630041006100636C616E672076657273696F6E20382E302E3020287472756E6B2033343438333429006D61696E0078006F626A410062617200
+  - Name:.debug_loc
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 
E0102000E010230011009FE0102000E1102500110023019F
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 
011101252513050325721710171B2573171101551774170213011D13360B03250B0B3A0B3B0B030D0003254913380B3419040D00032549133A0B3B0B380B052E016E2503253A0B3B0B4C0B4D183C193F191D1306050049133419070F004913080F004913032509150049130A240003253E0B0B0B0B2E0B1206401864137A193B0B47130C05000325491334190D3400021703253A0B3B0B49130E2E0B120640187A196E2503253A0B3B0B3F190F050003253A0B3B0B4913102E0B120640187A1903253A0B3B0B49133F1911340003253A0B3B0B491300
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 
C80005000108010004000108000208000C000C00022E00040910010303035C04066C000104080507080105010210002E000677610008670005096C000A040504072E000B000100015786000848000C0DC6000D0601096C0E01010001570A0B010D0F0E010D2E1002030001570C01116C00110F01122E072E
+  - Name:.debug_rnglists
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 
27000500080007E0102107F010210700112300
+  - Name:.debug_macinfo
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: '00'
+  - Name:.debug_addr
+Type:SHT_PROGBITS
+

[Lldb-commits] [PATCH] D53813: [LLDB] - Add support for DW_FORM_addrx[1-4]? forms.

2018-10-31 Thread George Rimar via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345706: [LLDB] - Add support for DW_FORM_addrx[1-4]? forms. 
(authored by grimar, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53813?vs=171517&id=171880#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53813

Files:
  lldb/trunk/lit/Breakpoint/Inputs/debug_addrx.yaml
  lldb/trunk/lit/Breakpoint/debug_addrx.test
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -233,18 +233,23 @@
   m_value.value.uval =
   data.GetMaxU64(offset_ptr, DWARFUnit::IsDWARF64(m_cu) ? 8 : 4);
   break;
+case DW_FORM_addrx:
 case DW_FORM_strx:
   m_value.value.uval = data.GetULEB128(offset_ptr);
   break;
+case DW_FORM_addrx1:
 case DW_FORM_strx1:
   m_value.value.uval = data.GetU8(offset_ptr);
   break;
+case DW_FORM_addrx2:
 case DW_FORM_strx2:
   m_value.value.uval = data.GetU16(offset_ptr);
   break;
+case DW_FORM_addrx3:
 case DW_FORM_strx3:
   m_value.value.uval = data.GetMaxU64(offset_ptr, 3);
   break;
+case DW_FORM_addrx4:
 case DW_FORM_strx4:
   m_value.value.uval = data.GetU32(offset_ptr);
   break;
@@ -376,21 +381,24 @@
 return true;
 
 // 1 byte values
+case DW_FORM_addrx1:
 case DW_FORM_data1:
 case DW_FORM_flag:
 case DW_FORM_ref1:
 case DW_FORM_strx1:
   *offset_ptr += 1;
   return true;
 
 // 2 byte values
+case DW_FORM_addrx2:
 case DW_FORM_data2:
 case DW_FORM_ref2:
 case DW_FORM_strx2:
   *offset_ptr += 2;
   return true;
 
 // 3 byte values
+case DW_FORM_addrx3:
 case DW_FORM_strx3:
   *offset_ptr += 3;
   return true;
@@ -403,6 +411,7 @@
   return true;
 
 // 4 byte values
+case DW_FORM_addrx4:
 case DW_FORM_data4:
 case DW_FORM_ref4:
 case DW_FORM_strx4:
@@ -417,6 +426,7 @@
   return true;
 
 // signed or unsigned LEB 128 values
+case DW_FORM_addrx:
 case DW_FORM_sdata:
 case DW_FORM_udata:
 case DW_FORM_ref_udata:
@@ -625,7 +635,9 @@
 return Unsigned();
 
   assert(m_cu);
-  assert(m_form == DW_FORM_GNU_addr_index);
+  assert(m_form == DW_FORM_GNU_addr_index || m_form == DW_FORM_addrx ||
+ m_form == DW_FORM_addrx1 || m_form == DW_FORM_addrx2 ||
+ m_form == DW_FORM_addrx3 || m_form == DW_FORM_addrx4);
 
   if (!symbol_file)
 return 0;
@@ -798,6 +810,7 @@
 bool DWARFFormValue::FormIsSupported(dw_form_t form) {
   switch (form) {
 case DW_FORM_addr:
+case DW_FORM_addrx:
 case DW_FORM_block2:
 case DW_FORM_block4:
 case DW_FORM_data2:
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -307,6 +307,9 @@
 
 // m_die_array_mutex must be already held as read/write.
 void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
+  SetAddrBase(
+  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_addr_base, 0));
+
   uint64_t base_addr = cu_die.GetAttributeValueAsAddress(
   m_dwarf, this, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
   if (base_addr == LLDB_INVALID_ADDRESS)
@@ -339,9 +342,13 @@
 
   dw_addr_t addr_base =
   cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_GNU_addr_base, 0);
+  dwo_cu->SetAddrBase(addr_base);
+
   dw_addr_t ranges_base = cu_die.GetAttributeValueAsUnsigned(
   m_dwarf, this, DW_AT_GNU_ranges_base, 0);
-  dwo_cu->SetAddrBase(addr_base, ranges_base, m_offset);
+  dwo_cu->SetRangesBase(ranges_base);
+
+  dwo_cu->SetBaseObjOffset(m_offset);
 }
 
 DWARFDIE DWARFUnit::LookupAddress(const dw_addr_t address) {
@@ -399,11 +406,13 @@
   return m_abbrevs ? m_abbrevs->GetOffset() : DW_INVALID_OFFSET;
 }
 
-void DWARFUnit::SetAddrBase(dw_addr_t addr_base,
-dw_addr_t ranges_base,
-dw_offset_t base_obj_offset) {
-  m_addr_base = addr_base;
+void DWARFUnit::SetAddrBase(dw_addr_t addr_base) { m_addr_base = addr_base; }
+
+void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {
   m_ranges_base = ranges_base;
+}
+
+void DWARFUnit::SetBaseObjOffset(dw_offset_t base_obj_offset) {
   m_base_obj_offset = base_obj_offset;
 }
 
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
=

[Lldb-commits] [lldb] r345711 - [lldb] Fix race condition in framework installation

2018-10-31 Thread Shoaib Meenai via lldb-commits
Author: smeenai
Date: Wed Oct 31 03:41:12 2018
New Revision: 345711

URL: http://llvm.org/viewvc/llvm-project?rev=345711&view=rev
Log:
[lldb] Fix race condition in framework installation

We need the install-liblldb-stripped target to depend on the
lldb-framework target in order for the installation to be guaranteed to
behave correctly, otherwise it's possible for the lldb-framework and
install-liblldb-stripped targets to run in parallel, resulting in
temporary or partially processed files being copied into the framework.
install-liblldb already depends on lldb-framework for this reason.

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

Modified:
lldb/trunk/cmake/modules/AddLLDB.cmake

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=345711&r1=345710&r2=345711&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Wed Oct 31 03:41:12 2018
@@ -79,7 +79,7 @@ function(add_lldb_library name)
 # framework, so it must rely on the framework being fully built first.
 if (LLDB_BUILD_FRAMEWORK AND ${name} STREQUAL "liblldb")
   add_dependencies(install-${name} lldb-framework)
-  add_dependencies(install-lldb-framework-stripped lldb-framework)
+  add_dependencies(install-${name}-stripped lldb-framework)
 endif()
   endif()
 endif()


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


[Lldb-commits] [PATCH] D53917: [lldb] Fix race condition in framework installation

2018-10-31 Thread Shoaib Meenai via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB345711: [lldb] Fix race condition in framework 
installation (authored by smeenai, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D53917?vs=171854&id=171884#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D53917

Files:
  cmake/modules/AddLLDB.cmake


Index: cmake/modules/AddLLDB.cmake
===
--- cmake/modules/AddLLDB.cmake
+++ cmake/modules/AddLLDB.cmake
@@ -79,7 +79,7 @@
 # framework, so it must rely on the framework being fully built first.
 if (LLDB_BUILD_FRAMEWORK AND ${name} STREQUAL "liblldb")
   add_dependencies(install-${name} lldb-framework)
-  add_dependencies(install-lldb-framework-stripped lldb-framework)
+  add_dependencies(install-${name}-stripped lldb-framework)
 endif()
   endif()
 endif()


Index: cmake/modules/AddLLDB.cmake
===
--- cmake/modules/AddLLDB.cmake
+++ cmake/modules/AddLLDB.cmake
@@ -79,7 +79,7 @@
 # framework, so it must rely on the framework being fully built first.
 if (LLDB_BUILD_FRAMEWORK AND ${name} STREQUAL "liblldb")
   add_dependencies(install-${name} lldb-framework)
-  add_dependencies(install-lldb-framework-stripped lldb-framework)
+  add_dependencies(install-${name}-stripped lldb-framework)
 endif()
   endif()
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D53929: [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.

2018-10-31 Thread George Rimar via Phabricator via lldb-commits
grimar created this revision.
grimar added reviewers: LLDB, clayborg.
Herald added a subscriber: JDevlieghere.

This adds support for DW_RLE_base_addressx, DW_RLE_startx_endx,
DW_RLE_startx_length, DW_FORM_rnglistx.


https://reviews.llvm.org/D53929

Files:
  lit/Breakpoint/Inputs/debug_rnglistx_rlex.yaml
  lit/Breakpoint/debug_rnglistx_rlex.test
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -309,6 +309,8 @@
 void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
   SetAddrBase(
   cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_addr_base, 0));
+  SetRangesBase(cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
+   DW_AT_rnglists_base, 0));
 
   uint64_t base_addr = cu_die.GetAttributeValueAsAddress(
   m_dwarf, this, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -234,6 +234,7 @@
   data.GetMaxU64(offset_ptr, DWARFUnit::IsDWARF64(m_cu) ? 8 : 4);
   break;
 case DW_FORM_addrx:
+case DW_FORM_rnglistx:
 case DW_FORM_strx:
   m_value.value.uval = data.GetULEB128(offset_ptr);
   break;
@@ -427,6 +428,7 @@
 
 // signed or unsigned LEB 128 values
 case DW_FORM_addrx:
+case DW_FORM_rnglistx:
 case DW_FORM_sdata:
 case DW_FORM_udata:
 case DW_FORM_ref_udata:
@@ -811,6 +813,7 @@
   switch (form) {
 case DW_FORM_addr:
 case DW_FORM_addrx:
+case DW_FORM_rnglistx:
 case DW_FORM_block2:
 case DW_FORM_block4:
 case DW_FORM_data2:
Index: source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
@@ -22,15 +22,17 @@
   virtual void Extract(SymbolFileDWARF *dwarf2Data) = 0;
   virtual bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
   DWARFRangeList &range_list) const = 0;
+  virtual uint64_t GetOffset(size_t Index) = 0;
 };
 
 class DWARFDebugRanges final : public DWARFDebugRangesBase {
 public:
   DWARFDebugRanges();
 
-  virtual void Extract(SymbolFileDWARF *dwarf2Data) override;
-  virtual bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
-  DWARFRangeList &range_list) const override;
+  void Extract(SymbolFileDWARF *dwarf2Data) override;
+  bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
+  DWARFRangeList &range_list) const override;
+  uint64_t GetOffset(size_t Index) override;
 
   static void Dump(lldb_private::Stream &s,
const lldb_private::DWARFDataExtractor &debug_ranges_data,
@@ -58,6 +60,7 @@
   void Extract(SymbolFileDWARF *dwarf2Data) override;
   bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
   DWARFRangeList &range_list) const override;
+  uint64_t GetOffset(size_t Index) override;
 
 protected:
   bool ExtractRangeList(const lldb_private::DWARFDataExtractor &data,
Index: source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -128,6 +128,11 @@
   return false;
 }
 
+uint64_t DWARFDebugRanges::GetOffset(size_t Index) {
+  lldbassert(false && "DW_FORM_rnglistx is not present before DWARF5");
+  return 0;
+}
+
 bool DWARFDebugRngLists::ExtractRangeList(
 const DWARFDataExtractor &data, uint8_t addrSize,
 lldb::offset_t *offset_ptr, std::vector &rangeList) {
@@ -166,17 +171,44 @@
   break;
 }
 
+case DW_RLE_base_addressx: {
+  dw_addr_t base = data.GetULEB128(offset_ptr);
+  rangeList.push_back({DW_RLE_base_addressx, base, 0});
+  break;
+}
+
+case DW_RLE_startx_endx: {
+  dw_addr_t start = data.GetULEB128(offset_ptr);
+  dw_addr_t end = data.GetULEB128(offset_ptr);
+  rangeList.push_back({DW_RLE_startx_endx, start, end});
+  break;
+}
+
+case DW_RLE_startx_length: {
+  dw_addr_t start = data.GetULEB128(offset_ptr);
+  dw_addr_t length = data.GetULEB128(offset_ptr);
+  rangeList.push_back({DW_RLE_startx_length, start, length});
+  break;
+}
+
 default:
-  // Next encodings are n

[Lldb-commits] [PATCH] D52981: [LLDB] - Add basic support for .debug_rnglists section (DWARF5)

2018-10-31 Thread Dávid Bolvanský via Phabricator via lldb-commits
xbolva00 added inline comments.



Comment at: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp:163
+  uint64_t length = data.GetU32(&offset);
+  bool isDwarf64 = false;
+  if (length == 0x) {

variable is not used anywhere


Repository:
  rL LLVM

https://reviews.llvm.org/D52981



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


[Lldb-commits] [lldb] r345720 - [LLDB] - Removed unused variable. NFC.

2018-10-31 Thread George Rimar via lldb-commits
Author: grimar
Date: Wed Oct 31 06:49:31 2018
New Revision: 345720

URL: http://llvm.org/viewvc/llvm-project?rev=345720&view=rev
Log:
[LLDB] - Removed unused variable. NFC.

Introduced in r344119.

Thanks to Dávid Bolvanský fo reporting.

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=345720&r1=345719&r2=345720&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Wed Oct 31 
06:49:31 2018
@@ -214,11 +214,8 @@ void DWARFDebugRngLists::Extract(SymbolF
   lldb::offset_t offset = 0;
 
   uint64_t length = data.GetU32(&offset);
-  bool isDwarf64 = false;
-  if (length == 0x) {
+  if (length == 0x)
 length = data.GetU64(&offset);
-isDwarf64 = true;
-  }
   lldb::offset_t end = offset + length;
 
   // Check version.


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


[Lldb-commits] [PATCH] D52981: [LLDB] - Add basic support for .debug_rnglists section (DWARF5)

2018-10-31 Thread George Rimar via Phabricator via lldb-commits
grimar added inline comments.



Comment at: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp:163
+  uint64_t length = data.GetU32(&offset);
+  bool isDwarf64 = false;
+  if (length == 0x) {

xbolva00 wrote:
> variable is not used anywhere
Removed in r345720, thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D52981



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


[Lldb-commits] [lldb] r345733 - [LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC.

2018-10-31 Thread George Rimar via lldb-commits
Author: grimar
Date: Wed Oct 31 09:12:29 2018
New Revision: 345733

URL: http://llvm.org/viewvc/llvm-project?rev=345733&view=rev
Log:
[LLDB] - Regroup the switch entries in DWARFFormValue::ExtractValue. NFC.

This is NFC to clean up the `DWARFFormValue::ExtractValue`.
It groups similar `DW_FORM_*` and removes an excessive
assignment of `ref_addr_size` (it was assigned right after in any case).

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=345733&r1=345732&r2=345733&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Wed Oct 31 
09:12:29 2018
@@ -182,8 +182,12 @@ bool DWARFFormValue::ExtractValue(const
 switch (m_form) {
 case DW_FORM_addr:
   assert(m_cu);
-  m_value.value.uval = data.GetMaxU64(
-  offset_ptr, DWARFUnit::GetAddressByteSize(m_cu));
+  m_value.value.uval =
+  data.GetMaxU64(offset_ptr, DWARFUnit::GetAddressByteSize(m_cu));
+  break;
+case DW_FORM_block1:
+  m_value.value.uval = data.GetU8(offset_ptr);
+  is_block = true;
   break;
 case DW_FORM_block2:
   m_value.value.uval = data.GetU16(offset_ptr);
@@ -193,56 +197,39 @@ bool DWARFFormValue::ExtractValue(const
   m_value.value.uval = data.GetU32(offset_ptr);
   is_block = true;
   break;
-case DW_FORM_data2:
-  m_value.value.uval = data.GetU16(offset_ptr);
-  break;
-case DW_FORM_data4:
-  m_value.value.uval = data.GetU32(offset_ptr);
-  break;
-case DW_FORM_data8:
-  m_value.value.uval = data.GetU64(offset_ptr);
-  break;
 case DW_FORM_data16:
   m_value.value.uval = 16;
   is_block = true;
   break;
-case DW_FORM_string:
-  m_value.value.cstr = data.GetCStr(offset_ptr);
-  break;
 case DW_FORM_exprloc:
 case DW_FORM_block:
   m_value.value.uval = data.GetULEB128(offset_ptr);
   is_block = true;
   break;
-case DW_FORM_block1:
-  m_value.value.uval = data.GetU8(offset_ptr);
-  is_block = true;
-  break;
-case DW_FORM_data1:
-  m_value.value.uval = data.GetU8(offset_ptr);
-  break;
-case DW_FORM_flag:
-  m_value.value.uval = data.GetU8(offset_ptr);
+case DW_FORM_string:
+  m_value.value.cstr = data.GetCStr(offset_ptr);
   break;
 case DW_FORM_sdata:
   m_value.value.sval = data.GetSLEB128(offset_ptr);
   break;
 case DW_FORM_strp:
 case DW_FORM_line_strp:
+case DW_FORM_sec_offset:
   assert(m_cu);
   m_value.value.uval =
   data.GetMaxU64(offset_ptr, DWARFUnit::IsDWARF64(m_cu) ? 8 : 4);
   break;
-case DW_FORM_addrx:
-case DW_FORM_strx:
-  m_value.value.uval = data.GetULEB128(offset_ptr);
-  break;
 case DW_FORM_addrx1:
 case DW_FORM_strx1:
+case DW_FORM_ref1:
+case DW_FORM_data1:
+case DW_FORM_flag:
   m_value.value.uval = data.GetU8(offset_ptr);
   break;
 case DW_FORM_addrx2:
 case DW_FORM_strx2:
+case DW_FORM_ref2:
+case DW_FORM_data2:
   m_value.value.uval = data.GetU16(offset_ptr);
   break;
 case DW_FORM_addrx3:
@@ -251,61 +238,40 @@ bool DWARFFormValue::ExtractValue(const
   break;
 case DW_FORM_addrx4:
 case DW_FORM_strx4:
+case DW_FORM_ref4:
+case DW_FORM_data4:
   m_value.value.uval = data.GetU32(offset_ptr);
   break;
-//  case DW_FORM_APPLE_db_str:
+case DW_FORM_data8:
+case DW_FORM_ref8:
+case DW_FORM_ref_sig8:
+  m_value.value.uval = data.GetU64(offset_ptr);
+  break;
+case DW_FORM_addrx:
+case DW_FORM_strx:
 case DW_FORM_udata:
+case DW_FORM_ref_udata:
+case DW_FORM_GNU_str_index:
+case DW_FORM_GNU_addr_index:
   m_value.value.uval = data.GetULEB128(offset_ptr);
   break;
 case DW_FORM_ref_addr:
   assert(m_cu);
-  ref_addr_size = 4;
   if (m_cu->GetVersion() <= 2)
 ref_addr_size = m_cu->GetAddressByteSize();
   else
 ref_addr_size = m_cu->IsDWARF64() ? 8 : 4;
   m_value.value.uval = data.GetMaxU64(offset_ptr, ref_addr_size);
   break;
-case DW_FORM_ref1:
-  m_value.value.uval = data.GetU8(offset_ptr);
-  break;
-case DW_FORM_ref2:
-  m_value.value.uval = data.GetU16(offset_ptr);
-  break;
-case DW_FORM_ref4:
-  m_value.value.uval = data.GetU32(offset_ptr);
-  break;
-case DW_FORM_ref8:
-  m_value.value.uval = data.GetU64(offset_ptr);
-  break;
-case DW_FORM_ref_udata:
-  m_value.value.uval = data.GetULEB128(offset_ptr);
-  break;
 case DW_FORM_indirect:
   m_form = data.GetULEB128(offset_ptr);
   indirect = true;
   break

[Lldb-commits] [lldb] r345768 - Makefile.rules: Don't use code signing on macOS; it isn't necessary.

2018-10-31 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Wed Oct 31 12:42:02 2018
New Revision: 345768

URL: http://llvm.org/viewvc/llvm-project?rev=345768&view=rev
Log:
Makefile.rules: Don't use code signing on macOS; it isn't necessary.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=345768&r1=345767&r2=345768&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Wed Oct 31 
12:42:02 2018
@@ -64,6 +64,7 @@ ifneq "$(TRIPLE)" ""
TRIPLE_VERSION =$(word 2, $(triple_os_and_version))
ifeq "$(TRIPLE_VENDOR)" "apple"
ifeq "$(TRIPLE_OS)" "ios"
+   CODESIGN := codesign
ifeq "$(SDKROOT)" ""
# Set SDKROOT if it wasn't set
ifneq (,$(findstring arm,$(ARCH)))
@@ -82,7 +83,8 @@ ifneq "$(TRIPLE)" ""
endif
endif
ifeq "$(TRIPLE_OS)" "watchos"
-   ifeq "$(SDKROOT)" ""
+   CODESIGN := codesign
+   ifeq "$(SDKROOT)" ""
# Set SDKROOT if it wasn't set
ifneq (,$(findstring arm,$(ARCH)))
SDKROOT = $(shell xcrun --sdk watchos 
--show-sdk-path)
@@ -153,7 +155,6 @@ ifeq "$(OS)" "Darwin"
DSYM = $(EXE).dSYM
AR := $(CROSS_COMPILE)libtool
ARFLAGS := -static -o
-   CODESIGN = codesign
 else
AR := $(CROSS_COMPILE)ar
# On non-Apple platforms, -arch becomes -m


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


[Lldb-commits] [PATCH] D53929: [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.

2018-10-31 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Just one question about extracting the value for DW_AT_ranges. It would be nice 
if we just took care of extracting the value so the form value was more useful




Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1072-1079
+  if (at_ranges_val != DW_INVALID_OFFSET) {
+if (DWARFDebugRangesBase *debug_ranges = dwarf2Data->DebugRanges()) {
+
+  dw_offset_t debug_ranges_offset;
+  if (form_value.Form() == DW_FORM_rnglistx)
+debug_ranges_offset = debug_ranges->GetOffset(at_ranges_val);
+  else

Can/should we do all this work when we extract the form value so that 
"form_value.Unsigned()" just returns the right thing? If not, every place that 
gets DW_AT_ranges attribute would need to do this.


https://reviews.llvm.org/D53929



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


[Lldb-commits] [PATCH] D53951: [NativePDB] Get LLDB types from PDB function types

2018-10-31 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
zturner added reviewers: aleksandr.urakov, lemo.

  This adds basic support for getting function signature types
  into LLDB's type system, including into clang's AST.  There are
  a few edge cases which are not correctly handled, mostly dealing
  with nested classes, but this isn't specific to functions and
  apply equally to variable types.  Note that no attempt has been
  made yet to deal with member function types, which will happen
  in subsequent patches.


https://reviews.llvm.org/D53951

Files:
  lldb/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit
  lldb/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit
  lldb/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
  lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h

Index: llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
===
--- llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
+++ llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h
@@ -47,7 +47,7 @@
 return Error::success();
   }
   template  static Expected deserializeAs(CVSymbol Symbol) {
-T Record(Symbol.kind());
+T Record(static_cast(Symbol.kind()));
 if (auto EC = deserializeAs(Symbol, Record))
   return std::move(EC);
 return Record;
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -172,6 +172,8 @@
  const llvm::codeview::UnionRecord &ur);
   lldb::TypeSP CreateArrayType(PdbSymUid type_uid,
const llvm::codeview::ArrayRecord &ar);
+  lldb::TypeSP CreateProcedureType(PdbSymUid type_uid,
+   const llvm::codeview::ProcedureRecord &pr);
   lldb::TypeSP
   CreateClassStructUnion(PdbSymUid type_uid, llvm::StringRef name, size_t size,
  clang::TagTypeKind ttk,
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -49,6 +49,8 @@
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/MemoryBuffer.h"
 
+#include "Plugins/Language/CPlusPlus/CPlusPlusNameParser.h"
+
 #include "PdbSymUid.h"
 #include "PdbUtil.h"
 #include "UdtRecordCompleter.h"
@@ -394,6 +396,12 @@
   return GetPdbSymType(tpi, LookThroughModifierRecord(cvt));
 }
 
+static bool IsCVarArgsFunction(llvm::ArrayRef args) {
+  if (args.empty())
+return false;
+  return args.back() == TypeIndex::None();
+}
+
 static clang::TagTypeKind TranslateUdtKind(const TagRecord &cr) {
   switch (cr.Kind) {
   case TypeRecordKind::Class:
@@ -412,6 +420,32 @@
   }
 }
 
+static llvm::Optional
+TranslateCallingConvention(llvm::codeview::CallingConvention conv) {
+  using CC = llvm::codeview::CallingConvention;
+  switch (conv) {
+
+  case CC::NearC:
+  case CC::FarC:
+return clang::CallingConv::CC_C;
+  case CC::NearPascal:
+  case CC::FarPascal:
+return clang::CallingConv::CC_X86Pascal;
+  case CC::NearFast:
+  case CC::FarFast:
+return clang::CallingConv::CC_X86FastCall;
+  case CC::NearStdCall:
+  case CC::FarStdCall:
+return clang::CallingConv::CC_X86StdCall;
+  case CC::ThisCall:
+return clang::CallingConv::CC_X86ThisCall;
+  case CC::NearVector:
+return clang::CallingConv::CC_X86VectorCall;
+  default:
+return llvm::None;
+  }
+}
+
 void SymbolFileNativePDB::Initialize() {
   PluginManager::RegisterPlugin(GetPluginNameStatic(),
 GetPluginDescriptionStatic(), CreateInstance,
@@ -540,7 +574,6 @@
   PdbSymUid sig_uid =
   PdbSymUid::makeTypeSymId(PDB_SymType::FunctionSig, TypeIndex{0}, false);
   Mangled mangled(getSymbolName(sym_record));
-
   FunctionSP func_sp = std::make_shared(
   sc.comp_unit, func_uid.toOpaqueId(), sig_uid.toOpaqueId(), mangled,
   func_type, func_range);
@@ -598,6 +631,8 @@
 lldb::TypeSP SymbolFileNativePDB::CreatePointerType(
 PdbSymUid type_uid, const llvm::codeview::PointerRecord &pr) {
   TypeSP pointee = GetOrCreateType(pr.ReferentType);
+  if (!pointee)
+return nullptr;
   CompilerType pointee_ct = pointee->GetForwardCompilerType();
   lldbassert(pointee_ct);
   Declaration decl;
@@ -670,7 +705,8 @@
 return nullptr;
 
   ll

[Lldb-commits] [PATCH] D53532: [FileSystem] Extend file system and have it use the VFS.

2018-10-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345783: [FileSystem] Extend file system and have it use the 
VFS. (authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53532?vs=171845&id=172028#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D53532

Files:
  lldb/trunk/include/lldb/Host/FileSystem.h
  lldb/trunk/include/lldb/Utility/FileSpec.h
  lldb/trunk/source/Core/Disassembler.cpp
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Core/ModuleList.cpp
  lldb/trunk/source/Core/SourceManager.cpp
  lldb/trunk/source/Host/common/FileSystem.cpp
  lldb/trunk/source/Host/common/HostInfoBase.cpp
  lldb/trunk/source/Host/common/Symbols.cpp
  lldb/trunk/source/Host/posix/HostProcessPosix.cpp
  lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
  lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
  lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/unittests/Core/MangledTest.cpp
  lldb/trunk/unittests/Expression/ClangParserTest.cpp
  lldb/trunk/unittests/Host/FileSystemTest.cpp
  lldb/trunk/unittests/Host/HostInfoTest.cpp
  lldb/trunk/unittests/Host/SymbolsTest.cpp
  lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
  lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
  lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
  lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
  lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
  lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
  lldb/trunk/unittests/Target/ModuleCacheTest.cpp

Index: lldb/trunk/unittests/Host/FileSystemTest.cpp
===
--- lldb/trunk/unittests/Host/FileSystemTest.cpp
+++ lldb/trunk/unittests/Host/FileSystemTest.cpp
@@ -7,13 +7,154 @@
 //
 //===--===//
 
+#include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
 #include "lldb/Host/FileSystem.h"
+#include "llvm/Support/Errc.h"
 
 extern const char *TestMainArgv0;
 
 using namespace lldb_private;
+using namespace llvm;
+using llvm::sys::fs::UniqueID;
+
+// Modified from llvm/unittests/Support/VirtualFileSystemTest.cpp
+namespace {
+struct DummyFile : public vfs::File {
+  vfs::Status S;
+  explicit DummyFile(vfs::Status S) : S(S) {}
+  llvm::ErrorOr status() override { return S; }
+  llvm::ErrorOr>
+  getBuffer(const Twine &Name, int64_t FileSize, bool RequiresNullTerminator,
+bool IsVolatile) override {
+llvm_unreachable("unimplemented");
+  }
+  std::error_code close() override { return std::error_code(); }
+};
+
+class DummyFileSystem : public vfs::FileSystem {
+  int FSID;   // used to produce UniqueIDs
+  int FileID; // used to produce UniqueIDs
+  std::string cwd;
+  std::map FilesAndDirs;
+
+  static int getNextFSID() {
+static int Count = 0;
+return Count++;
+  }
+
+public:
+  DummyFileSystem() : FSID(getNextFSID()), FileID(0) {}
+
+  ErrorOr status(const Twine &Path) override {
+std::map::iterator I =
+FilesAndDirs.find(Path.str());
+if (I == FilesAndDirs.end())
+  return make_error_code(llvm::errc::no_such_file_or_directory);
+return I->second;
+  }
+  ErrorOr>
+  openFileForRead(const Twine &Path) override {
+auto S = status(Path);
+if (S)
+  return std::unique_ptr(new DummyFile{*S});
+return S.getError();
+  }
+  llvm::ErrorOr getCurrentWorkingDirectory() const override {
+return cwd;
+  }
+  std::error_code setCurrentWorkingDirectory(const Twine &Path) override {
+cwd = Path.str();
+return std::error_code();
+  }
+  // Map any symlink to "/symlink".
+  std::error_code getRealPath(const Twine &Path,
+  SmallVectorImpl &Output) const override {
+auto I = FilesAndDirs.find(Path.str());
+if (I == FilesAndDirs.end())
+  return make_error_code(llvm::errc::no_such_file_or_directory);
+if (I->second.isSymlink()) {
+  Output.clear();
+  Twine("/symlink").toVector(Output);
+  return std::error_code();
+}
+Output.clear();
+Path.toVector(Output);
+return std::error_code();
+  }
+
+  struct DirIterImpl : public llvm::vfs::detail::DirIterImpl {
+std::map &FilesAndDirs;
+std::map::iterator I;
+std::string Path;
+bool isInPath(StringRef S) {
+  if (Path.size() < S.size() && S.find(Path) == 0) {
+auto LastSep =

[Lldb-commits] [lldb] r345783 - [FileSystem] Extend file system and have it use the VFS.

2018-10-31 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Oct 31 14:49:27 2018
New Revision: 345783

URL: http://llvm.org/viewvc/llvm-project?rev=345783&view=rev
Log:
[FileSystem] Extend file system and have it use the VFS.

This patch extends the FileSystem class with a bunch of functions that
are currently implemented as methods of the FileSpec class. These
methods will be removed in future commits and replaced by calls to the
file system.

The new functions are operated in terms of the virtual file system which
was recently moved from clang into LLVM so it could be reused in lldb.
Because the VFS is stateful, we turned the FileSystem class into a
singleton.

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

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/include/lldb/Utility/FileSpec.h
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Core/SourceManager.cpp
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Host/common/HostInfoBase.cpp
lldb/trunk/source/Host/common/Symbols.cpp
lldb/trunk/source/Host/posix/HostProcessPosix.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp

lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/unittests/Core/MangledTest.cpp
lldb/trunk/unittests/Expression/ClangParserTest.cpp
lldb/trunk/unittests/Host/FileSystemTest.cpp
lldb/trunk/unittests/Host/HostInfoTest.cpp
lldb/trunk/unittests/Host/SymbolsTest.cpp
lldb/trunk/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
lldb/trunk/unittests/Symbol/TestDWARFCallFrameInfo.cpp
lldb/trunk/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
lldb/trunk/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
lldb/trunk/unittests/Target/ModuleCacheTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345783&r1=345782&r2=345783&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 31 14:49:27 2018
@@ -12,7 +12,10 @@
 
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+
+#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Chrono.h"
+#include "llvm/Support/VirtualFileSystem.h"
 
 #include "lldb/lldb-types.h"
 
@@ -26,17 +29,101 @@ public:
   static const char *DEV_NULL;
   static const char *PATH_CONVERSION_ERROR;
 
-  static Status Symlink(const FileSpec &src, const FileSpec &dst);
-  static Status Readlink(const FileSpec &src, FileSpec &dst);
+  FileSystem() : m_fs(llvm::vfs::getRealFileSystem()) {}
+  FileSystem(llvm::IntrusiveRefCntPtr fs) : m_fs(fs) {}
+
+  static FileSystem &Instance();
+
+  static void Initialize();
+  static void Initialize(llvm::IntrusiveRefCntPtr fs);
+  static void Terminate();
+
+  Status Symlink(const FileSpec &src, const FileSpec &dst);
+  Status Readlink(const FileSpec &src, FileSpec &dst);
 
-  static Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
+  Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst);
 
   /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be
   /// manipulated and closed with the normal ::fread, ::fclose, etc. functions.
-  static FILE *Fopen(const char *path, const char *mode);
+  FILE *Fopen(const char *path, const char *mode);
 
-  static llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec);
+  /// Returns the modification time of the given file.
+  /// @{
+  llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const;
+  llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const;
+  /// @}
+
+  /// Returns the on-disk size of the given file in bytes.
+  /// @{
+  uint64_t GetByteSize(const FileSpec &file_spec) const;
+  uint64_t GetByteSize(const llvm::Twine &path) const;
+  /// @}
+
+  /// Return the current permissions of the given file.
+  ///
+  /// Returns a bitmask for the current permissions of the file (zero or more
+  /// of the permission bits defined in File::Permissions).
+  /// @{
+  uint32_t GetPermissions(const FileSpec &file_spec) const;
+  uint32_t Ge

[Lldb-commits] [PATCH] D53532: [FileSystem] Extend file system and have it use the VFS.

2018-10-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB345783: [FileSystem] Extend file system and have it use 
the VFS. (authored by JDevlieghere, committed by ).
Herald added subscribers: teemperor, abidh.

Changed prior to commit:
  https://reviews.llvm.org/D53532?vs=171845&id=172027#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D53532

Files:
  include/lldb/Host/FileSystem.h
  include/lldb/Utility/FileSpec.h
  source/Core/Disassembler.cpp
  source/Core/Module.cpp
  source/Core/ModuleList.cpp
  source/Core/SourceManager.cpp
  source/Host/common/FileSystem.cpp
  source/Host/common/HostInfoBase.cpp
  source/Host/common/Symbols.cpp
  source/Host/posix/HostProcessPosix.cpp
  source/Initialization/SystemInitializerCommon.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  source/Plugins/Platform/Android/AdbClient.cpp
  source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Target/Platform.cpp
  unittests/Core/MangledTest.cpp
  unittests/Expression/ClangParserTest.cpp
  unittests/Host/FileSystemTest.cpp
  unittests/Host/HostInfoTest.cpp
  unittests/Host/SymbolsTest.cpp
  unittests/ObjectFile/ELF/TestObjectFileELF.cpp
  unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
  unittests/Symbol/TestClangASTContext.cpp
  unittests/Symbol/TestDWARFCallFrameInfo.cpp
  unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
  unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
  unittests/Target/ModuleCacheTest.cpp

Index: unittests/ObjectFile/ELF/TestObjectFileELF.cpp
===
--- unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -14,6 +14,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/Compression.h"
@@ -29,6 +30,7 @@
 class ObjectFileELFTest : public testing::Test {
 public:
   void SetUp() override {
+FileSystem::Initialize();
 HostInfo::Initialize();
 ObjectFileELF::Initialize();
 SymbolVendorELF::Initialize();
@@ -38,6 +40,7 @@
 SymbolVendorELF::Terminate();
 ObjectFileELF::Terminate();
 HostInfo::Terminate();
+FileSystem::Terminate();
   }
 
 protected:
Index: unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
===
--- unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Core/Address.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
@@ -49,6 +50,7 @@
 ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
 #endif
 
+FileSystem::Initialize();
 HostInfo::Initialize();
 ObjectFilePECOFF::Initialize();
 SymbolFileDWARF::Initialize();
@@ -65,6 +67,7 @@
 SymbolFileDWARF::Terminate();
 ObjectFilePECOFF::Terminate();
 HostInfo::Terminate();
+FileSystem::Terminate();
 
 #if defined(_MSC_VER)
 ::CoUninitialize();
Index: unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
===
--- unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
+++ unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Core/Address.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
@@ -38,21 +39,23 @@
 // Initialize and TearDown the plugin every time, so we get a brand new
 // AST every time so that modifications to the AST from each test don't
 // leak into the next test.
-HostInfo::Initialize();
-ObjectFilePECOFF::Initialize();
-SymbolFileDWARF::Initialize();
-ClangASTContext::Initialize();
-SymbolFilePDB::Initialize();
+FileSystem::Initialize();
+HostInfo::Initialize();
+ObjectFilePECOFF::Initialize();
+SymbolFileDWARF::Initialize();
+ClangASTContext::Initialize();
+SymbolFilePDB::Initialize();
 
-m_dwarf_test_exe = GetInputFilePath("test-dwarf.exe");
+m_dwarf_test_exe = GetInputFilePath("test-dwarf.exe");
   }
 
   void TearDown() override {
 SymbolFilePDB::Terminate();
 ClangASTContext::Initialize();
 SymbolFileDWARF::Terminate();
 ObjectFilePECOFF::Terminate();
 HostInfo::Terminate();
+FileSystem::Terminate();
   }
 
 pro

[Lldb-commits] [lldb] r345787 - [FileSystem] Remove EnumerateDirectory

2018-10-31 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Oct 31 15:09:58 2018
New Revision: 345787

URL: http://llvm.org/viewvc/llvm-project?rev=345787&view=rev
Log:
[FileSystem] Remove EnumerateDirectory

The new implementation of EnumerateDirectory relies on `::no_push()`
being implemented for the VFS recursive directory iterators. However
this patch (D53465) hasn't been landed yet.

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/unittests/Host/FileSystemTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345787&r1=345786&r2=345787&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 31 15:09:58 2018
@@ -92,28 +92,6 @@ public:
   void Resolve(FileSpec &file_spec);
   /// @}
 
-  enum EnumerateDirectoryResult {
-/// Enumerate next entry in the current directory.
-eEnumerateDirectoryResultNext,
-/// Recurse into the current entry if it is a directory or symlink, or next
-/// if not.
-eEnumerateDirectoryResultEnter,
-/// Stop directory enumerations at any level.
-eEnumerateDirectoryResultQuit
-  };
-
-  typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
-  void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef);
-
-  typedef std::function
-  DirectoryCallback;
-
-  void EnumerateDirectory(llvm::Twine path, bool find_directories,
-  bool find_files, bool find_other,
-  EnumerateDirectoryCallbackType callback,
-  void *callback_baton);
-
   std::error_code GetRealPath(const llvm::Twine &path,
   llvm::SmallVectorImpl &output) const;
 

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345787&r1=345786&r2=345787&view=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Oct 31 15:09:58 2018
@@ -96,36 +96,6 @@ bool FileSystem::Readable(const FileSpec
   return Readable(file_spec.GetPath());
 }
 
-void FileSystem::EnumerateDirectory(Twine path, bool find_directories,
-bool find_files, bool find_other,
-EnumerateDirectoryCallbackType callback,
-void *callback_baton) {
-  std::error_code EC;
-  vfs::recursive_directory_iterator Iter(*m_fs, path, EC);
-  vfs::recursive_directory_iterator End;
-  for (; Iter != End && !EC; Iter.increment(EC)) {
-const auto &Item = *Iter;
-ErrorOr Status = m_fs->status(Item.path());
-if (!Status)
-  break;
-if (!find_files && Status->isRegularFile())
-  continue;
-if (!find_directories && Status->isDirectory())
-  continue;
-if (!find_other && Status->isOther())
-  continue;
-
-auto Result = callback(callback_baton, Status->getType(), Item.path());
-if (Result == eEnumerateDirectoryResultQuit)
-  return;
-if (Result == eEnumerateDirectoryResultNext) {
-  // Default behavior is to recurse. Opt out if the callback doesn't want
-  // this behavior.
-  Iter.no_push();
-}
-  }
-}
-
 std::error_code FileSystem::MakeAbsolute(SmallVectorImpl &path) const {
   return m_fs->makeAbsolute(path);
 }

Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=345787&r1=345786&r2=345787&view=diff
==
--- lldb/trunk/unittests/Host/FileSystemTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSystemTest.cpp Wed Oct 31 15:09:58 2018
@@ -265,27 +265,3 @@ TEST(FileSystemTest, Resolve) {
 EXPECT_EQ("bogus", file_spec.GetPath());
   }
 }
-
-FileSystem::EnumerateDirectoryResult
-VFSCallback(void *baton, llvm::sys::fs::file_type file_type,
-llvm::StringRef path) {
-  auto visited = static_cast *>(baton);
-  visited->push_back(path.str());
-  return FileSystem::eEnumerateDirectoryResultNext;
-}
-
-TEST(FileSystemTest, EnumerateDirectory) {
-  FileSystem fs(GetSimpleDummyFS());
-
-  std::vector visited;
-
-  constexpr bool find_directories = true;
-  constexpr bool find_files = true;
-  constexpr bool find_other = true;
-
-  fs.EnumerateDirectory("/", find_directories, find_files, find_other,
-VFSCallback, &visited);
-
-  EXPECT_THAT(visited,
-  testing::UnorderedElementsAre("/foo", "/bar", "/baz", "/qux"));
-}


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-b

[Lldb-commits] [lldb] r345799 - [FileSystem] Re-add EnumerateDirectory

2018-10-31 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Oct 31 17:26:09 2018
New Revision: 345799

URL: http://llvm.org/viewvc/llvm-project?rev=345799&view=rev
Log:
[FileSystem] Re-add EnumerateDirectory

Re-enable EnumerateDirectory now that no_push is available in llvm (r345793).

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/unittests/Host/FileSystemTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345799&r1=345798&r2=345799&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Wed Oct 31 17:26:09 2018
@@ -92,6 +92,28 @@ public:
   void Resolve(FileSpec &file_spec);
   /// @}
 
+  enum EnumerateDirectoryResult {
+/// Enumerate next entry in the current directory.
+eEnumerateDirectoryResultNext,
+/// Recurse into the current entry if it is a directory or symlink, or next
+/// if not.
+eEnumerateDirectoryResultEnter,
+/// Stop directory enumerations at any level.
+eEnumerateDirectoryResultQuit
+  };
+
+  typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
+  void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef);
+
+  typedef std::function
+  DirectoryCallback;
+
+  void EnumerateDirectory(llvm::Twine path, bool find_directories,
+  bool find_files, bool find_other,
+  EnumerateDirectoryCallbackType callback,
+  void *callback_baton);
+
   std::error_code GetRealPath(const llvm::Twine &path,
   llvm::SmallVectorImpl &output) const;
 

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345799&r1=345798&r2=345799&view=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Wed Oct 31 17:26:09 2018
@@ -96,6 +96,36 @@ bool FileSystem::Readable(const FileSpec
   return Readable(file_spec.GetPath());
 }
 
+void FileSystem::EnumerateDirectory(Twine path, bool find_directories,
+bool find_files, bool find_other,
+EnumerateDirectoryCallbackType callback,
+void *callback_baton) {
+  std::error_code EC;
+  vfs::recursive_directory_iterator Iter(*m_fs, path, EC);
+  vfs::recursive_directory_iterator End;
+  for (; Iter != End && !EC; Iter.increment(EC)) {
+const auto &Item = *Iter;
+ErrorOr Status = m_fs->status(Item.path());
+if (!Status)
+  break;
+if (!find_files && Status->isRegularFile())
+  continue;
+if (!find_directories && Status->isDirectory())
+  continue;
+if (!find_other && Status->isOther())
+  continue;
+
+auto Result = callback(callback_baton, Status->getType(), Item.path());
+if (Result == eEnumerateDirectoryResultQuit)
+  return;
+if (Result == eEnumerateDirectoryResultNext) {
+  // Default behavior is to recurse. Opt out if the callback doesn't want
+  // this behavior.
+  Iter.no_push();
+}
+  }
+}
+
 std::error_code FileSystem::MakeAbsolute(SmallVectorImpl &path) const {
   return m_fs->makeAbsolute(path);
 }

Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=345799&r1=345798&r2=345799&view=diff
==
--- lldb/trunk/unittests/Host/FileSystemTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSystemTest.cpp Wed Oct 31 17:26:09 2018
@@ -265,3 +265,27 @@ TEST(FileSystemTest, Resolve) {
 EXPECT_EQ("bogus", file_spec.GetPath());
   }
 }
+
+FileSystem::EnumerateDirectoryResult
+VFSCallback(void *baton, llvm::sys::fs::file_type file_type,
+llvm::StringRef path) {
+  auto visited = static_cast *>(baton);
+  visited->push_back(path.str());
+  return FileSystem::eEnumerateDirectoryResultNext;
+}
+
+TEST(FileSystemTest, EnumerateDirectory) {
+  FileSystem fs(GetSimpleDummyFS());
+
+  std::vector visited;
+
+  constexpr bool find_directories = true;
+  constexpr bool find_files = true;
+  constexpr bool find_other = true;
+
+  fs.EnumerateDirectory("/", find_directories, find_files, find_other,
+VFSCallback, &visited);
+
+  EXPECT_THAT(visited,
+  testing::UnorderedElementsAre("/foo", "/bar", "/baz", "/qux"));
+}


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


[Lldb-commits] [lldb] r345800 - [FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.

2018-10-31 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Oct 31 17:33:27 2018
New Revision: 345800

URL: http://llvm.org/viewvc/llvm-project?rev=345800&view=rev
Log:
[FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.

This patch moves the EnumerateDirectory functionality and related enum
and typedef from FileSpec to FileSystem.

This is part of a set of patches that extracts file system related
convenience methods from FileSpec. The long term goal is to remove this
method altogether and use the iterators directly, but for introducing
the VFS into LLDB this change is sufficient.

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

Modified:
lldb/trunk/include/lldb/Utility/FileSpec.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Utility/FileSpec.cpp

Modified: lldb/trunk/include/lldb/Utility/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345800&r1=345799&r2=345800&view=diff
==
--- lldb/trunk/include/lldb/Utility/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed Oct 31 17:33:27 2018
@@ -545,27 +545,6 @@ public:
 
   ConstString GetLastPathComponent() const;
 
-  enum EnumerateDirectoryResult {
-eEnumerateDirectoryResultNext,  // Enumerate next entry in the current
-// directory
-eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is 
a
-// directory or symlink, or next if not
-eEnumerateDirectoryResultQuit   // Stop directory enumerations at any level
-  };
-
-  typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)(
-  void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec);
-
-  static void EnumerateDirectory(llvm::StringRef dir_path,
- bool find_directories, bool find_files,
- bool find_other,
- EnumerateDirectoryCallbackType callback,
- void *callback_baton);
-
-  typedef std::function
-  DirectoryCallback;
-
 protected:
   //--
   // Convenience method for setting the file without changing the style.

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=345800&r1=345799&r2=345800&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Oct 31 17:33:27 2018
@@ -21,6 +21,7 @@
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/Expression/REPL.h"
 #include "lldb/Host/File.h" // for File, File::kInv...
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/Terminal.h"
 #include "lldb/Host/ThreadLauncher.h"
@@ -604,16 +605,16 @@ bool Debugger::LoadPlugin(const FileSpec
   return false;
 }
 
-static FileSpec::EnumerateDirectoryResult
+static FileSystem::EnumerateDirectoryResult
 LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
-   const FileSpec &file_spec) {
+   llvm::StringRef path) {
   Status error;
 
   static ConstString g_dylibext(".dylib");
   static ConstString g_solibext(".so");
 
   if (!baton)
-return FileSpec::eEnumerateDirectoryResultQuit;
+return FileSystem::eEnumerateDirectoryResultQuit;
 
   Debugger *debugger = (Debugger *)baton;
 
@@ -624,18 +625,18 @@ LoadPluginCallback(void *baton, llvm::sy
   // file type information.
   if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
   ft == fs::file_type::type_unknown) {
-FileSpec plugin_file_spec(file_spec);
+FileSpec plugin_file_spec(path, false);
 plugin_file_spec.ResolvePath();
 
 if (plugin_file_spec.GetFileNameExtension() != g_dylibext &&
 plugin_file_spec.GetFileNameExtension() != g_solibext) {
-  return FileSpec::eEnumerateDirectoryResultNext;
+  return FileSystem::eEnumerateDirectoryResultNext;
 }
 
 Status plugin_load_error;
 debugger->LoadPlugin(plugin_file_spec, 

[Lldb-commits] [PATCH] D53785: [FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.

2018-10-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345800: [FileSystem] Move EnumerateDirectory from FileSpec 
to FileSystem. (authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53785?vs=171377&id=172064#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53785

Files:
  lldb/trunk/include/lldb/Utility/FileSpec.h
  lldb/trunk/source/Core/Debugger.cpp
  lldb/trunk/source/Core/PluginManager.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.h
  lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/trunk/source/Target/Platform.cpp
  lldb/trunk/source/Utility/FileSpec.cpp

Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
===
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
@@ -139,12 +139,13 @@
   return error;
 }
 
-FileSpec::EnumerateDirectoryResult
+FileSystem::EnumerateDirectoryResult
 PlatformRemoteDarwinDevice::GetContainedFilesIntoVectorOfStringsCallback(
-void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) {
+void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) {
   ((PlatformRemoteDarwinDevice::SDKDirectoryInfoCollection *)baton)
-  ->push_back(PlatformRemoteDarwinDevice::SDKDirectoryInfo(file_spec));
-  return FileSpec::eEnumerateDirectoryResultNext;
+  ->push_back(
+  PlatformRemoteDarwinDevice::SDKDirectoryInfo(FileSpec(path, false)));
+  return FileSystem::eEnumerateDirectoryResultNext;
 }
 
 bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
@@ -175,10 +176,10 @@
   const bool find_other = false;
 
   SDKDirectoryInfoCollection builtin_sdk_directory_infos;
-  FileSpec::EnumerateDirectory(m_device_support_directory, find_directories,
-   find_files, find_other,
-   GetContainedFilesIntoVectorOfStringsCallback,
-   &builtin_sdk_directory_infos);
+  FileSystem::Instance().EnumerateDirectory(
+  m_device_support_directory, find_directories, find_files, find_other,
+  GetContainedFilesIntoVectorOfStringsCallback,
+  &builtin_sdk_directory_infos);
 
   // Only add SDK directories that have symbols in them, some SDKs only
   // contain developer disk images and no symbols, so they aren't useful to
@@ -214,13 +215,13 @@
 }
 char path[PATH_MAX];
 if (local_sdk_cache.GetPath(path, sizeof(path))) {
-FileSpec::EnumerateDirectory(
-path, find_directories, find_files, find_other,
-GetContainedFilesIntoVectorOfStringsCallback,
-&m_sdk_directory_infos);
-const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
-// First try for an exact match of major, minor and update
-for (uint32_t i = num_installed; i < num_sdk_infos; ++i) {
+  FileSystem::Instance().EnumerateDirectory(
+  path, find_directories, find_files, find_other,
+  GetContainedFilesIntoVectorOfStringsCallback,
+  &m_sdk_directory_infos);
+  const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+  // First try for an exact match of major, minor and update
+  for (uint32_t i = num_installed; i < num_sdk_infos; ++i) {
 m_sdk_directory_infos[i].user_cached = true;
 if (log) {
 log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded "
@@ -235,10 +236,10 @@
   const char *addtional_platform_dirs = getenv("PLATFORM_SDK_DIRECTORY");
   if (addtional_platform_dirs) {
 SDKDirectoryInfoCollection env_var_sdk_directory_infos;
-FileSpec::EnumerateDirectory(addtional_platform_dirs, find_directories,
- find_files, find_other,
- GetContainedFilesIntoVectorOfStringsCallback,
- &env_var_sdk_directory_infos);
+FileSystem::Instance().EnumerateDirectory(
+addtional_platform_dirs, find_directories, find_files, find_other,
+GetContainedFilesIntoVectorOfStringsCall

[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types

2018-10-31 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I now spent (way too much :-) time experimenting with alternative 
implementations of this patch. In https://reviews.llvm.org/D53961 there is a 
version that changes GetNumChildren() to take an execution context. I don't 
think that doing it this way is a good solution either and here's why:

If we move the logic to GetNumChildren; we can print the array elements, but 
the type remains unchanged, which makes for a worse user experience.

With VLAs implemented as dynamic types we get

  (lldb) fr v vla
  (int [4]) vla = ([0] = 1, [1] = 2)

if we only change GetNumChildren() we get

  (lldb) fr v vla
  (int []) vla = ([0] = 1, [1] = 2)

which is less nice, since we no longer see the size of the array.

What i'm proposing is to keep the implementation as a dynamic type in 
`ItaniumABILanguageRuntime.cpp` but reduce the surface area of the execution 
context pass-through in `DWARFASTParserClang.cpp`. Similar to what I did in 
https://reviews.llvm.org/D53961 we can add a `ResolveDynamicArrayUID(uid, 
exe_ctx)` method that only creates an array type. Since we need to re-create a 
fresh clang type at every execution context anyway, going through the 
single-function array-only DWARF parser seems like the right trade-off to me. 
Let me know what you think!


https://reviews.llvm.org/D53530



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


[Lldb-commits] [lldb] r345812 - [FileSystem] Remove GetByteSize() from FileSpec

2018-10-31 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Oct 31 21:45:28 2018
New Revision: 345812

URL: http://llvm.org/viewvc/llvm-project?rev=345812&view=rev
Log:
[FileSystem] Remove GetByteSize() from FileSpec

This patch removes the GetByteSize method from FileSpec and updates its
uses with calls to the FileSystem.

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

Modified:
lldb/trunk/include/lldb/Core/ModuleSpec.h
lldb/trunk/include/lldb/Utility/FileSpec.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Target/ModuleCache.cpp
lldb/trunk/source/Utility/FileSpec.cpp
lldb/trunk/unittests/Target/ModuleCacheTest.cpp

Modified: lldb/trunk/include/lldb/Core/ModuleSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleSpec.h?rev=345812&r1=345811&r2=345812&view=diff
==
--- lldb/trunk/include/lldb/Core/ModuleSpec.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleSpec.h Wed Oct 31 21:45:28 2018
@@ -11,6 +11,7 @@
 #define liblldb_ModuleSpec_h_
 
 // Project includes
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Target/PathMappingList.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/FileSpec.h"
@@ -34,15 +35,17 @@ public:
 m_object_name(), m_object_offset(0), m_object_size(0),
 m_source_mappings() {}
 
-  ModuleSpec(const FileSpec &file_spec, const UUID& uuid = UUID())
+  ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID())
   : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(),
 m_uuid(uuid), m_object_name(), m_object_offset(0),
-m_object_size(file_spec.GetByteSize()), m_source_mappings() {}
+m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
+m_source_mappings() {}
 
   ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
   : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch),
 m_uuid(), m_object_name(), m_object_offset(0),
-m_object_size(file_spec.GetByteSize()), m_source_mappings() {}
+m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
+m_source_mappings() {}
 
   ModuleSpec(const ModuleSpec &rhs)
   : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file),

Modified: lldb/trunk/include/lldb/Utility/FileSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345812&r1=345811&r2=345812&view=diff
==
--- lldb/trunk/include/lldb/Utility/FileSpec.h (original)
+++ lldb/trunk/include/lldb/Utility/FileSpec.h Wed Oct 31 21:45:28 2018
@@ -311,8 +311,6 @@ public:
   //--
   bool ResolvePath();
 
-  uint64_t GetByteSize() const;
-
   Style GetPathStyle() const;
 
   //--

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=345812&r1=345811&r2=345812&view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Oct 31 21:45:28 2018
@@ -1252,7 +1252,8 @@ ObjectFile *Module::GetObjectFile() {
  GetFileSpec().GetFilename().AsCString(""));
   DataBufferSP data_sp;
   lldb::offset_t data_offset = 0;
-  const lldb::offset_t file_size = m_file.GetByteSize();
+  const lldb::offset_t file_size =
+  FileSystem::Instance().GetByteSize(m_file);
   if (file_size > m_object_offset) {
 m_did_load_objfile = true;
 m_objfile_sp = ObjectFile::FindPlugin(

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=345812&r1=345811&r2=345812&view=diff
==
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Wed Oct 31 21:45:28 2018
@@ -48,6 +48,7 @@
 // C++ Includes
 #include 
 
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostProcess.h"
@@ -554,7 +555,8 @@ Status Host::RunShellCommand(const Args
 
   if (command_output_ptr) {
 command_output_ptr->clear();
-uint64_t file_size = output_file_spec.GetByteSize();
+uint64_t file_size =
+F

[Lldb-commits] [PATCH] D53788: [FileSystem] Remove GetByteSize() from FileSpec

2018-10-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345812: [FileSystem] Remove GetByteSize() from FileSpec 
(authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53788?vs=171383&id=172084#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53788

Files:
  lldb/trunk/include/lldb/Core/ModuleSpec.h
  lldb/trunk/include/lldb/Utility/FileSpec.h
  lldb/trunk/source/Core/Module.cpp
  lldb/trunk/source/Host/common/Host.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwp.cpp
  lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
  lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
  lldb/trunk/source/Symbol/ObjectFile.cpp
  lldb/trunk/source/Target/ModuleCache.cpp
  lldb/trunk/source/Utility/FileSpec.cpp
  lldb/trunk/unittests/Target/ModuleCacheTest.cpp

Index: lldb/trunk/unittests/Target/ModuleCacheTest.cpp
===
--- lldb/trunk/unittests/Target/ModuleCacheTest.cpp
+++ lldb/trunk/unittests/Target/ModuleCacheTest.cpp
@@ -83,12 +83,12 @@
 static void VerifyDiskState(const FileSpec &cache_dir, const char *hostname) {
   FileSpec uuid_view = GetUuidView(cache_dir);
   EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString();
-  EXPECT_EQ(module_size, uuid_view.GetByteSize());
+  EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(uuid_view));
 
   FileSpec sysroot_view = GetSysrootView(cache_dir, hostname);
   EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: "
  << sysroot_view.GetCString();
-  EXPECT_EQ(module_size, sysroot_view.GetByteSize());
+  EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(sysroot_view));
 }
 
 void ModuleCacheTest::TryGetAndPut(const FileSpec &cache_dir,
Index: lldb/trunk/source/Host/common/Host.cpp
===
--- lldb/trunk/source/Host/common/Host.cpp
+++ lldb/trunk/source/Host/common/Host.cpp
@@ -48,6 +48,7 @@
 // C++ Includes
 #include 
 
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Host/HostProcess.h"
@@ -554,7 +555,8 @@
 
   if (command_output_ptr) {
 command_output_ptr->clear();
-uint64_t file_size = output_file_spec.GetByteSize();
+uint64_t file_size =
+FileSystem::Instance().GetByteSize(output_file_spec);
 if (file_size > 0) {
   if (file_size > command_output_ptr->max_size()) {
 error.SetErrorStringWithFormat(
Index: lldb/trunk/source/Core/Module.cpp
===
--- lldb/trunk/source/Core/Module.cpp
+++ lldb/trunk/source/Core/Module.cpp
@@ -1252,7 +1252,8 @@
  GetFileSpec().GetFilename().AsCString(""));
   DataBufferSP data_sp;
   lldb::offset_t data_offset = 0;
-  const lldb::offset_t file_size = m_file.GetByteSize();
+  const lldb::offset_t file_size =
+  FileSystem::Instance().GetByteSize(m_file);
   if (file_size > m_object_offset) {
 m_did_load_objfile = true;
 m_objfile_sp = ObjectFile::FindPlugin(
Index: lldb/trunk/source/Target/ModuleCache.cpp
===
--- lldb/trunk/source/Target/ModuleCache.cpp
+++ lldb/trunk/source/Target/ModuleCache.cpp
@@ -227,7 +227,8 @@
 
   if (!module_file_path.Exists())
 return Status("Module %s not found", module_file_path.GetPath().c_str());
-  if (module_file_path.GetByteSize() != module_spec.GetObjectSize())
+  if (FileSystem::Instance().GetByteSize(module_file_path) !=
+  module_spec.GetObjectSize())
 return Status("Module %s has invalid file size",
   module_file_path.GetPath().c_str());
 
Index: lldb/trunk/source/Symbol/ObjectFile.cpp
===
--- lldb/trunk/source/Symbol/ObjectFile.cpp
+++ lldb/trunk/source/Symbol/ObjectFile.cpp
@@ -91,7 +91,7 @@
 const bool must_exist = true;
 if (ObjectFile::SplitArchivePathWithObject(
 path_with_object, archive_file, archive_object, must_exist)) {
-  file_size = archive_file.GetByteSize();
+  file_size = FileSystem::Instance().GetByteSize(archive_file);
   if (file_size > 0) {
 file = &archive_file;
 module_sp->SetFileSpecAndObjectName(archive_file, archive_object);
@@ -212,7 +212,8 @@
   DataBufferSP data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), 512, file_offset);
   if (data_sp) {
 if (file_size == 0) {
-  const lldb::offset_t actual_file_size = file.GetByteSize();
+  const lldb::offset_t actual_file_size =
+