[Lldb-commits] [PATCH] D52461: [PDB] Introduce `MSVCUndecoratedNameParser`
labath added a comment. It's not fully clear to me from the previous comments if you are proceeding with this or not, but in case you are, I have made comments inline. I see that you've added some lit tests, but I also think you it would be good add some unit tests for the name parser functionality per-se (similar to the existing name parsing tests), as it is much easier to see what is going on from those. Right now, I don't think this solution can be specific to the "old" PDB plugin, as this functionality is used from other places as well (RichManglingContext being the most important one). Maybe once we start using the fancy MSVC demangler there, we can revisit that. (But given that the declared intent of that class is to chop up demangled names, I think it would make sense to keep this there even then. Unless it turns out we can delete the whole class at that point.) Comment at: source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp:62-64 + m_specifiers.emplace_back(llvm::StringRef(name.data(), i - 1), +llvm::StringRef(name.data() + last_base_start, +i - last_base_start - 1)); Rewrite this (and all other instances of StringRef -> char * -> StringRef roundtripping) in terms of StringRef functions. Maybe something like: `emplace_back(name.take_front(i-1), name.slice(last_base_start, i-1));` ? Comment at: source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h:35-39 + std::size_t GetSpecifiersCount() const { return m_specifiers.size(); } + + MSVCUndecoratedNameSpecifier GetSpecifierAtIndex(std::size_t index) const { +return m_specifiers[index]; + } Could we replace these by something like `ArrayRef GetSpecifiers()` 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] [PATCH] D53951: [NativePDB] Get LLDB types from PDB function types
aleksandr.urakov accepted this revision. aleksandr.urakov added a comment. This revision is now accepted and ready to land. Looks good, thanks! https://reviews.llvm.org/D53951 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345815 - [Windows] A basic implementation of memory allocations in a debuggee process
Author: aleksandr.urakov Date: Thu Nov 1 01:54:38 2018 New Revision: 345815 URL: http://llvm.org/viewvc/llvm-project?rev=345815&view=rev Log: [Windows] A basic implementation of memory allocations in a debuggee process Summary: This patch adds a basic implementation of `DoAllocateMemory` and `DoDeallocateMemory` for Windows processes. For now it considers only the executable permission (and always allows reads and writes). Reviewers: zturner, asmith, stella.stamenova, labath, clayborg Reviewed By: zturner Subscribers: Hui, vsk, jingham, aleksandr.urakov, clayborg, abidh, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D52618 Added: lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test - copied, changed from r345812, lldb/trunk/lit/Expr/TestIRMemoryMap.test Modified: lldb/trunk/lit/Expr/TestIRMemoryMap.test lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h Modified: lldb/trunk/lit/Expr/TestIRMemoryMap.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/TestIRMemoryMap.test?rev=345815&r1=345814&r2=345815&view=diff == --- lldb/trunk/lit/Expr/TestIRMemoryMap.test (original) +++ lldb/trunk/lit/Expr/TestIRMemoryMap.test Thu Nov 1 01:54:38 2018 @@ -1,4 +1,4 @@ -# XFAIL: windows +# UNSUPPORTED: windows # RUN: %cxx %p/Inputs/call-function.cpp -g -o %t Copied: lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test (from r345812, lldb/trunk/lit/Expr/TestIRMemoryMap.test) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test?p2=lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test&p1=lldb/trunk/lit/Expr/TestIRMemoryMap.test&r1=345812&r2=345815&rev=345815&view=diff == --- lldb/trunk/lit/Expr/TestIRMemoryMap.test (original) +++ lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test Thu Nov 1 01:54:38 2018 @@ -1,6 +1,6 @@ -# XFAIL: windows +# REQUIRES: windows -# RUN: %cxx %p/Inputs/call-function.cpp -g -o %t +# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t # RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic # RUN: lldb-test ir-memory-map -host-only %t %S/Inputs/ir-memory-map-basic Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=345815&r1=345814&r2=345815&view=diff == --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (original) +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Thu Nov 1 01:54:38 2018 @@ -72,6 +72,20 @@ std::string GetProcessExecutableName(DWO return file_name; } +DWORD ConvertLldbToWinApiProtect(uint32_t protect) { + // We also can process a read / write permissions here, but if the debugger + // will make later a write into the allocated memory, it will fail. To get + // around it is possible inside DoWriteMemory to remember memory permissions, + // allow write, write and restore permissions, but for now we process only + // the executable permission. + // + // TODO: Process permissions other than executable + if (protect & ePermissionsExecutable) +return PAGE_EXECUTE_READWRITE; + + return PAGE_READWRITE; +} + } // anonymous namespace namespace lldb_private { @@ -695,6 +709,58 @@ size_t ProcessWindows::DoWriteMemory(lld return bytes_written; } +lldb::addr_t ProcessWindows::DoAllocateMemory(size_t size, uint32_t permissions, + Status &error) { + Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); + llvm::sys::ScopedLock lock(m_mutex); + LLDB_LOG(log, "attempting to allocate {0} bytes with permissions {1}", size, + permissions); + + if (!m_session_data) { +LLDB_LOG(log, "cannot allocate, there is no active debugger connection."); +error.SetErrorString( +"cannot allocate, there is no active debugger connection"); +return 0; + } + + HostProcess process = m_session_data->m_debugger->GetProcess(); + lldb::process_t handle = process.GetNativeProcess().GetSystemHandle(); + auto protect = ConvertLldbToWinApiProtect(permissions); + auto result = VirtualAllocEx(handle, nullptr, size, MEM_COMMIT, protect); + if (!result) { +error.SetError(GetLastError(), eErrorTypeWin32); +LLDB_LOG(log, "allocating failed with error: {0}", error); +return 0; + } + + return reinterpret_cast(result); +} + +Status ProcessWindows::DoDeallocateMemory(lldb::addr_t ptr) { + Status result; + + Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); + llvm::sys::ScopedLock lock(m_mutex); + LLDB_LOG(log, "attempting to deallocate bytes at address {0}", ptr); + + if (!m_sess
[Lldb-commits] [PATCH] D52618: [Windows] A basic implementation of memory allocations in a debuggee process
This revision was automatically updated to reflect the committed changes. Closed by commit rL345815: [Windows] A basic implementation of memory allocations in a debuggee process (authored by aleksandr.urakov, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D52618?vs=167338&id=172097#toc Repository: rL LLVM https://reviews.llvm.org/D52618 Files: lldb/trunk/lit/Expr/TestIRMemoryMap.test lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h Index: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h === --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h @@ -84,6 +84,9 @@ Status &error) override; size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error) override; + lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, +Status &error) override; + Status DoDeallocateMemory(lldb::addr_t ptr) override; Status GetMemoryRegionInfo(lldb::addr_t vm_addr, MemoryRegionInfo &info) override; Index: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp === --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -72,6 +72,20 @@ return file_name; } +DWORD ConvertLldbToWinApiProtect(uint32_t protect) { + // We also can process a read / write permissions here, but if the debugger + // will make later a write into the allocated memory, it will fail. To get + // around it is possible inside DoWriteMemory to remember memory permissions, + // allow write, write and restore permissions, but for now we process only + // the executable permission. + // + // TODO: Process permissions other than executable + if (protect & ePermissionsExecutable) +return PAGE_EXECUTE_READWRITE; + + return PAGE_READWRITE; +} + } // anonymous namespace namespace lldb_private { @@ -695,6 +709,58 @@ return bytes_written; } +lldb::addr_t ProcessWindows::DoAllocateMemory(size_t size, uint32_t permissions, + Status &error) { + Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); + llvm::sys::ScopedLock lock(m_mutex); + LLDB_LOG(log, "attempting to allocate {0} bytes with permissions {1}", size, + permissions); + + if (!m_session_data) { +LLDB_LOG(log, "cannot allocate, there is no active debugger connection."); +error.SetErrorString( +"cannot allocate, there is no active debugger connection"); +return 0; + } + + HostProcess process = m_session_data->m_debugger->GetProcess(); + lldb::process_t handle = process.GetNativeProcess().GetSystemHandle(); + auto protect = ConvertLldbToWinApiProtect(permissions); + auto result = VirtualAllocEx(handle, nullptr, size, MEM_COMMIT, protect); + if (!result) { +error.SetError(GetLastError(), eErrorTypeWin32); +LLDB_LOG(log, "allocating failed with error: {0}", error); +return 0; + } + + return reinterpret_cast(result); +} + +Status ProcessWindows::DoDeallocateMemory(lldb::addr_t ptr) { + Status result; + + Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); + llvm::sys::ScopedLock lock(m_mutex); + LLDB_LOG(log, "attempting to deallocate bytes at address {0}", ptr); + + if (!m_session_data) { +LLDB_LOG(log, "cannot deallocate, there is no active debugger connection."); +result.SetErrorString( +"cannot deallocate, there is no active debugger connection"); +return result; + } + + HostProcess process = m_session_data->m_debugger->GetProcess(); + lldb::process_t handle = process.GetNativeProcess().GetSystemHandle(); + if (!VirtualFreeEx(handle, reinterpret_cast(ptr), 0, MEM_RELEASE)) { +result.SetError(GetLastError(), eErrorTypeWin32); +LLDB_LOG(log, "deallocating failed with error: {0}", result); +return result; + } + + return result; +} + Status ProcessWindows::GetMemoryRegionInfo(lldb::addr_t vm_addr, MemoryRegionInfo &info) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_MEMORY); Index: lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test === --- lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test +++ lldb/trunk/lit/Expr/TestIRMemoryMapWindows.test @@ -0,0 +1,12 @@ +# REQUIRES: windows + +# RUN: clang-cl /Zi %p/Inputs/call-function.cpp -o %t + +# RUN: lldb-test ir-memory-map %t %S/Inputs/ir-memory-map-basic +# RUN: lldb-test ir-memory-map -hos
[Lldb-commits] [PATCH] D52461: [PDB] Introduce `MSVCUndecoratedNameParser`
aleksandr.urakov marked 2 inline comments as done. aleksandr.urakov added a comment. Thank you for comments! I've updated the patch. 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] [PATCH] D52461: [PDB] Introduce `MSVCUndecoratedNameParser`
aleksandr.urakov updated this revision to Diff 172101. https://reviews.llvm.org/D52461 Files: lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp lit/SymbolFile/PDB/ast-restore.test source/Plugins/Language/CPlusPlus/CMakeLists.txt source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h source/Plugins/SymbolFile/PDB/PDBASTParser.cpp source/Plugins/SymbolFile/PDB/PDBASTParser.h source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp source/Plugins/SymbolFile/PDB/SymbolFilePDB.h unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp Index: unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp === --- unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp +++ unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp @@ -138,7 +138,14 @@ {"std::vector>" "::_M_emplace_back_aux", "std::vector>", - "_M_emplace_back_aux"}}; + "_M_emplace_back_aux"}, + {"`anonymous namespace'::foo", "`anonymous namespace'", "foo"}, + {"`operator<'::`2'::B<0>::operator>", + "`operator<'::`2'::B<0>", + "operator>"}, + {"`anonymous namespace'::S::<<::__l2::Foo", + "`anonymous namespace'::S::<<::__l2", + "Foo"}}; llvm::StringRef context, basename; for (const auto &test : test_cases) { Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.h === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -187,7 +187,7 @@ const llvm::pdb::PDBSymbolCompiland &pdb_compiland, llvm::DenseMap &index_map) const; - void FindTypesByName(const std::string &name, + void FindTypesByName(llvm::StringRef name, const lldb_private::CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, lldb_private::TypeMap &types); Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -9,6 +9,9 @@ #include "SymbolFilePDB.h" +#include "PDBASTParser.h" +#include "PDBLocationToDWARFExpression.h" + #include "clang/Lex/Lexer.h" #include "lldb/Core/Module.h" @@ -46,9 +49,8 @@ #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" // For IsCPPMangledName +#include "Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h" #include "Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h" -#include "Plugins/SymbolFile/PDB/PDBASTParser.h" -#include "Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h" #include @@ -1063,7 +1065,7 @@ lldbassert(sc.module_sp.get()); if (!name.GetStringRef().equals( -PDBASTParser::PDBNameDropScope(pdb_data->getName( +MSVCUndecoratedNameParser::DropScope(pdb_data->getName( continue; sc.comp_unit = ParseCompileUnitForUID(GetCompilandId(*pdb_data)).get(); @@ -1170,22 +1172,11 @@ // Class. We won't bother to check if the parent is UDT or Enum here. m_func_method_names.Append(ConstString(name), uid); -ConstString cstr_name(name); - // To search a method name, like NS::Class:MemberFunc, LLDB searches // its base name, i.e. MemberFunc by default. Since PDBSymbolFunc does // not have inforamtion of this, we extract base names and cache them // by our own effort. -llvm::StringRef basename; -CPlusPlusLanguage::MethodName cpp_method(cstr_name); -if (cpp_method.IsValid()) { - llvm::StringRef context; - basename = cpp_method.GetBasename(); - if (basename.empty()) -CPlusPlusLanguage::ExtractContextAndIdentifier(name.c_str(), - context, basename); -} - +llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name); if (!basename.empty()) m_func_base_names.Append(ConstString(basename), uid); else { @@ -1198,11 +1189,12 @@ } else { // Handle not-method symbols. -// The function name might contain namespace, or its lexical scope. It -// is not safe to get its base name by applying same scheme as we deal -// with the method names. -// FIXME: Remove namespace if function is static in a scope. -m_func_base_names.Append(ConstString(name), uid); +// The function name might contain namespace, or its lexical scope. +llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name); +if (!basename.empty()) + m_func_base_names.Append(ConstString(basename), uid); +else + m_func_base_names.A
[Lldb-commits] [PATCH] D52461: [PDB] Introduce `MSVCUndecoratedNameParser`
aleksandr.urakov updated this revision to Diff 172102. https://reviews.llvm.org/D52461 Files: lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp lit/SymbolFile/PDB/ast-restore.test source/Plugins/Language/CPlusPlus/CMakeLists.txt source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.cpp source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h source/Plugins/SymbolFile/PDB/PDBASTParser.cpp source/Plugins/SymbolFile/PDB/PDBASTParser.h source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp source/Plugins/SymbolFile/PDB/SymbolFilePDB.h unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp Index: unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp === --- unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp +++ unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp @@ -138,7 +138,14 @@ {"std::vector>" "::_M_emplace_back_aux", "std::vector>", - "_M_emplace_back_aux"}}; + "_M_emplace_back_aux"}, + {"`anonymous namespace'::foo", "`anonymous namespace'", "foo"}, + {"`operator<'::`2'::B<0>::operator>", + "`operator<'::`2'::B<0>", + "operator>"}, + {"`anonymous namespace'::S::<<::__l2::Foo", + "`anonymous namespace'::S::<<::__l2", + "Foo"}}; llvm::StringRef context, basename; for (const auto &test : test_cases) { Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.h === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -187,7 +187,7 @@ const llvm::pdb::PDBSymbolCompiland &pdb_compiland, llvm::DenseMap &index_map) const; - void FindTypesByName(const std::string &name, + void FindTypesByName(llvm::StringRef name, const lldb_private::CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, lldb_private::TypeMap &types); Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -9,6 +9,9 @@ #include "SymbolFilePDB.h" +#include "PDBASTParser.h" +#include "PDBLocationToDWARFExpression.h" + #include "clang/Lex/Lexer.h" #include "lldb/Core/Module.h" @@ -46,9 +49,8 @@ #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" // For IsCPPMangledName +#include "Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h" #include "Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h" -#include "Plugins/SymbolFile/PDB/PDBASTParser.h" -#include "Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h" #include @@ -1063,7 +1065,7 @@ lldbassert(sc.module_sp.get()); if (!name.GetStringRef().equals( -PDBASTParser::PDBNameDropScope(pdb_data->getName( +MSVCUndecoratedNameParser::DropScope(pdb_data->getName( continue; sc.comp_unit = ParseCompileUnitForUID(GetCompilandId(*pdb_data)).get(); @@ -1170,22 +1172,11 @@ // Class. We won't bother to check if the parent is UDT or Enum here. m_func_method_names.Append(ConstString(name), uid); -ConstString cstr_name(name); - // To search a method name, like NS::Class:MemberFunc, LLDB searches // its base name, i.e. MemberFunc by default. Since PDBSymbolFunc does // not have inforamtion of this, we extract base names and cache them // by our own effort. -llvm::StringRef basename; -CPlusPlusLanguage::MethodName cpp_method(cstr_name); -if (cpp_method.IsValid()) { - llvm::StringRef context; - basename = cpp_method.GetBasename(); - if (basename.empty()) -CPlusPlusLanguage::ExtractContextAndIdentifier(name.c_str(), - context, basename); -} - +llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name); if (!basename.empty()) m_func_base_names.Append(ConstString(basename), uid); else { @@ -1198,11 +1189,12 @@ } else { // Handle not-method symbols. -// The function name might contain namespace, or its lexical scope. It -// is not safe to get its base name by applying same scheme as we deal -// with the method names. -// FIXME: Remove namespace if function is static in a scope. -m_func_base_names.Append(ConstString(name), uid); +// The function name might contain namespace, or its lexical scope. +llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name); +if (!basename.empty()) + m_func_base_names.Append(ConstString(basename), uid); +else + m_func_base_names.A
[Lldb-commits] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
aleksandr.urakov added a comment. Ping! Can you look at this, please? https://reviews.llvm.org/D53368 ___ 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.
grimar updated this revision to Diff 172121. grimar added a comment. - Addressed review comments. 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 @@ -248,6 +248,7 @@ m_value.value.uval = data.GetU64(offset_ptr); break; case DW_FORM_addrx: +case DW_FORM_rnglistx: case DW_FORM_strx: case DW_FORM_udata: case DW_FORM_ref_udata: @@ -393,6 +394,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: @@ -777,6 +779,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) const = 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) const 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) const 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) const { + 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 not yet supported: - // DW_RLE_base_addressx, DW_RLE_startx_endx, DW_RLE_startx_length. lldbassert(0 && "unknown range li
[Lldb-commits] [PATCH] D53929: [LLDB] - Add support for DW_FORM_rnglistx and relative DW_RLE_* entries.
grimar added inline comments. 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 clayborg wrote: > 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. Doing everything inside `DWARFFormValue::ExtractValue` would make the callers code simpler indeed, but my concern is that it would mean that instead of the attribute value requested it would return the offset value read from `.debug_rnglists` section. I am not sure it is good idea to read any debug section content at that low level. I think 'ExtractValue` ideally should not know about the debug sections. And also that would not be consistent with the other forms it reads. I am not sure if we might want to know the raw value of the `DW_FORM_rnglistx` one day, but with such change, we will lose such possibility. I would suggest making a helper function instead, so all the callers can use it. I did it in this patch, what do you think? 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] [lldb] r345843 - [FileSystem] Remove GetPermissions() and Readable() from FileSpec
Author: jdevlieghere Date: Thu Nov 1 08:47:33 2018 New Revision: 345843 URL: http://llvm.org/viewvc/llvm-project?rev=345843&view=rev Log: [FileSystem] Remove GetPermissions() and Readable() from FileSpec This patch removes the GetPermissions and GetReadable methods from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53831 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.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=345843&r1=345842&r2=345843&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 08:47:33 2018 @@ -281,15 +281,6 @@ public: bool Exists() const; //-- - /// Check if a file is readable by the current user - /// - /// @return - /// \b true if the file exists on disk and is readable, \b false - /// otherwise. - //-- - bool Readable() const; - - //-- /// Expanded existence test. /// /// Call into the Host to see if it can help find the file (e.g. by @@ -451,19 +442,6 @@ public: ConstString GetFileNameStrippingExtension() const; //-- - /// Return the current permissions of the path. - /// - /// Returns a bitmask for the current permissions of the file ( zero or more - /// of the permission bits defined in File::Permissions). - /// - /// @return - /// Zero if the file doesn't exist or we are unable to get - /// information for the file, otherwise one or more permission - /// bits from the File::Permissions enumeration. - //-- - uint32_t GetPermissions() const; - - //-- /// Get the memory cost of this object. /// /// Return the size in bytes that this object takes in memory. This returns Modified: lldb/trunk/source/API/SBPlatform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBPlatform.cpp?rev=345843&r1=345842&r2=345843&view=diff == --- lldb/trunk/source/API/SBPlatform.cpp (original) +++ lldb/trunk/source/API/SBPlatform.cpp Thu Nov 1 08:47:33 2018 @@ -364,7 +364,7 @@ SBError SBPlatform::Get(SBFileSpec &src, SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) { return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) { if (src.Exists()) { - uint32_t permissions = src.ref().GetPermissions(); + uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref()); if (permissions == 0) { if (llvm::sys::fs::is_directory(src.ref().GetPath())) permissions = eFilePermissionsDirectoryDefault; Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=345843&r1=345842&r2=345843&view=diff == --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Nov 1 08:47:33 2018 @@ -280,7 +280,7 @@ protected: result.SetStatus(eReturnStatusFailed); return false; } - if (!core_file.Readable()) { + if (!FileSystem::Instance().Readable(core_file)) { result.AppendErrorWithFormat("core file '%s' is not readable", core_file.GetPath().c_str()); result.SetStatus(eReturnStatusFailed); @@ -292,7 +292,7 @@ protected: FileSpec symfile(m_symbol_file.GetOptionValue().GetCurrentValue()); if (symfile) { if (symfile.Exists()) { - if (!symfile.Readable()) { + if (!FileS
[Lldb-commits] [PATCH] D53831: [FileSystem] Remove GetPermissions() and Readable() from FileSpec
This revision was automatically updated to reflect the committed changes. Closed by commit rL345843: [FileSystem] Remove GetPermissions() and Readable() from FileSpec (authored by JDevlieghere, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D53831?vs=171563&id=172137#toc Repository: rL LLVM https://reviews.llvm.org/D53831 Files: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Utility/FileSpec.cpp Index: lldb/trunk/source/API/SBPlatform.cpp === --- lldb/trunk/source/API/SBPlatform.cpp +++ lldb/trunk/source/API/SBPlatform.cpp @@ -364,7 +364,7 @@ SBError SBPlatform::Put(SBFileSpec &src, SBFileSpec &dst) { return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) { if (src.Exists()) { - uint32_t permissions = src.ref().GetPermissions(); + uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref()); if (permissions == 0) { if (llvm::sys::fs::is_directory(src.ref().GetPath())) permissions = eFilePermissionsDirectoryDefault; Index: lldb/trunk/source/Target/Platform.cpp === --- lldb/trunk/source/Target/Platform.cpp +++ lldb/trunk/source/Target/Platform.cpp @@ -709,7 +709,7 @@ switch (fs::get_file_type(src.GetPath(), false)) { case fs::file_type::directory_file: { llvm::sys::fs::remove(fixed_dst.GetPath()); - uint32_t permissions = src.GetPermissions(); + uint32_t permissions = FileSystem::Instance().GetPermissions(src); if (permissions == 0) permissions = eFilePermissionsDirectoryDefault; error = MakeDirectory(fixed_dst, permissions); Index: lldb/trunk/source/Utility/FileSpec.cpp === --- lldb/trunk/source/Utility/FileSpec.cpp +++ lldb/trunk/source/Utility/FileSpec.cpp @@ -458,10 +458,6 @@ //-- bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); } -bool FileSpec::Readable() const { - return GetPermissions() & llvm::sys::fs::perms::all_read; -} - bool FileSpec::ResolveExecutableLocation() { // CLEANUP: Use StringRef for string handling. if (!m_directory) { @@ -509,15 +505,6 @@ FileSpec::Style FileSpec::GetPathStyle() const { return m_style; } -uint32_t FileSpec::GetPermissions() const { - namespace fs = llvm::sys::fs; - fs::file_status st; - if (fs::status(GetPath(), st, false)) -return fs::perms::perms_not_known; - - return st.permissions(); -} - //-- // Directory string get accessor. //-- Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp === --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2536,7 +2536,7 @@ return false; } - if (!file.Readable()) { + if (!FileSystem::Instance().Readable(file)) { strm.Printf("Error: File %s does not have readable permissions", path); strm.EOL(); return false; Index: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp === --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -143,8 +143,8 @@ if (resolved_module_spec.GetFileSpec().Exists()) error.Clear(); else { - const uint32_t permissions = - resolved_module_spec.GetFileSpec().GetPermissions(); + const uint32_t permissions = FileSystem::Instance().GetPermissions( + resolved_module_spec.GetFileSpec()); if (permissions && (permissions & eFilePermissionsEveryoneR) == 0) error.SetErrorStringWithFormat( "executable '%s' is not readable", @@ -237,7 +237,8 @@ } if (er
[Lldb-commits] [PATCH] D53834: [FileSystem] Remove ResolveExecutableLocation() from FileSpec
JDevlieghere updated this revision to Diff 172142. https://reviews.llvm.org/D53834 Files: include/lldb/Host/FileSystem.h include/lldb/Utility/FileSpec.h source/API/SBFileSpec.cpp source/Host/common/FileSystem.cpp source/Host/common/MonitoringProcessLauncher.cpp source/Host/macosx/objcxx/Host.mm source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Plugins/Platform/Windows/PlatformWindows.cpp source/Target/ProcessLaunchInfo.cpp source/Utility/FileSpec.cpp Index: source/Utility/FileSpec.cpp === --- source/Utility/FileSpec.cpp +++ source/Utility/FileSpec.cpp @@ -458,42 +458,6 @@ //-- bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); } -bool FileSpec::ResolveExecutableLocation() { - // CLEANUP: Use StringRef for string handling. - if (!m_directory) { -const char *file_cstr = m_filename.GetCString(); -if (file_cstr) { - const std::string file_str(file_cstr); - llvm::ErrorOr error_or_path = - llvm::sys::findProgramByName(file_str); - if (!error_or_path) -return false; - std::string path = error_or_path.get(); - llvm::StringRef dir_ref = llvm::sys::path::parent_path(path); - if (!dir_ref.empty()) { -// FindProgramByName returns "." if it can't find the file. -if (strcmp(".", dir_ref.data()) == 0) - return false; - -m_directory.SetCString(dir_ref.data()); -if (Exists()) - return true; -else { - // If FindProgramByName found the file, it returns the directory + - // filename in its return results. We need to separate them. - FileSpec tmp_file(dir_ref.data(), false); - if (tmp_file.Exists()) { -m_directory = tmp_file.m_directory; -return true; - } -} - } -} - } - - return false; -} - bool FileSpec::ResolvePath() { if (m_is_resolved) return true; // We have already resolved this path Index: source/Target/ProcessLaunchInfo.cpp === --- source/Target/ProcessLaunchInfo.cpp +++ source/Target/ProcessLaunchInfo.cpp @@ -151,7 +151,7 @@ void ProcessLaunchInfo::SetShell(const FileSpec &shell) { m_shell = shell; if (m_shell) { -m_shell.ResolveExecutableLocation(); +FileSystem::Instance().ResolveExecutableLocation(m_shell); m_flags.Set(lldb::eLaunchFlagLaunchInShell); } else m_flags.Clear(lldb::eLaunchFlagLaunchInShell); Index: source/Plugins/Platform/Windows/PlatformWindows.cpp === --- source/Plugins/Platform/Windows/PlatformWindows.cpp +++ source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -199,7 +199,8 @@ } if (!resolved_module_spec.GetFileSpec().Exists()) - resolved_module_spec.GetFileSpec().ResolveExecutableLocation(); + FileSystem::Instance().ResolveExecutableLocation( + resolved_module_spec.GetFileSpec()); if (resolved_module_spec.GetFileSpec().Exists()) error.Clear(); Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp === --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -135,7 +135,8 @@ } if (!resolved_module_spec.GetFileSpec().Exists()) - resolved_module_spec.GetFileSpec().ResolveExecutableLocation(); + FileSystem::Instance().ResolveExecutableLocation( + resolved_module_spec.GetFileSpec()); // Resolve any executable within a bundle on MacOSX Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); Index: source/Host/macosx/objcxx/Host.mm === --- source/Host/macosx/objcxx/Host.mm +++ source/Host/macosx/objcxx/Host.mm @@ -55,10 +55,11 @@ #include #include "lldb/Host/ConnectionFileDescriptor.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/ThreadLauncher.h" -#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/Process.h" +#include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/CleanUp.h" #include "lldb/Utility/DataBufferHeap.h" @@ -1282,7 +1283,7 @@ status(exe_spec.GetPath(), stats); } if (!exists(stats)) { -exe_spec.ResolveExecutableLocation(); +FileSystem::Instance().ResolveExecutableLocation(exe_spec); status(exe_spec.GetPath(), stats); } if (!exists(stats)) { Index: source/Host/common/MonitoringProcessLauncher.cpp === --- source/Host/common/MonitoringProcessLauncher.cpp +++ source/Host/common/MonitoringProcessLauncher.cpp @@ -8,6 +8,7 @@ //===
[Lldb-commits] [PATCH] D53834: [FileSystem] Remove ResolveExecutableLocation() from FileSpec
JDevlieghere added a comment. In https://reviews.llvm.org/D53834#1281822, @labath wrote: > 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. Yep you're right, this wasn't clear from the doxygen but I should've checked the llvm implementation. 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] D53834: [FileSystem] Remove ResolveExecutableLocation() from FileSpec
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. LGTM, thanks. 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] [lldb] r345848 - [NativePDB] Get LLDB types from PDB function types.
Author: zturner Date: Thu Nov 1 09:37:29 2018 New Revision: 345848 URL: http://llvm.org/viewvc/llvm-project?rev=345848&view=rev Log: [NativePDB] Get LLDB types from PDB function types. 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. Differential Revision: https://reviews.llvm.org/D53951 Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp lldb/trunk/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit?rev=345848&view=auto == --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit (added) +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit Thu Nov 1 09:37:29 2018 @@ -0,0 +1,70 @@ +command alias dv target variable + +dv aa +dv ab +dv ac +dv ad +dv ae +dv af +dv ag +dv ah +dv ai +dv aj +dv ak +dv al +dv am +dv an +dv ao +dv aq +dv ar +dv as +dv at +dv au +dv av +dv aw +dv ax +dv ay +dv az +dv aaa +dv aab +dv aac +dv aad +dv ra +dv rb +dv rc +dv rd +dv re +dv rf +dv rg +dv rh +dv ri +dv rj +dv rk +dv rl +dv rm +dv rn +dv ro +dv rq +dv rr +dv rs +dv rt +dv ru +dv rv +dv rw +dv rx +dv ry +dv rz +dv raa +dv rab +dv rac +dv rad +dv ref +dv ref2 +dv ref3 +dv binp +dv binr +dv null +dv rae +dv aae + +quit Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit?rev=345848&view=auto == --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit (added) +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit Thu Nov 1 09:37:29 2018 @@ -0,0 +1,7 @@ +target variable sfn +target variable ffn +target variable tfn +target variable cfn +target variable vfn + +quit Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit?rev=345848&view=auto == --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit (added) +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit Thu Nov 1 09:37:29 2018 @@ -0,0 +1,12 @@ +target variable a +target variable b +target variable c +target variable d +target variable e +target variable f +target variable g +target variable h +target variable i +target variable incomplete + +quit Added: lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp?rev=345848&view=auto == --- lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp (added) +++ lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp Thu Nov 1 09:37:29 2018 @@ -0,0 +1,215 @@ +// clang-format off +// REQUIRES: lld + +// RUN: clang-cl /Z7 /GS- /GR- /c -Xclang -fkeep-static-consts /Fo%t.obj -- %s +// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \ +// RUN: %p/Inputs/function-types-builtins.lldbinit | FileCheck %s + +// Test that we can display function signatures with simple builtin +// and pointer types. We do this by using `target variable` in lldb +// with global variables of type ptr-to-function or reference-to-function. +// This technique in general allows us to exercise most of LLDB's type +// system without a running process. + +template +struct MakeResult { + static T result() { +return T{}; + } +}; + +template +struct MakeResult { + static T& result(
[Lldb-commits] [PATCH] D53951: [NativePDB] Get LLDB types from PDB function types
This revision was automatically updated to reflect the committed changes. Closed by commit rL345848: [NativePDB] Get LLDB types from PDB function types. (authored by zturner, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D53951?vs=172023&id=172151#toc Repository: rL LLVM https://reviews.llvm.org/D53951 Files: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-builtins.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-calling-conv.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/function-types-builtins.cpp lldb/trunk/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h Index: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp === --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/trunk/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; @@ -639,6 +674,17 @@ } lldb::TypeSP SymbolFileNativePDB::CreateSimpleType(TypeIndex ti) { + if (ti == TypeIndex::NullptrT()) { +PdbSymUid uid = +PdbSymUid::makeTypeSymId(PDB_SymType::BuiltinType, ti, false); +CompilerType ct = m_clang->GetBasicType(eBasicTypeNullPtr); +Declaration decl; +return std::make_shared(uid.toOpaqueId(), this, + ConstString("std::nullptr_t"), 0, nullptr, + LLDB_INVALID_UID, Type::eEncodingIsUID, decl, + ct, Type::eResolveStateFull); + } + if (ti.getSimpleMode() != SimpleTypeMode::Direct) { PdbSymUid uid = PdbSymUid::makeTypeSymId(PDB_SymType::PointerType, ti, false); @@ -670,7 +716,8 @@ return nullptr; lldb::BasicType bt = GetCompilerTypeForSimpleKind(ti.getSimpleKind()); - lldbassert(bt != lldb::eBasicTypeInvalid); + if (bt == lldb::eBasicTypeInvalid) +return nullptr; CompilerType ct = m_clang->GetBasicType(bt); size_t size = GetTypeSizeForSimpleKind(ti.getSimpleKind()); @@ -687,10 +734,6 @@ PdbSymUid type_uid, llvm::StringRef name, size_t size, clang::TagTypeKind ttk, clang::MSInheritanceAttr::Spelling inheritance) { - // Some UDT with trival ctor has zero length. Just ignore. - if (size == 0) -return nullptr; - // Ignore unnamed-tag UDTs. name = DropNameScope(name); if (name.empty()) @@ -792,6 +8
[Lldb-commits] [lldb] r345849 - [FileSystem] Improve assert and add Terminate in unit test.
Author: jdevlieghere Date: Thu Nov 1 09:43:34 2018 New Revision: 345849 URL: http://llvm.org/viewvc/llvm-project?rev=345849&view=rev Log: [FileSystem] Improve assert and add Terminate in unit test. Speculative fix for the Xcode bots where we were seeing the assertion being triggered because we would re-initialize the FileSystem without terminating it. Modified: lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345849&r1=345848&r2=345849&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 1 09:43:34 2018 @@ -9,6 +9,7 @@ #include "lldb/Host/FileSystem.h" +#include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/TildeExpressionResolver.h" #include "llvm/Support/FileSystem.h" @@ -25,17 +26,17 @@ using namespace llvm; FileSystem &FileSystem::Instance() { return *InstanceImpl(); } void FileSystem::Initialize() { - assert(!InstanceImpl()); + lldbassert(!InstanceImpl() && "Already initialized."); InstanceImpl().emplace(); } void FileSystem::Initialize(IntrusiveRefCntPtr fs) { - assert(!InstanceImpl()); + lldbassert(!InstanceImpl() && "Already initialized."); InstanceImpl().emplace(fs); } void FileSystem::Terminate() { - assert(InstanceImpl()); + lldbassert(InstanceImpl() && "Already terminated."); InstanceImpl().reset(); } Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=345849&r1=345848&r2=345849&view=diff == --- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original) +++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Thu Nov 1 09:43:34 2018 @@ -38,4 +38,6 @@ void PythonTestSuite::TearDown() { PyGILState_Release(m_gil_state); ScriptInterpreterPython::Terminate(); + HostInfoBase::Terminate(); + FileSystem::Terminate(); } ___ 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.
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Solution is fine. As long as we don't have to duplicate the work everywhere that needs a ranges offset. 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] [lldb] r345853 - [FileSystem] Remove ResolveExecutableLocation() from FileSpec
Author: jdevlieghere Date: Thu Nov 1 10:09:22 2018 New Revision: 345853 URL: http://llvm.org/viewvc/llvm-project?rev=345853&view=rev Log: [FileSystem] Remove ResolveExecutableLocation() from FileSpec This patch removes the ResolveExecutableLocation method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53834 Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/MonitoringProcessLauncher.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Target/ProcessLaunchInfo.cpp lldb/trunk/source/Utility/FileSpec.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov 1 10:09:22 2018 @@ -92,6 +92,9 @@ public: void Resolve(FileSpec &file_spec); /// @} + /// Call into the Host to see if it can help find the file. + bool ResolveExecutableLocation(FileSpec &file_spec); + enum EnumerateDirectoryResult { /// Enumerate next entry in the current directory. eEnumerateDirectoryResultNext, Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 10:09:22 2018 @@ -281,21 +281,6 @@ public: bool Exists() const; //-- - /// Expanded existence test. - /// - /// Call into the Host to see if it can help find the file (e.g. by - /// searching paths set in the environment, etc.). - /// - /// If found, sets the value of m_directory to the directory where the file - /// was found. - /// - /// @return - /// \b true if was able to find the file using expanded search - /// methods, \b false otherwise. - //-- - bool ResolveExecutableLocation(); - - //-- /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve /// the file path when you set the file. Modified: lldb/trunk/source/API/SBFileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/source/API/SBFileSpec.cpp (original) +++ lldb/trunk/source/API/SBFileSpec.cpp Thu Nov 1 10:09:22 2018 @@ -12,6 +12,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBStream.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" @@ -61,7 +62,7 @@ bool SBFileSpec::Exists() const { } bool SBFileSpec::ResolveExecutableLocation() { - return m_opaque_ap->ResolveExecutableLocation(); + return FileSystem::Instance().ResolveExecutableLocation(*m_opaque_ap); } int SBFileSpec::ResolvePath(const char *src_path, char *dst_path, Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345853&r1=345852&r2=345853&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 1 10:09:22 2018 @@ -13,6 +13,8 @@ #include "lldb/Utility/TildeExpressionResolver.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Program.h" #include "llvm/Support/Threading.h" #include @@ -178,3 +180,36 @@ void FileSystem::Resolve(FileSpec &file_ // Update the FileSpec with the resolved path. file_spec.SetPath(path); } + +bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) { + // If the directory is set there's nothing to do. + const ConstString &directory = file_spec.GetDirectory(); + if (directory) +return false; + + // We cannot look for a file if there's no file name. + const ConstString &filename = file_spec.GetFilename(); + if (!filename) +return false; + + // Search for the file on the host. + const std::string fil
[Lldb-commits] [PATCH] D53834: [FileSystem] Remove ResolveExecutableLocation() from FileSpec
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB345853: [FileSystem] Remove ResolveExecutableLocation() from FileSpec (authored by JDevlieghere, committed by ). Changed prior to commit: https://reviews.llvm.org/D53834?vs=172142&id=172157#toc Repository: rLLDB LLDB https://reviews.llvm.org/D53834 Files: include/lldb/Host/FileSystem.h include/lldb/Utility/FileSpec.h source/API/SBFileSpec.cpp source/Host/common/FileSystem.cpp source/Host/common/MonitoringProcessLauncher.cpp source/Host/macosx/objcxx/Host.mm source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Plugins/Platform/Windows/PlatformWindows.cpp source/Target/ProcessLaunchInfo.cpp source/Utility/FileSpec.cpp Index: include/lldb/Utility/FileSpec.h === --- include/lldb/Utility/FileSpec.h +++ include/lldb/Utility/FileSpec.h @@ -281,21 +281,6 @@ bool Exists() const; //-- - /// Expanded existence test. - /// - /// Call into the Host to see if it can help find the file (e.g. by - /// searching paths set in the environment, etc.). - /// - /// If found, sets the value of m_directory to the directory where the file - /// was found. - /// - /// @return - /// \b true if was able to find the file using expanded search - /// methods, \b false otherwise. - //-- - bool ResolveExecutableLocation(); - - //-- /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve /// the file path when you set the file. Index: include/lldb/Host/FileSystem.h === --- include/lldb/Host/FileSystem.h +++ include/lldb/Host/FileSystem.h @@ -92,6 +92,9 @@ void Resolve(FileSpec &file_spec); /// @} + /// Call into the Host to see if it can help find the file. + bool ResolveExecutableLocation(FileSpec &file_spec); + enum EnumerateDirectoryResult { /// Enumerate next entry in the current directory. eEnumerateDirectoryResultNext, Index: source/API/SBFileSpec.cpp === --- source/API/SBFileSpec.cpp +++ source/API/SBFileSpec.cpp @@ -12,6 +12,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBStream.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Log.h" @@ -61,7 +62,7 @@ } bool SBFileSpec::ResolveExecutableLocation() { - return m_opaque_ap->ResolveExecutableLocation(); + return FileSystem::Instance().ResolveExecutableLocation(*m_opaque_ap); } int SBFileSpec::ResolvePath(const char *src_path, char *dst_path, Index: source/Target/ProcessLaunchInfo.cpp === --- source/Target/ProcessLaunchInfo.cpp +++ source/Target/ProcessLaunchInfo.cpp @@ -151,7 +151,7 @@ void ProcessLaunchInfo::SetShell(const FileSpec &shell) { m_shell = shell; if (m_shell) { -m_shell.ResolveExecutableLocation(); +FileSystem::Instance().ResolveExecutableLocation(m_shell); m_flags.Set(lldb::eLaunchFlagLaunchInShell); } else m_flags.Clear(lldb::eLaunchFlagLaunchInShell); Index: source/Utility/FileSpec.cpp === --- source/Utility/FileSpec.cpp +++ source/Utility/FileSpec.cpp @@ -458,42 +458,6 @@ //-- bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); } -bool FileSpec::ResolveExecutableLocation() { - // CLEANUP: Use StringRef for string handling. - if (!m_directory) { -const char *file_cstr = m_filename.GetCString(); -if (file_cstr) { - const std::string file_str(file_cstr); - llvm::ErrorOr error_or_path = - llvm::sys::findProgramByName(file_str); - if (!error_or_path) -return false; - std::string path = error_or_path.get(); - llvm::StringRef dir_ref = llvm::sys::path::parent_path(path); - if (!dir_ref.empty()) { -// FindProgramByName returns "." if it can't find the file. -if (strcmp(".", dir_ref.data()) == 0) - return false; - -m_directory.SetCString(dir_ref.data()); -if (Exists()) - return true; -else { - // If FindProgramByName found the file, it returns the directory + - // filename in its return results. We need to separate them. - FileSpec tmp_file(dir_ref.data(), false); - if (tmp_file.Exists()) { -m_directory = tmp_file.m_directory; -return true; - } -} - } -} - } - - return false; -} - bool File
[Lldb-commits] [lldb] r345854 - [FileSystem] Remove Exists() from FileSpec
Author: jdevlieghere Date: Thu Nov 1 10:09:25 2018 New Revision: 345854 URL: http://llvm.org/viewvc/llvm-project?rev=345854&view=rev Log: [FileSystem] Remove Exists() from FileSpec This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 Modified: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/DynamicLoader.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/PluginManager.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.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/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/PathMappingList.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/source/Utility/StructuredData.cpp lldb/trunk/unittests/Target/ModuleCacheTest.cpp Modified: lldb/trunk/include/lldb/Utility/FileSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/FileSpec.h?rev=345854&r1=345853&r2=345854&view=diff == --- lldb/trunk/include/lldb/Utility/FileSpec.h (original) +++ lldb/trunk/include/lldb/Utility/FileSpec.h Thu Nov 1 10:09:25 2018 @@ -273,14 +273,6 @@ public: void Dump(Stream *s) const; //-- - /// Existence test. - /// - /// @return - /// \b true if the file exists on disk, \b false otherwise. - //-- - bool Exists() const; - - //-- /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve /// the file path when you set the file. Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=345854&r1=345853&r2=345854&view=diff == --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Thu Nov 1 10:09:25 2018 @@ -90,7 +90,7 @@ static llvm::sys::DynamicLibrary LoadPlu "lldb::PluginInitialize(lldb::SBDebugger)"); } } else
[Lldb-commits] [PATCH] D53845: [FileSystem] Remove Exists() from FileSpec
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB345854: [FileSystem] Remove Exists() from FileSpec (authored by JDevlieghere, committed by ). Changed prior to commit: https://reviews.llvm.org/D53845?vs=171599&id=172158#toc Repository: rLLDB LLDB https://reviews.llvm.org/D53845 Files: include/lldb/Utility/FileSpec.h source/API/SBDebugger.cpp source/API/SBFileSpec.cpp source/Commands/CommandObjectMemory.cpp source/Commands/CommandObjectPlatform.cpp source/Commands/CommandObjectTarget.cpp source/Core/Debugger.cpp source/Core/DynamicLoader.cpp source/Core/Module.cpp source/Core/ModuleList.cpp source/Core/PluginManager.cpp source/Core/SourceManager.cpp source/Host/common/HostInfoBase.cpp source/Host/common/Symbols.cpp source/Host/macosx/Symbols.cpp source/Host/macosx/objcxx/Host.mm source/Interpreter/CommandInterpreter.cpp source/Interpreter/OptionValuePathMappings.cpp source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp source/Plugins/Platform/MacOSX/PlatformDarwin.cpp source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Plugins/Platform/Windows/PlatformWindows.cpp source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp source/Plugins/Process/elf-core/ProcessElfCore.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/Process/mach-core/ProcessMachCore.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp source/Symbol/ObjectFile.cpp source/Target/ModuleCache.cpp source/Target/PathMappingList.cpp source/Target/Platform.cpp source/Target/Process.cpp source/Target/TargetList.cpp source/Utility/FileSpec.cpp source/Utility/StructuredData.cpp unittests/Target/ModuleCacheTest.cpp Index: unittests/Target/ModuleCacheTest.cpp === --- unittests/Target/ModuleCacheTest.cpp +++ unittests/Target/ModuleCacheTest.cpp @@ -82,12 +82,13 @@ 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_TRUE(FileSystem::Instance().Exists(uuid_view)) + << "uuid_view is: " << uuid_view.GetCString(); 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_TRUE(FileSystem::Instance().Exists(sysroot_view)) + << "sysroot_view is: " << sysroot_view.GetCString(); EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(sysroot_view)); } Index: source/Host/macosx/objcxx/Host.mm === --- source/Host/macosx/objcxx/Host.mm +++ source/Host/macosx/objcxx/Host.mm @@ -226,7 +226,7 @@ darwin_debug_file_spec.GetFilename().SetCString("darwin-debug"); - if (!darwin_debug_file_spec.Exists()) { + if (!FileSystem::Instance().Exists(darwin_debug_file_spec)) { error.SetErrorStringWithFormat( "the 'darwin-debug' executable doesn't exists at '%s'", darwin_debug_file_spec.GetPath().c_str()); @@ -1338,7 +1338,7 @@ return error; } expand_tool_spec.AppendPathComponent("lldb-argdumper"); -if (!expand_tool_spec.Exists()) { +if (!FileSystem::Instance().Exists(expand_tool_spec)) { error.SetErrorStringWithFormat( "could not find the lldb-argdumper tool: %s", expand_tool_spec.GetPath().c_str()); @@ -1355,7 +1355,7 @@ int status; std::string output; FileSpec cwd(launch_info.GetWorkingDirectory()); -if (!cwd.Exists()) { +if (!FileSystem::Instance().Exists(cwd)) { char *wd = getcwd(nullptr, 0); if (wd == nullptr) { error.SetErrorStringWithFo
[Lldb-commits] [PATCH] D53845: [FileSystem] Remove Exists() from FileSpec
This revision was automatically updated to reflect the committed changes. Closed by commit rL345854: [FileSystem] Remove Exists() from FileSpec (authored by JDevlieghere, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D53845?vs=171599&id=172159#toc Repository: rL LLVM https://reviews.llvm.org/D53845 Files: lldb/trunk/include/lldb/Utility/FileSpec.h lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBFileSpec.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectPlatform.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/DynamicLoader.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/PluginManager.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/HostInfoBase.cpp lldb/trunk/source/Host/common/Symbols.cpp lldb/trunk/source/Host/macosx/Symbols.cpp lldb/trunk/source/Host/macosx/objcxx/Host.mm lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.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/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Target/ModuleCache.cpp lldb/trunk/source/Target/PathMappingList.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/TargetList.cpp lldb/trunk/source/Utility/FileSpec.cpp lldb/trunk/source/Utility/StructuredData.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 @@ -82,12 +82,13 @@ 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_TRUE(FileSystem::Instance().Exists(uuid_view)) + << "uuid_view is: " << uuid_view.GetCString(); 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_TRUE(FileSystem::Instance().Exists(sysroot_view)) + << "sysroot_view is: " << sysroot_view.GetCString(); EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(sysroot_view)); } Index: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp === --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -90,7 +90,7 @@ return true; // For now we are just making sure the file exists for a given module - if (!m_core_module_sp && m_core_file.Exists()) { + if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) { // Don't add the Target's a
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
clayborg added a comment. The only other thing you would need to change to get the usability back in check when doing things in GetNumChildren() would be to have the function that gets the typename take on optional execution context for dynamic types. The ValueObject can easily pass its execution context when getting the typename. Anyone who doesn't would continue to get the "int []" as the typename which isn't really lying either way. Thoughts? 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] [PATCH] D53368: [Symbol] Search symbols with name and type in a symbol file
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. Thanks for making the changes. https://reviews.llvm.org/D53368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345857 - [FileSystem] Fix Exists call sites
Author: jdevlieghere Date: Thu Nov 1 10:35:31 2018 New Revision: 345857 URL: http://llvm.org/viewvc/llvm-project?rev=345857&view=rev Log: [FileSystem] Fix Exists call sites There were some calls left to Exists() on non-darwin platforms (Windows, Linux and FreeBSD) that weren't yet updated to use the FileSystem. Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp lldb/trunk/source/Host/linux/HostInfoLinux.cpp lldb/trunk/source/Host/windows/Host.cpp lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original) +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov 1 10:35:31 2018 @@ -8,6 +8,7 @@ //===--===// #include "lldb/Host/android/HostInfoAndroid.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/linux/HostInfoLinux.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -68,7 +69,7 @@ FileSpec HostInfoAndroid::ResolveLibrary FileSpec file_candidate(path.str().c_str(), true); file_candidate.AppendPathComponent(module_path.c_str()); -if (file_candidate.Exists()) +if (FileSystem::Instance().Exists(file_candidate)) return file_candidate; } @@ -83,8 +84,8 @@ bool HostInfoAndroid::ComputeTempFileBas // algorithm will deduce /tmp, which is plain wrong. In that case we have an // invalid directory, we substitute the path with /data/local/tmp, which is // correct at least in some cases (i.e., when running as shell user). - if (!success || !file_spec.Exists()) + if (!success || !FileSystem::Instance().Exists(file_spec)) file_spec = FileSpec("/data/local/tmp", false); - return file_spec.Exists(); + return FileSystem::Instance().Exists(file_spec); } Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original) +++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Thu Nov 1 10:35:31 2018 @@ -7,8 +7,9 @@ // //===--===// -#include "lldb/Host/Config.h" #include "lldb/Host/linux/HostInfoLinux.h" +#include "lldb/Host/Config.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Utility/Log.h" #include "llvm/Support/Threading.h" @@ -179,7 +180,7 @@ FileSpec HostInfoLinux::GetProgramFileSp bool HostInfoLinux::ComputeSupportExeDirectory(FileSpec &file_spec) { if (HostInfoPosix::ComputeSupportExeDirectory(file_spec) && - file_spec.IsAbsolute() && file_spec.Exists()) + file_spec.IsAbsolute() && FileSystem::Instance().Exists(file_spec)) return true; file_spec.GetDirectory() = GetProgramFileSpec().GetDirectory(); return !file_spec.GetDirectory().IsEmpty(); Modified: lldb/trunk/source/Host/windows/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Host/windows/Host.cpp (original) +++ lldb/trunk/source/Host/windows/Host.cpp Thu Nov 1 10:35:31 2018 @@ -15,6 +15,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Target/Process.h" @@ -189,7 +190,7 @@ Status Host::ShellExpandArguments(Proces return error; } expand_tool_spec.AppendPathComponent("lldb-argdumper.exe"); -if (!expand_tool_spec.Exists()) { +if (!FileSystem::Instance().Exists(expand_tool_spec)) { error.SetErrorString("could not find the lldb-argdumper tool"); return error; } Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=345857&r1=345856&r2=345857&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu Nov 1 10:35:31 2018 @@ -24,6 +24,7 @@ // Other libraries and framework includes #include "lldb/Core/PluginManager.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Dyna
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
aprantl added a comment. To me a VLA fulfills all properties of a dynamic type so not modeling it as a dynamic type feels backwards to me. But not having to deal with temporary clang types might be worth the trade-off. > The only other thing you would need to change to get the usability back in > check when doing things in GetNumChildren() would be to have the function > that gets the typename take on optional execution context for dynamic types. > The ValueObject can easily pass its execution context when getting the > typename. Anyone who doesn't would continue to get the "int []" as the > typename which isn't really lying either way. Thoughts? I didn't realize that the string `int []` is produced by ValueObject itself; I think this makes this option more palatable to me. I'll give it a try. 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] r345860 - [FileSystem] Fix typo in ProcessFreeBSD
Author: jdevlieghere Date: Thu Nov 1 10:46:31 2018 New Revision: 345860 URL: http://llvm.org/viewvc/llvm-project?rev=345860&view=rev Log: [FileSystem] Fix typo in ProcessFreeBSD Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=345860&r1=345859&r2=345860&view=diff == --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu Nov 1 10:46:31 2018 @@ -288,7 +288,7 @@ bool ProcessFreeBSD::CanDebug(lldb::Targ // For now we are just making sure the file exists for a given module ModuleSP exe_module_sp(target_sp->GetExecutableModule()); if (exe_module_sp.get()) -return FileSystem::Instance()::Exists(exe_module_sp->GetFileSpec()); +return FileSystem::Instance().Exists(exe_module_sp->GetFileSpec()); // If there is no executable module, we return true since we might be // preparing to attach. return true; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
aprantl added a comment. > I didn't realize that the string int [] is produced by ValueObject itself; I > think this makes this option more palatable to me. I'll give it a try. So, it turns out it isn't. The only way to get the length into the typename is to hack ClangASTContext::GetTypeName to replace the training "[]" of what clang returns as the typename with a different string. The main problem with this is that this will only work for outermost types. Something that has been requested in the past is to support C structs with trailing array members, such as struct variable_size { unsigned length; int __attribute__((size=.length)) elements[]; // I just made up this attribute, but you get the basic idea. }; in a similar fashion. When printing such a struct, there's no way of safely injecting the size into array type string any more. If we dynamically created the correctly-sized array type instead, this would work just fine. I haven't yet understood the motivation behind why overriding GetNumChildren/GetTypeName/GetChildAtIndex is preferable over creating a dynamic type in the language runtime. Is there something that I need to know? 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] [PATCH] D53989: Fix formatting of wchar, char16, and char32
zturner created this revision. zturner added a reviewer: jingham. char16, char32, and wchar_t were previously broken. If you had a simple variable like `wchar_t x = L'1'` and wrote `p x` LLDB would output `(wchar_t) x = 1\0`. This is because it was using `eFormatChar` with a size of 2. What we needed was to introduce a special format specifically for `wchar_t`. The only valid sizes of `wchar_t` on all existing compilers are 2 and 4, so there's no real point trying to handle sizes of 1 and 8. Along the way, I accidentally stumbled across the reason that references that char16 and char32 types were also formatting incorrectly, so I fixed that as well. https://reviews.llvm.org/D53989 Files: lldb/include/lldb/lldb-enumerations.h lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp lldb/source/Commands/CommandObjectMemory.cpp lldb/source/Core/DumpDataExtractor.cpp lldb/source/Core/ValueObject.cpp lldb/source/DataFormatters/FormatManager.cpp lldb/source/DataFormatters/VectorType.cpp lldb/source/Symbol/ClangASTContext.cpp Index: lldb/source/Symbol/ClangASTContext.cpp === --- lldb/source/Symbol/ClangASTContext.cpp +++ lldb/source/Symbol/ClangASTContext.cpp @@ -5257,11 +5257,12 @@ return lldb::eFormatBoolean; case clang::BuiltinType::Char_S: case clang::BuiltinType::SChar: -case clang::BuiltinType::WChar_S: case clang::BuiltinType::Char_U: case clang::BuiltinType::UChar: -case clang::BuiltinType::WChar_U: return lldb::eFormatChar; +case clang::BuiltinType::WChar_S: +case clang::BuiltinType::WChar_U: + return lldb::eFormatWchar; case clang::BuiltinType::Char16: return lldb::eFormatUnicode16; case clang::BuiltinType::Char32: Index: lldb/source/DataFormatters/VectorType.cpp === --- lldb/source/DataFormatters/VectorType.cpp +++ lldb/source/DataFormatters/VectorType.cpp @@ -64,9 +64,12 @@ case lldb::eFormatHexFloat: return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloat); + case lldb::eFormatWchar: +return type_system->GetBasicTypeFromAST(lldb::eBasicTypeWChar); case lldb::eFormatUnicode16: +return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar16); case lldb::eFormatUnicode32: - +return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar32); case lldb::eFormatUnsigned: return type_system->GetBasicTypeFromAST(lldb::eBasicTypeUnsignedInt); Index: lldb/source/DataFormatters/FormatManager.cpp === --- lldb/source/DataFormatters/FormatManager.cpp +++ lldb/source/DataFormatters/FormatManager.cpp @@ -43,6 +43,7 @@ {eFormatBytesWithASCII, 'Y', "bytes with ASCII"}, {eFormatChar, 'c', "character"}, {eFormatCharPrintable, 'C', "printable character"}, +{eFormatWchar, 'L', "wide character"}, {eFormatComplexFloat, 'F', "complex float"}, {eFormatCString, 's', "c-string"}, {eFormatDecimal, 'd', "decimal"}, Index: lldb/source/Core/ValueObject.cpp === --- lldb/source/Core/ValueObject.cpp +++ lldb/source/Core/ValueObject.cpp @@ -1383,6 +1383,7 @@ (custom_format == eFormatOSType) || (custom_format == eFormatUnicode16) || (custom_format == eFormatUnicode32) || + (custom_format == eFormatWchar) || (custom_format == eFormatUnsigned) || (custom_format == eFormatPointer) || (custom_format == eFormatComplexInteger) || Index: lldb/source/Core/DumpDataExtractor.cpp === --- lldb/source/Core/DumpDataExtractor.cpp +++ lldb/source/Core/DumpDataExtractor.cpp @@ -637,6 +637,23 @@ } } break; +case eFormatWchar: { + s->PutChar('L'); + s->PutChar(item_count == 1 ? '\'' : '\"'); + + const uint64_t ch = DE.GetMaxU64(&offset, item_byte_size); + // wchar_t semantics vary across platforms, and this is complicated even + // more by the fact that the host may not be the same as the target, so to + // be faithful we would have to follow the target's semantics. For + // simplicity, just print the character if it's ascii. + if (ch <= CHAR_MAX && llvm::isPrint(ch)) +s->PutChar(ch); + else +s->PutChar(NON_PRINTABLE_CHAR); + + s->PutChar(item_count == 1 ? '\'' : '\"'); +} break; + case eFormatUnicode16: s->Printf("U+%4.4x", DE.GetU16(&offset)); break; Index: lldb/source/Commands/CommandObjectMemory.cpp === --- lldb/source/Commands/CommandObjectMemory.cpp +++ lldb/source/Commands/CommandObjectMemory.cpp @@ -167,6 +167,15 @@ format_options.GetCountValue() = 8; break; +case eFormatWchar: + if (!byte
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
jingham added a comment. There were a bunch of other tests testing wchar_t handling, all in: lang/cpp/wchar_t as well as some tests in: functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py Those tests weren't failed (except for the latter test, and that only for android/gmodules. Do you know why those tests were passing when the functionality was broken? Maybe they need fixing to be more accurate? https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
zturner added a comment. No, but thanks for the pointer. Interestingly, it worked for me on my home machine but not on my work machine, and I'm not sure what the difference between the two is. Clearly the test in lang/cpp/wchar_t is making it into `lldb_private::formatters::WCharSummaryProvider` whereas locally I am not. https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
zturner added a comment. Update: It's because There was a problem with my `PYTHONPATH` and python was getting disabled at CMake configure time. So I was effectively running with `LLDB_DISABLE_PYTHON`. So basically it's only broke on the `LLDB_DISABLE_PYTHON` codepath. https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345882 - Fix clang -Wimplicit-fallthrough warnings across llvm, NFC
Author: rnk Date: Thu Nov 1 12:54:45 2018 New Revision: 345882 URL: http://llvm.org/viewvc/llvm-project?rev=345882&view=rev Log: Fix clang -Wimplicit-fallthrough warnings across llvm, NFC This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp lldb/trunk/tools/lldb-test/lldb-test.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=345882&r1=345881&r2=345882&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Thu Nov 1 12:54:45 2018 @@ -288,6 +288,7 @@ GetClassOrFunctionParent(const llvm::pdb auto class_parent_id = raw.getClassParentId(); if (auto class_parent = session.getSymbolById(class_parent_id)) return class_parent; +break; } default: break; Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=345882&r1=345881&r2=345882&view=diff == --- lldb/trunk/tools/lldb-test/lldb-test.cpp (original) +++ lldb/trunk/tools/lldb-test/lldb-test.cpp Thu Nov 1 12:54:45 2018 @@ -285,7 +285,7 @@ std::string opts::breakpoint::substitute OS << sys::path::parent_path(breakpoint::CommandFile); break; } - // fall through + LLVM_FALLTHROUGH; default: size_t pos = Cmd.find('%'); OS << Cmd.substr(0, pos); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
jingham added a comment. So the deal is that we were relying on a summary formatter to print wchar_t before, and now you have a format option that handles them as well? Do we need both? Maybe the summary also handles wchar_t * strings? As an aside, for reasons that are not entirely clear to me most of the data formatter code is #ifndef LLDB_DISABLE_PYTHON. That shouldn't be true, C++ based formatters (which all the built-in formatters are) should be able to work in the absence of Python. Figuring out why this is true is on my list of things to investigate some spare afternoon... https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345891 - [FileSystem] Change FileSpec constructor signature.
Author: jdevlieghere Date: Thu Nov 1 14:18:25 2018 New Revision: 345891 URL: http://llvm.org/viewvc/llvm-project?rev=345891&view=rev Log: [FileSystem] Change FileSpec constructor signature. Fix breakage due to the recent FileSpec change that extracts the path resultion logic into FileSystem for the Android host. Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=345891&r1=345890&r2=345891&view=diff == --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original) +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov 1 14:18:25 2018 @@ -29,7 +29,7 @@ void HostInfoAndroid::ComputeHostArchite } FileSpec HostInfoAndroid::GetDefaultShell() { - return FileSpec("/system/bin/sh", false); + return FileSpec("/system/bin/sh"); } FileSpec HostInfoAndroid::ResolveLibraryPath(const std::string &module_path, @@ -66,7 +66,8 @@ FileSpec HostInfoAndroid::ResolveLibrary ld_paths.push_back(StringRef(*it)); for (const StringRef &path : ld_paths) { -FileSpec file_candidate(path.str().c_str(), true); +FileSpec file_candidate(path.str().c_str()); +FileSystem::Instance().Resolve(file_candidate); file_candidate.AppendPathComponent(module_path.c_str()); if (FileSystem::Instance().Exists(file_candidate)) @@ -85,7 +86,7 @@ bool HostInfoAndroid::ComputeTempFileBas // invalid directory, we substitute the path with /data/local/tmp, which is // correct at least in some cases (i.e., when running as shell user). if (!success || !FileSystem::Instance().Exists(file_spec)) -file_spec = FileSpec("/data/local/tmp", false); +file_spec = FileSpec("/data/local/tmp"); return FileSystem::Instance().Exists(file_spec); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345895 - [FileSystem] Change FileSpec constructor signature (2/2)
Author: jdevlieghere Date: Thu Nov 1 14:26:58 2018 New Revision: 345895 URL: http://llvm.org/viewvc/llvm-project?rev=345895&view=rev Log: [FileSystem] Change FileSpec constructor signature (2/2) Fix breakage due to the recent FileSpec change that extracts the path resultion logic into FileSystem for the FreeBSD host. Modified: lldb/trunk/source/Host/freebsd/Host.cpp Modified: lldb/trunk/source/Host/freebsd/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=345895&r1=345894&r2=345895&view=diff == --- lldb/trunk/source/Host/freebsd/Host.cpp (original) +++ lldb/trunk/source/Host/freebsd/Host.cpp Thu Nov 1 14:26:58 2018 @@ -75,11 +75,9 @@ GetFreeBSDProcessArgs(const ProcessInsta size_t pathname_len = sizeof(pathname); mib[2] = KERN_PROC_PATHNAME; if (::sysctl(mib, 4, pathname, &pathname_len, NULL, 0) == 0) -process_info.GetExecutableFile().SetFile(pathname, false, - FileSpec::Style::native); +process_info.GetExecutableFile().SetFile(pathname, FileSpec::Style::native); else -process_info.GetExecutableFile().SetFile(cstr, false, - FileSpec::Style::native); +process_info.GetExecutableFile().SetFile(cstr, FileSpec::Style::native); if (!(match_info_ptr == NULL || NameMatches(process_info.GetExecutableFile().GetFilename().GetCString(), ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
zturner added a comment. Side question, should we just kill the `LLDB_DISABLE_PYTHON=0` codepath? It can be a headache to get LLDB linking with Python (particularly on Windows), but it would be nice to be able to delete all the preprocessor stuff. https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter
shafik created this revision. shafik added reviewers: jingham, davide, teemperor. Herald added a subscriber: JDevlieghere. Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter. Both calling sites of the sites were incorrectly calculating the qualtype as the underlying type unconditionally irrespective of whether the enum was unscoped or scoped https://reviews.llvm.org/D54003 Files: include/lldb/Symbol/ClangASTContext.h packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp source/Plugins/SymbolFile/PDB/PDBASTParser.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -8848,43 +8848,53 @@ } clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType( -lldb::opaque_compiler_type_t type, -const CompilerType &enumerator_clang_type, const Declaration &decl, -const char *name, int64_t enum_value, uint32_t enum_value_bit_size) { - if (type && enumerator_clang_type.IsValid() && name && name[0]) { -clang::QualType enum_qual_type(GetCanonicalQualType(type)); - -bool is_signed = false; -enumerator_clang_type.IsIntegerType(is_signed); -const clang::Type *clang_type = enum_qual_type.getTypePtr(); -if (clang_type) { - const clang::EnumType *enutype = - llvm::dyn_cast(clang_type); - - if (enutype) { -llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed); -enum_llvm_apsint = enum_value; -clang::EnumConstantDecl *enumerator_decl = -clang::EnumConstantDecl::Create( -*getASTContext(), enutype->getDecl(), clang::SourceLocation(), -name ? &getASTContext()->Idents.get(name) - : nullptr, // Identifier -ClangUtil::GetQualType(enumerator_clang_type), -nullptr, enum_llvm_apsint); - -if (enumerator_decl) { - enutype->getDecl()->addDecl(enumerator_decl); +const CompilerType enum_type, const Declaration &decl, const char *name, +int64_t enum_value, uint32_t enum_value_bit_size) { + + if (!enum_type || ConstString(name).IsEmpty()) +return nullptr; + + lldb::opaque_compiler_type_t enum_opaque_compiler_type = + enum_type.GetOpaqueQualType(); + + if (!enum_opaque_compiler_type) +return nullptr; + + CompilerType underlying_type = + GetEnumerationIntegerType(enum_type.GetOpaqueQualType()); + + clang::QualType enum_qual_type( + GetCanonicalQualType(enum_opaque_compiler_type)); + + bool is_signed = false; + underlying_type.IsIntegerType(is_signed); + const clang::Type *clang_type = enum_qual_type.getTypePtr(); + + if (!clang_type) +return nullptr; + + const clang::EnumType *enutype = llvm::dyn_cast(clang_type); + + if (!enutype) +return nullptr; + + llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed); + enum_llvm_apsint = enum_value; + clang::EnumConstantDecl *enumerator_decl = clang::EnumConstantDecl::Create( + *getASTContext(), enutype->getDecl(), clang::SourceLocation(), + name ? &getASTContext()->Idents.get(name) : nullptr, // Identifier + clang::QualType(enutype, 0), nullptr, enum_llvm_apsint); + + if (!enumerator_decl) +return nullptr; + + enutype->getDecl()->addDecl(enumerator_decl); #ifdef LLDB_CONFIGURATION_DEBUG - VerifyDecl(enumerator_decl); + VerifyDecl(enumerator_decl); #endif - return enumerator_decl; -} - } -} - } - return nullptr; + return enumerator_decl; } CompilerType Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -1086,8 +1086,7 @@ uint32_t byte_size = m_ast.getASTContext()->getTypeSize( ClangUtil::GetQualType(underlying_type)); auto enum_constant_decl = m_ast.AddEnumerationValueToEnumerationType( - enum_type.GetOpaqueQualType(), underlying_type, decl, name.c_str(), - raw_value, byte_size * 8); + enum_type, decl, name.c_str(), raw_value, byte_size * 8); if (!enum_constant_decl) return false; Index: source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2501,9 +2501,7 @@ if (name && name[0] && got_value) { m_ast.AddEnumerationValueToEnumeratio
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
jingham added a comment. It doesn't seem unreasonable to want to build lldb for smaller systems that don't have Python available, and in fact we do that internally at Apple. Actually, it DOES seem a little unreasonable to me because after all you can just run the debugserver/lldb-server and connect remotely. But I have not to date been able to convince the folks who have to work on said systems that they don't really want an on device lldb. Until I can win that argument - which I project happening only just shy of never - I'd rather not lose the ability to build lldb without Python. https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter
davide added inline comments. Comment at: packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py:42 +## integral is not implicitly convertible to a scoped enum +value = frame.EvaluateExpression("1 == Foo::FooBar") +self.assertTrue(value.IsValid()) This clearly looks like can be an inline test (and probably would make the thing more readable, IMHO). https://reviews.llvm.org/D54003 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53989: Fix formatting of wchar, char16, and char32
jingham added a comment. Note also, the vast majority of the uses of LLDB_DISABLE_PYTHON are related to the requirement that we have Python to use any of the data formatter facilities. Those uses shouldn't be necessary. All the scripted interpreters should go through the generic ScriptInterpreter interface. There's a ScriptInterpreterNone that should stand in for the Python interpreter in every use except directly managing the Python interpreter. So there's no structural reason why we should need LLDB_DISABLE_PYTHON for anything but the initializers. We should just be able to not build the *Python.cpp files and use the define only to not initialize the Python script interpreter. Something got balled up in how the data formatters were implemented that this isn't true, IMHO. If somebody wants to spend time looking at this, figuring how to untangle this would serve your purposes and also get the architecture back right at the same time. https://reviews.llvm.org/D53989 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r345898 - [FileSystem] Update SetFile signature.
Author: jdevlieghere Date: Thu Nov 1 15:16:34 2018 New Revision: 345898 URL: http://llvm.org/viewvc/llvm-project?rev=345898&view=rev Log: [FileSystem] Update SetFile signature. Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp Modified: lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp?rev=345898&r1=345897&r2=345898&view=diff == --- lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp (original) +++ lldb/trunk/source/Host/freebsd/HostInfoFreeBSD.cpp Thu Nov 1 15:16:34 2018 @@ -69,7 +69,7 @@ FileSpec HostInfoFreeBSD::GetProgramFile if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0) { char *exe_path = new char[exe_path_size]; if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0) -g_program_filespec.SetFile(exe_path, false, FileSpec::Style::native); +g_program_filespec.SetFile(exe_path, FileSpec::Style::native); delete[] exe_path; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
zturner created this revision. zturner added reviewers: stella.stamenova, labath, beanz, davide. Herald added subscribers: jfb, delcypher, mgorny, ki.stfu. A year or so ago, I re-wrote most of the lit infrastructure in LLVM so that it wasn't so boilerplate-y. I added lots of common helper type stuff, simplifed usage patterns, and made the code more elegant and maintainable. We migrated to this in LLVM, clang, and lld's lit files, but not in LLDBs. This started to bite me recently, as the 4 most recent times I tried to run the lit test suite in LLDB on a fresh checkout the first thing that would happen is that python would just start crashing with unhelpful backtraces and I would have to spend time investigating. You can reproduce this today by doing a fresh cmake generation, doing `ninja lldb` and then `python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile` at which point you'll get a segfault that tells you nothing about what your problem is. I started trying to fix the issues with bandaids, but it became clear that the proper solution was to just bring in the work I did in the rest of the projects. The side benefit of this is that the lit configuration files become much cleaner and more understandable as a result. https://reviews.llvm.org/D54009 Files: lldb/lit/Breakpoint/case-insensitive.test lldb/lit/Breakpoint/lit.local.cfg lldb/lit/CMakeLists.txt lldb/lit/Expr/TestIRMemoryMapWindows.test lldb/lit/Expr/lit.local.cfg lldb/lit/Quit/lit.local.cfg lldb/lit/Settings/lit.local.cfg lldb/lit/SymbolFile/NativePDB/lit.local.cfg lldb/lit/SymbolFile/PDB/ast-restore.test lldb/lit/SymbolFile/PDB/calling-conventions.test lldb/lit/SymbolFile/PDB/class-layout.test lldb/lit/SymbolFile/PDB/compilands.test lldb/lit/SymbolFile/PDB/enums-layout.test lldb/lit/SymbolFile/PDB/func-symbols.test lldb/lit/SymbolFile/PDB/function-level-linking.test lldb/lit/SymbolFile/PDB/function-nested-block.test lldb/lit/SymbolFile/PDB/lit.local.cfg lldb/lit/SymbolFile/PDB/pointers.test lldb/lit/SymbolFile/PDB/type-quals.test lldb/lit/SymbolFile/PDB/typedefs.test lldb/lit/SymbolFile/PDB/udt-layout.test lldb/lit/SymbolFile/PDB/variables-locations.test lldb/lit/SymbolFile/PDB/variables.test lldb/lit/Unit/lit.cfg lldb/lit/Unit/lit.cfg.py lldb/lit/Unit/lit.site.cfg.in lldb/lit/Unit/lit.site.cfg.py.in lldb/lit/lit.cfg lldb/lit/lit.cfg.py lldb/lit/lit.site.cfg.in lldb/lit/lit.site.cfg.py.in lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test lldb/lit/tools/lldb-mi/breakpoint/break-insert.test lldb/lit/tools/lldb-mi/data/data-info-line.test lldb/lit/tools/lldb-mi/exec/exec-continue.test lldb/lit/tools/lldb-mi/exec/exec-finish.test lldb/lit/tools/lldb-mi/exec/exec-interrupt.test lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test lldb/lit/tools/lldb-mi/exec/exec-next.test lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test lldb/lit/tools/lldb-mi/exec/exec-step.test lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test llvm/utils/lit/lit/llvm/config.py Index: llvm/utils/lit/lit/llvm/config.py === --- llvm/utils/lit/lit/llvm/config.py +++ llvm/utils/lit/lit/llvm/config.py @@ -55,6 +55,8 @@ features.add('system-windows') elif platform.system() == "Linux": features.add('system-linux') +elif platform.system() in ['FreeBSD']: +config.available_features.add('system-freebsd') # Native compilation: host arch == default triple arch # Both of these values should probably be in every site config (e.g. as Index: lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test === --- lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test +++ lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c %p/inputs/symbol-list-lines.c %p/inputs/list-lines-helper.c -g Index: lldb/lit/tools/lldb-mi/exec/exec-step.test === --- lldb/lit/tools/lldb-mi/exec/exec-step.test +++ lldb/lit/tools/lldb-mi/exec/exec-step.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test === --- lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test +++ lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test @@ -1,4 +1,4 @@ -# XFAIL: windows +# XFAIL: system-windows # -> llvm.org/pr24452 # # RUN: %cc -o %t %p/inputs/main.c -g Index: lldb/lit/tools/lldb-mi/exec/exec-next.test === --- lldb/lit/tools/lldb-mi/exec/exec-next.test +++ lldb/lit/tools/lldb-mi/exec
[Lldb-commits] [lldb] r345901 - [File] Remove static method to get permissions.
Author: jdevlieghere Date: Thu Nov 1 15:46:49 2018 New Revision: 345901 URL: http://llvm.org/viewvc/llvm-project?rev=345901&view=rev Log: [File] Remove static method to get permissions. This patch removes the static accessor in File to get a file's permissions. Permissions should be checked through the FileSystem class. Modified: lldb/trunk/include/lldb/Host/File.h lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/source/Host/common/File.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Modified: lldb/trunk/include/lldb/Host/File.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/File.h?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/include/lldb/Host/File.h (original) +++ lldb/trunk/include/lldb/Host/File.h Thu Nov 1 15:46:49 2018 @@ -419,8 +419,6 @@ public: //-- uint32_t GetPermissions(Status &error) const; - static uint32_t GetPermissions(const FileSpec &file_spec, Status &error); - //-- /// Return true if this file is interactive. /// Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov 1 15:46:49 2018 @@ -66,6 +66,8 @@ public: /// @{ uint32_t GetPermissions(const FileSpec &file_spec) const; uint32_t GetPermissions(const llvm::Twine &path) const; + uint32_t GetPermissions(const FileSpec &file_spec, std::error_code &ec) const; + uint32_t GetPermissions(const llvm::Twine &path, std::error_code &ec) const; /// @} /// Returns whether the given file exists. Modified: lldb/trunk/source/Host/common/File.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/File.cpp?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/source/Host/common/File.cpp (original) +++ lldb/trunk/source/Host/common/File.cpp Thu Nov 1 15:46:49 2018 @@ -248,19 +248,6 @@ Status File::Open(const char *path, uint return error; } -uint32_t File::GetPermissions(const FileSpec &file_spec, Status &error) { - if (file_spec) { -error.Clear(); -auto Perms = llvm::sys::fs::getPermissions(file_spec.GetPath()); -if (Perms) - return *Perms; -error = Status(Perms.getError()); -return 0; - } else -error.SetErrorString("empty file spec"); - return 0; -} - uint32_t File::GetPermissions(Status &error) const { int fd = GetDescriptor(); if (fd != kInvalidDescriptor) { Modified: lldb/trunk/source/Host/common/FileSystem.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/source/Host/common/FileSystem.cpp (original) +++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov 1 15:46:49 2018 @@ -78,10 +78,23 @@ uint32_t FileSystem::GetPermissions(cons return GetPermissions(file_spec.GetPath()); } +uint32_t FileSystem::GetPermissions(const FileSpec &file_spec, +std::error_code &ec) const { + return GetPermissions(file_spec.GetPath(), ec); +} + uint32_t FileSystem::GetPermissions(const Twine &path) const { + std::error_code ec; + return GetPermissions(path, ec); +} + +uint32_t FileSystem::GetPermissions(const Twine &path, +std::error_code &ec) const { ErrorOr status = m_fs->status(path); - if (!status) + if (!status) { +ec = status.getError(); return sys::fs::perms::perms_not_known; + } return status->getPermissions(); } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=345901&r1=345900&r2=345901&view=diff == --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Thu Nov 1 15:46:49 2018 @@ -660,14 +660,14 @@ GDBRemoteCommunicationServerCommon::Hand std::string path; packet.GetHexByteString(path); if (!path.empty()) { -Status error; FileSpec file_spec(path); FileSystem::Instance().Resolve(file_spec); -const uint32_t mode = File::GetPermissions(file
[Lldb-commits] [lldb] r345912 - When no FileCheck binary is specified, look in the llvm/clang bin
Author: jmolenda Date: Thu Nov 1 16:41:05 2018 New Revision: 345912 URL: http://llvm.org/viewvc/llvm-project?rev=345912&view=rev Log: When no FileCheck binary is specified, look in the llvm/clang bin dirs relative to the source directory (Xcode build style) to find one, use it if found. Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=345912&r1=345911&r2=345912&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Thu Nov 1 16:41:05 2018 @@ -313,6 +313,13 @@ def parseOptionsAndInitTestdirs(): # target. However, when invoking dotest.py directly, a valid --filecheck # option needs to be given. configuration.filecheck = os.path.abspath(args.filecheck) +else: +outputPaths = get_llvm_bin_dirs() +for outputPath in outputPaths: +candidatePath = os.path.join(outputPath, 'FileCheck') +if is_exe(candidatePath): +configuration.filecheck = candidatePath +break if not configuration.get_filecheck_path(): logging.warning('No valid FileCheck executable; some tests may fail...') @@ -627,6 +634,31 @@ def getOutputPaths(lldbRootDirectory): return result +def get_llvm_bin_dirs(): +""" +Returns an array of paths that may have the llvm/clang/etc binaries +in them, relative to this current file. +Returns an empty array if none are found. +""" +result = [] + +lldb_root_path = os.path.join( +os.path.dirname(__file__), "..", "..", "..", "..") +paths_to_try = [ +"llvm-build/Release+Asserts/x86_64/bin", +"llvm-build/Debug+Asserts/x86_64/bin", +"llvm-build/Release/x86_64/bin", +"llvm-build/Debug/x86_64/bin", +"llvm-build/Ninja-DebugAssert/llvm-macosx-x86_64/bin", +"llvm-build/Ninja-ReleaseAssert/llvm-macosx-x86_64/bin", +"llvm-build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/bin", +] +for p in paths_to_try: +path = os.path.join(lldb_root_path, p) +if os.path.exists(path): +result.append(path) + +return result def setupSysPath(): """ ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
stella.stamenova accepted this revision. stella.stamenova added a comment. This revision is now accepted and ready to land. Looks good. The formatting in lit.cfg.py is a bit messy (indentations, especially), but as long as the tests pass, this is an improvement :). Thanks! https://reviews.llvm.org/D54009 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
zturner added a comment. In https://reviews.llvm.org/D54009#1284827, @stella.stamenova wrote: > Looks good. The formatting in lit.cfg.py is a bit messy (indentations, > especially), but as long as the tests pass, this is an improvement :). Thanks! Is there something like clang-format for Python? Happy to fix it if so. (I don't do a lot of Python so it's hard for me to eyeball it and figure out what's wrong, so I have to say it looks fine to me :)) https://reviews.llvm.org/D54009 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54020: [FileSystem] Open File instances through the FileSystem.
JDevlieghere created this revision. JDevlieghere added reviewers: labath, zturner, jingham, clayborg. JDevlieghere added a project: LLDB. This patch modifies how we open `File` instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS. The current implementation doesn't use the VFS yet. The reason is that in LLDB we mostly use FILE pointers or file descriptors to manipulate files. This is currently not supported by the VFS and I haven't decided to address this yet. The two alternative I see are: - Having the VFS translate paths. This will only work for virtual file systems where the files actually reside on disk. This would be sufficient for the reproducer use case but lacks generality. - Having the VFS provide FILE pointers. Still we wouldn't be able to completely support in-memory vfses. I believe on POSIX there's a way to have a file point to memory, but I don't think you can do that for a file descriptor. Also not sure if that would work on Windows? Both options are incomplete and I don't have the bandwidth to change how LLDB deals with files. I'm currently leaning towards the first alternative because LLVM doesn't provide `FILE*` APIs and I don't think we should start adding them now. Also I don't want to extend the VFS for just LLDB as that's going to be a pain to hook up and maintain. Anyway, I'm open to suggestions! Repository: rLLDB LLDB https://reviews.llvm.org/D54020 Files: include/lldb/Host/File.h include/lldb/Host/FileSystem.h include/lldb/Utility/FileSpec.h source/API/SBStream.cpp source/Commands/CommandObjectBugreport.cpp source/Commands/CommandObjectMemory.cpp source/Core/StreamFile.cpp source/Expression/REPL.cpp source/Host/common/File.cpp source/Host/common/FileCache.cpp source/Host/common/FileSystem.cpp source/Host/posix/FileSystem.cpp source/Host/windows/FileSystem.cpp source/Interpreter/CommandInterpreter.cpp source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp source/Target/ModuleCache.cpp source/Target/Platform.cpp source/Utility/FileSpec.cpp Index: source/Utility/FileSpec.cpp === --- source/Utility/FileSpec.cpp +++ source/Utility/FileSpec.cpp @@ -318,6 +318,8 @@ m_filename.Clear(); } +bool FileSpec::Empty() const { return m_directory && m_filename; } + //-- // Compare two FileSpec objects. If "full" is true, then both the directory and // the filename must match. If "full" is false, then the directory names for Index: source/Target/Platform.cpp === --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -1280,8 +1280,9 @@ if (fs::is_symlink_file(source.GetPath())) source_open_options |= File::eOpenOptionDontFollowSymlinks; - File source_file(source, source_open_options, lldb::eFilePermissionsUserRW); - Status error; + File source_file; + Status error = FileSystem::Instance().OpenFile( + source_file, source, source_open_options, lldb::eFilePermissionsUserRW); uint32_t permissions = source_file.GetPermissions(error); if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; Index: source/Target/ModuleCache.cpp === --- source/Target/ModuleCache.cpp +++ source/Target/ModuleCache.cpp @@ -159,9 +159,10 @@ return; m_file_spec = JoinPath(lock_dir_spec, uuid.GetAsString().c_str()); - m_file.Open(m_file_spec.GetCString(), File::eOpenOptionWrite | -File::eOpenOptionCanCreate | -File::eOpenOptionCloseOnExec); + FileSystem::Instance().OpenFile(m_file, m_file_spec, + File::eOpenOptionWrite | + File::eOpenOptionCanCreate | + File::eOpenOptionCloseOnExec); if (!m_file) { error.SetErrorToErrno(); return; Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -829,11 +829,15 @@ error_file_sp); } else { input_file_sp.reset(new StreamFile()); - input_file_sp->GetFile().Open(FileSystem::DEV_NULL, -
[Lldb-commits] [PATCH] D53530: Fix (and improve) the support for C99 variable length array types
clayborg added a comment. In https://reviews.llvm.org/D53530#1284267, @aprantl wrote: > > I didn't realize that the string int [] is produced by ValueObject itself; > > I think this makes this option more palatable to me. I'll give it a try. > > So, it turns out it isn't. The only way to get the length into the typename > is to hack ClangASTContext::GetTypeName to replace the training "[]" of what > clang returns as the typename with a different string. The main problem with > this is that this will only work for outermost types. > > Something that has been requested in the past is to support C structs with > trailing array members, such as > > struct variable_size { > unsigned length; > int __attribute__((size=.length)) elements[]; // I just made up this > attribute, but you get the basic idea. > }; > > > in a similar fashion. When printing such a struct, there's no way of safely > injecting the size into array type string any more. > If we dynamically created the correctly-sized array type instead, this would > work just fine. > > I haven't yet understood the motivation behind why overriding > GetNumChildren/GetTypeName/GetChildAtIndex is preferable over creating a > dynamic type in the language runtime. Is there something that I need to know? Creating a new dynamic type every time you stop seems like a lot of work and a possible waste of memory. You will need to see if you already have such a type ("int[4]" already exists) and use it if it does each time you stop. Any type that can change dynamically should easily be able to be detected by the type system in GetNumChildren(...) with the right execution context and and a dynamic type name can also easily be calculated in the type system. One option would be to just display "int[]" and have a summary for any dynamic array types that says "size = 4". Then we don't have to touch the typename. https://reviews.llvm.org/D53530 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits