[Lldb-commits] [PATCH] D52981: [LLDB] - Add basic support for .debug_rnglists section (DWARF5)
This revision was automatically updated to reflect the committed changes. Closed by commit rL344119: [LLDB] - Add basic support for .debug_rnglists section (DWARF5) (authored by grimar, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D52981?vs=168759&id=168946#toc Repository: rL LLVM https://reviews.llvm.org/D52981 Files: lldb/trunk/include/lldb/lldb-enumerations.h lldb/trunk/lit/Breakpoint/Inputs/debug_rnglist_basic.yaml lldb/trunk/lit/Breakpoint/debug_rnglist_basic.test lldb/trunk/source/Core/Section.cpp lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Symbol/ObjectFile.cpp Index: lldb/trunk/source/Core/Section.cpp === --- lldb/trunk/source/Core/Section.cpp +++ lldb/trunk/source/Core/Section.cpp @@ -87,6 +87,8 @@ return "dwarf-pubtypes"; case eSectionTypeDWARFDebugRanges: return "dwarf-ranges"; + case eSectionTypeDWARFDebugRngLists: +return "dwarf-rnglists"; case eSectionTypeDWARFDebugStr: return "dwarf-str"; case eSectionTypeDWARFDebugStrOffsets: Index: lldb/trunk/source/Symbol/ObjectFile.cpp === --- lldb/trunk/source/Symbol/ObjectFile.cpp +++ lldb/trunk/source/Symbol/ObjectFile.cpp @@ -358,6 +358,7 @@ case eSectionTypeDWARFDebugPubNames: case eSectionTypeDWARFDebugPubTypes: case eSectionTypeDWARFDebugRanges: + case eSectionTypeDWARFDebugRngLists: case eSectionTypeDWARFDebugStr: case eSectionTypeDWARFDebugStrOffsets: case eSectionTypeDWARFDebugTypes: Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1796,6 +1796,7 @@ static ConstString g_sect_name_dwarf_debug_pubnames(".debug_pubnames"); static ConstString g_sect_name_dwarf_debug_pubtypes(".debug_pubtypes"); static ConstString g_sect_name_dwarf_debug_ranges(".debug_ranges"); + static ConstString g_sect_name_dwarf_debug_rnglists(".debug_rnglists"); static ConstString g_sect_name_dwarf_debug_str(".debug_str"); static ConstString g_sect_name_dwarf_debug_str_offsets( ".debug_str_offsets"); @@ -1879,6 +1880,8 @@ sect_type = eSectionTypeDWARFDebugPubTypes; else if (name == g_sect_name_dwarf_debug_ranges) sect_type = eSectionTypeDWARFDebugRanges; + else if (name == g_sect_name_dwarf_debug_rnglists) +sect_type = eSectionTypeDWARFDebugRngLists; else if (name == g_sect_name_dwarf_debug_str) sect_type = eSectionTypeDWARFDebugStr; else if (name == g_sect_name_dwarf_debug_types) Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp === --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1205,6 +1205,7 @@ case eSectionTypeDWARFDebugPubNames: case eSectionTypeDWARFDebugPubTypes: case eSectionTypeDWARFDebugRanges: + case eSectionTypeDWARFDebugRngLists: case eSectionTypeDWARFDebugStr: case eSectionTypeDWARFDebugStrOffsets: case eSectionTypeDWARFDebugTypes: @@ -1494,7 +1495,7 @@ if (section_name == g_sect_name_dwarf_debug_pubtypes) return eSectionTypeDWARFDebugPubTypes; if (section_name == g_sect_name_dwarf_debug_ranges) -return eSectionTypeDWARFDebugRanges; +return eSectionTypeDWARFDebugRanges; if (section_name == g_sect_name_dwarf_debug_str) return eSectionTypeDWARFDebugStr; if (section_name == g_sect_name_dwarf_debug_types) Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h @@ -18,8 +18,9 @@ class DWARFDebugRanges { public: DWARFDebugRanges(); - ~DWARFDebugRanges(); - void Extract(SymbolFileDWARF *dwarf2Data); + virtual ~DWARFDebugRanges(); + virtual void Extract(SymbolFileDWARF *dwarf2Data); + static void Dump(lldb_private::Stream &s, const lldb_private::DWARFDataExtractor &debug_ranges_data,
[Lldb-commits] [PATCH] D52689: [LLDB] - Add support for DW_FORM_implicit_const.
grimar updated this revision to Diff 169005. grimar marked 12 inline comments as done. grimar added a comment. - Addressed review comments. https://reviews.llvm.org/D52689 Files: lit/Breakpoint/Inputs/implicit_const_form_support.yaml lit/Breakpoint/implicit_const_form_support.test source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp source/Plugins/SymbolFile/DWARF/DWARFAttribute.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.h Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h === --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.h +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.h @@ -62,6 +62,7 @@ dw_form_t Form() const { return m_form; } void SetForm(dw_form_t form) { m_form = form; } const ValueType &Value() const { return m_value; } + void SetValue(const ValueType &val) { m_value = val; } void Dump(lldb_private::Stream &s) const; bool ExtractValue(const lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr); Index: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -165,6 +165,9 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, lldb::offset_t *offset_ptr) { + if (m_form == DW_FORM_implicit_const) +return true; + bool indirect = false; bool is_block = false; m_value.data = NULL; @@ -366,6 +369,7 @@ // 0 bytes values (implied from DW_FORM) case DW_FORM_flag_present: + case DW_FORM_implicit_const: return true; // 1 byte values @@ -822,6 +826,7 @@ case DW_FORM_ref_sig8: case DW_FORM_GNU_str_index: case DW_FORM_GNU_addr_index: +case DW_FORM_implicit_const: return true; default: break; Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -174,6 +174,10 @@ debug_info_data.GetU32(&offset); break; + case DW_FORM_implicit_const: +form_size = 0; +break; + default: *offset_ptr = m_offset; return false; @@ -233,15 +237,16 @@ // Skip all data in the .debug_info for the attributes const uint32_t numAttributes = abbrevDecl->NumAttributes(); -uint32_t i; -dw_attr_t attr; -dw_form_t form; -for (i = 0; i < numAttributes; ++i) { - abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form); +for (uint32_t i = 0; i < numAttributes; ++i) { + DWARFFormValue form_value; + form_value.SetCompileUnit(cu); + + dw_attr_t attr; + abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value); + dw_form_t form = form_value.Form(); if (isCompileUnitTag && ((attr == DW_AT_entry_pc) || (attr == DW_AT_low_pc))) { -DWARFFormValue form_value(cu, form); if (form_value.ExtractValue(debug_info_data, &offset)) { if (attr == DW_AT_low_pc || attr == DW_AT_entry_pc) const_cast(cu)->SetBaseAddress( @@ -287,6 +292,7 @@ // 0 sized form case DW_FORM_flag_present: + case DW_FORM_implicit_const: form_size = 0; break; @@ -417,14 +423,15 @@ return false; const uint32_t numAttributes = abbrevDecl->NumAttributes(); -uint32_t i; -dw_attr_t attr; -dw_form_t form; bool do_offset = false; -for (i = 0; i < numAttributes; ++i) { - abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form); - DWARFFormValue form_value(cu, form); +for (uint32_t i = 0; i < numAttributes; ++i) { + DWARFFormValue form_value; + form_value.SetCompileUnit(cu); + + dw_attr_t attr; + abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value); + if (form_value.ExtractValue(debug_info_data, &offset)) { switch (attr) { case DW_AT_low_pc: @@ -614,14 +621,14 @@ // Dump all data in the .debug_info for the attributes const uint32_t numAttributes = abbrevDecl->NumAttributes(); -uint32_t i; -dw_attr_t attr; -dw_form_t form; -for (i = 0; i < numAttributes; ++i) { - abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form); +for (uint32_t i = 0; i < numAttributes; ++i) { + DWARFFormVa
[Lldb-commits] [PATCH] D52689: [LLDB] - Add support for DW_FORM_implicit_const.
grimar added inline comments. Comment at: source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h:51 + uint32_t idx, dw_attr_t &attr, dw_form_t &form, + DWARFFormValue::ValueType *val = nullptr) const { +m_attributes[idx].get(attr, form, val); clayborg wrote: > Switch to using a "DWARFFormValue *form_value_ptr" so the form value can be > filled in automatically, not just the DWARFFormValue::ValueType. See > comments below where this is called. Answered below. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:386 +static void setUnsignedOrSigned(int &dest, DWARFFormValue &val) { + if (val.Form() == DW_FORM_implicit_const) clayborg wrote: > Remove this as it won't be needed if we do the work of filling in the form > value in GetAttrAndFormByIndexUnchecked Answered below. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:439-440 for (i = 0; i < numAttributes; ++i) { - abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form); - DWARFFormValue form_value(cu, form); + abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form, &val); + DWARFFormValue form_value(cu, form, val); + clayborg wrote: > Maybe switch the order here and pass "form_value" to > GetAttrAndFormByIndexUnchecked?: > > ``` > DWARFFormValue form_value(cu, form); > abbrevDecl->GetAttrAndFormByIndexUnchecked(i, attr, form, &form_value); > ``` > > DWARFFormValue form_value(cu, form); We can not do this because at this point `form` is not yet known. I changed the code in a bit different way though. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:508 if (decl_file == 0) -decl_file = form_value.Unsigned(); +setUnsignedOrSigned(decl_file, form_value); break; clayborg wrote: > Revert this if we do the work inside "GetAttrAndFormByIndexUnchecked" as > form_value will be correct The problem I see here is the following: DWARF5 spec says (2.14 Declaration Coordinates, p50): "Any debugging information entry representing the declaration of an object, module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and DW_AT_decl_column attributes, each of whose value is an **unsigned integer constant**." But about `DW_FORM_implicit_const` it says (p207): "The attribute form DW_FORM_implicit_const **is another special case**. For attributes with this form, the attribute specification contains a third part, which is a **signed LEB128 number**. The value of this number is used as the value of the attribute, and no value is stored in the .debug_info section." So I read `DW_FORM_implicit_const` to `value.sval` and I think we can not use `form_value.Unsigned();` in that case because it reads from `uval`. Writing to one union field and reading from the another is undefined behavior in C++ I believe. Though it works with the modern compilers I think. DWARFFormValue.h contains dead enum (it is unused) https://github.com/llvm-mirror/lldb/blob/master/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h#L51 which intention seems was about to keep the value type information. Should we start to set and check the type of form value? I removed the helper for now, but this UB should be addressed somehow I think? Should we create`DWARFFormValue::GetSignedOrUnsigned` may be? It perhaps will be consistent with `DWARFFormValue::Address`/`AsCString`which check the form type and returned value depends on that. https://reviews.llvm.org/D52689 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53086: [PDB] Fix flaky `variables-locations.test` after PR38857
aleksandr.urakov created this revision. aleksandr.urakov added reviewers: zturner, rnk, stella.stamenova. aleksandr.urakov added a project: LLDB. Herald added subscribers: lldb-commits, abidh, JDevlieghere, aprantl. This patch fixes the flaky test `variables-locations.test`. The test began flaking after the fix of the PR38857 issue. It have happened because in `PDBLocationToDWARFExpression` we treat a `VFRAME` register as a `LLDB_REGNUM_GENERIC_FP`, which leads to `EBP` on Windows x86, but in this case we can't read locals relative to `EBP`. Moreover, it seems that we have no alternative base, so I just have changed `double` with `float` to avoid alignment. By the way, what do you think, how can we make LLDB support aligned stacks? As far as I know, similar alignment problems are reproducible on non-Windows too. Repository: rLLDB LLDB https://reviews.llvm.org/D53086 Files: lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp Index: lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp === --- lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp +++ lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp @@ -2,7 +2,7 @@ void __fastcall foo(short arg_0, float arg_1) { char loc_0 = 'x'; - double loc_1 = 0.5678; + float loc_1 = 0.5678; } int main(int argc, char *argv[]) { Index: lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp === --- lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp +++ lit/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp @@ -2,7 +2,7 @@ void __fastcall foo(short arg_0, float arg_1) { char loc_0 = 'x'; - double loc_1 = 0.5678; + float loc_1 = 0.5678; } int main(int argc, char *argv[]) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r344154 - Create a SymbolFile plugin for cross-platform PDB access.
Author: zturner Date: Wed Oct 10 09:39:07 2018 New Revision: 344154 URL: http://llvm.org/viewvc/llvm-project?rev=344154&view=rev Log: Create a SymbolFile plugin for cross-platform PDB access. The existing SymbolFilePDB only works on Windows, as it is written against a closed-source Microsoft SDK that ships with their debugging tools. There are several reasons we want to bypass this and go straight to the bits of the PDB, but just to list a few: More room for optimization. We can't see inside the implementation of the Microsoft SDK, so we don't always know if we're doing things in the most efficient way possible. For example, setting a breakpoint on main of a big program currently takes several seconds. With the implementation here, the time is unnoticeable. We want to be able to symbolize Windows minidumps even if not on Windows. Someone should be able to debug Windows minidumps as if they were on Windows, given that no running process is necessary. This patch is a very crude first attempt at filling out some of the basic pieces. I've implemented FindFunctions, ParseCompileUnitLineTable, and ResolveSymbolContext for a limited subset of possible parameter values, which is just enough to get it to display something nice for the breakpoint location. I've added several tests exercising this functionality which are limited enough to work on all platforms but still exercise this functionality. I'll try to add as many tests of this nature as I can, but at some point we'll need a live process. For now, this plugin is enabled always on non-Windows, and by setting the environment variable LLDB_USE_NATIVE_PDB_READER=1 on Windows. Eventually, once it's at parity with the Windows implementation, we'll delete the Windows DIA-based implementation. Differential Revision: https://reviews.llvm.org/D53002 Added: lldb/trunk/lit/SymbolFile/NativePDB/ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/Inputs/source-list.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp lldb/trunk/lit/SymbolFile/NativePDB/lit.local.cfg lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbSymUid.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Modified: lldb/trunk/include/lldb/Utility/LLDBAssert.h lldb/trunk/lit/lit.cfg lldb/trunk/source/Plugins/SymbolFile/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/PDB/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Modified: lldb/trunk/include/lldb/Utility/LLDBAssert.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/LLDBAssert.h?rev=344154&r1=344153&r2=344154&view=diff == --- lldb/trunk/include/lldb/Utility/LLDBAssert.h (original) +++ lldb/trunk/include/lldb/Utility/LLDBAssert.h Wed Oct 10 09:39:07 2018 @@ -14,7 +14,8 @@ #define lldbassert(x) assert(x) #else #define lldbassert(x) \ - lldb_private::lldb_assert(x, #x, __FUNCTION__, __FILE__, __LINE__) + lldb_private::lldb_assert(static_cast(x), #x, __FUNCTION__, __FILE__, \ +__LINE__) #endif namespace lldb_private { Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit?rev=344154&view=auto == --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit (added) +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/breakpoints.lldbinit Wed Oct 10 09:39:07 2018 @@ -0,0 +1,6 @@ +break set -n main +break set -n OvlGlobalFn +break set -n StaticFn +break set -n DoesntExist +break list +quit Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/disassembly.lldbinit?rev=344154&view=auto == --- lldb/trunk/lit/SymbolFile/NativePDB/Inp
[Lldb-commits] [PATCH] D52689: [LLDB] - Add support for DW_FORM_implicit_const.
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. A few things inlined. Very close. DumpAttribute will need to take a DWARFFormValue in order to dump the value correctly. Comment at: source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h:43-44 +dw_form_t form; +DWARFFormValue::ValueType val; +m_attributes[idx].get(attr, form, val); +form_value.SetForm(form); It would be nice to be able to access the dw_form_t and DWARFFormValue::ValueType within "form_value" without having to create a temp variables here for both "form" and "val". Fine to add accessors that return references for the form_t and DWARFFormValue::ValueType to DWARFFormValue. Comment at: source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h:45-46 +m_attributes[idx].get(attr, form, val); +form_value.SetForm(form); +form_value.SetValue(val); } If we are able to follow my last inline comment, then these go away. Comment at: source/Plugins/SymbolFile/DWARF/DWARFAttribute.h:23 + DWARFAttribute(dw_attr_t attr, dw_form_t form, + DWARFFormValue::ValueType value) + : m_attr(attr), m_form(form), m_value(value) {} Do we need to use a "DWARFFormValue::ValueType" here? Right now we only need a int64_t and DWARFFormValue::ValueType is larger than that. It does future proof us a bit and there aren't all that many abbreviations, even in a large DWARF file. Just thinking out loud here Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:630-631 DumpAttribute(dwarf2Data, cu, debug_info_data, &offset, s, attr, -form); +form_value.Form()); } DumpAttribute will need to take the full form_value in order to dump DW_FORM_implicit_const forms correctly. Change DumpAttribute to take a "form_value" https://reviews.llvm.org/D52689 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53090: [ProcessWindows] Fix a bug that causes lldb to freeze
asmith created this revision. asmith added reviewers: rnk, zturner, aleksandr.urakov. Herald added a subscriber: lldb-commits. If the process exits before any initial stop then notify the debugger of the error otherwise WaitForDebuggerConnection() will be blocked. An example of this issue is when a process fails to load a dependent DLL. In addition to the fix, remove a duplicate call to FreeProcessHandles() in DebuggerThread::HandleExitProcessEvent() and use decimal format for all thread IDs. Repository: rLLDB LLDB https://reviews.llvm.org/D53090 Files: source/Plugins/Process/Windows/Common/DebuggerThread.cpp source/Plugins/Process/Windows/Common/ProcessWindows.cpp Index: source/Plugins/Process/Windows/Common/ProcessWindows.cpp === --- source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -812,6 +812,14 @@ SetProcessExitStatus(GetID(), true, 0, exit_code); SetPrivateState(eStateExited); + + // If the process exits before any initial stop then notify the debugger + // of the error otherwise WaitForDebuggerConnection() will be blocked. + // An example of this issue is when a process fails to load a dependent DLL. + if (!m_session_data->m_initial_stop_received) { +Status error(exit_code, eErrorTypeWin32); +OnDebuggerError(error, 0); + } } void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) { Index: source/Plugins/Process/Windows/Common/DebuggerThread.cpp === --- source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -50,7 +50,7 @@ lldb::pid_t m_pid; ProcessAttachInfo m_attach_info; }; -} +} // namespace DebuggerThread::DebuggerThread(DebugDelegateSP debug_delegate) : m_debug_delegate(debug_delegate), m_pid_to_detach(0), @@ -191,7 +191,8 @@ handle, pid, terminate_suceeded); } else { LLDB_LOG(log, - "NOT calling TerminateProcess because the inferior is not valid ({0}, 0) (inferior={1})", + "NOT calling TerminateProcess because the inferior is not valid " + "({0}, 0) (inferior={1})", handle, pid); } } @@ -267,6 +268,8 @@ if (wait_result) { DWORD continue_status = DBG_CONTINUE; switch (dbe.dwDebugEventCode) { + default: +llvm_unreachable("Unhandle debug event code!"); case EXCEPTION_DEBUG_EVENT: { ExceptionResult status = HandleExceptionEvent(dbe.u.Exception, dbe.dwThreadId); @@ -330,7 +333,7 @@ FreeProcessHandles(); LLDB_LOG(log, "WaitForDebugEvent loop completed, exiting."); - SetEvent(m_debugging_ended_event); + ::SetEvent(m_debugging_ended_event); } ExceptionResult @@ -381,7 +384,7 @@ DWORD thread_id) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_EVENT | WINDOWS_LOG_THREAD); - LLDB_LOG(log, "Thread {0:x} spawned in process {1}", thread_id, + LLDB_LOG(log, "Thread {0} spawned in process {1}", thread_id, m_process.GetProcessId()); HostThread thread(info.hThread); thread.GetNativeThread().SetOwnsHandle(false); @@ -439,7 +442,6 @@ m_debug_delegate->OnExitProcess(info.dwExitCode); - FreeProcessHandles(); return DBG_CONTINUE; } Index: source/Plugins/Process/Windows/Common/ProcessWindows.cpp === --- source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -812,6 +812,14 @@ SetProcessExitStatus(GetID(), true, 0, exit_code); SetPrivateState(eStateExited); + + // If the process exits before any initial stop then notify the debugger + // of the error otherwise WaitForDebuggerConnection() will be blocked. + // An example of this issue is when a process fails to load a dependent DLL. + if (!m_session_data->m_initial_stop_received) { +Status error(exit_code, eErrorTypeWin32); +OnDebuggerError(error, 0); + } } void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) { Index: source/Plugins/Process/Windows/Common/DebuggerThread.cpp === --- source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -50,7 +50,7 @@ lldb::pid_t m_pid; ProcessAttachInfo m_attach_info; }; -} +} // namespace DebuggerThread::DebuggerThread(DebugDelegateSP debug_delegate) : m_debug_delegate(debug_delegate), m_pid_to_detach(0), @@ -191,7 +191,8 @@ handle, pid, terminate_suceeded); } else { LLDB_LOG(log, - "NOT calling TerminateProcess because the inferior is not valid ({0}, 0) (inferior={1})", + "NOT
[Lldb-commits] [PATCH] D53092: [lldb] Add support in Status::AsCString to retrieve win32 system error strings
asmith created this revision. asmith added reviewers: rnk, zturner, aleksandr.urakov. Herald added a subscriber: lldb-commits. Repository: rLLDB LLDB https://reviews.llvm.org/D53092 Files: source/Utility/Status.cpp unittests/Utility/StatusTest.cpp Index: unittests/Utility/StatusTest.cpp === --- unittests/Utility/StatusTest.cpp +++ unittests/Utility/StatusTest.cpp @@ -10,6 +10,10 @@ #include "lldb/Utility/Status.h" #include "gtest/gtest.h" +#ifdef _WIN32 +#include +#endif + using namespace lldb_private; using namespace lldb; @@ -51,3 +55,22 @@ EXPECT_TRUE(bool(foo)); EXPECT_EQ("foo", llvm::toString(std::move(foo))); } + +#ifdef _WIN32 +TEST(StatusTest, ErrorWin32) { + auto success = Status(NO_ERROR, ErrorType::eErrorTypeWin32); + EXPECT_STREQ(NULL, success.AsCString()); + EXPECT_FALSE(success.ToError()); + EXPECT_TRUE(success.Success()); + + auto s = Status(ERROR_ACCESS_DENIED, ErrorType::eErrorTypeWin32); + EXPECT_TRUE(s.Fail()); + EXPECT_STREQ("Access is denied. ", s.AsCString()); + + s.SetError(ERROR_IPSEC_IKE_TIMED_OUT, ErrorType::eErrorTypeWin32); + EXPECT_STREQ("Negotiation timed out ", s.AsCString()); + + s.SetError(16000, ErrorType::eErrorTypeWin32); + EXPECT_STREQ("unknown error", s.AsCString()); +} +#endif Index: source/Utility/Status.cpp === --- source/Utility/Status.cpp +++ source/Utility/Status.cpp @@ -27,6 +27,9 @@ #include #endif +#ifdef _WIN32 +#include +#endif #include // for uint32_t namespace llvm { @@ -87,7 +90,8 @@ if (Success()) return llvm::Error::success(); if (m_type == ErrorType::eErrorTypePOSIX) -return llvm::errorCodeToError(std::error_code(m_code, std::generic_category())); +return llvm::errorCodeToError( +std::error_code(m_code, std::generic_category())); return llvm::make_error(AsCString(), llvm::inconvertibleErrorCode()); } @@ -106,6 +110,23 @@ Status::~Status() = default; +#ifdef _WIN32 +static std::string RetrieveWin32ErrorString(uint32_t error_code) { + char *buffer = nullptr; + std::string message; + // Retrieve win32 system error. + if (::FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&buffer, 0, NULL)) { +message.assign(buffer); +::LocalFree(buffer); + } + return message; +} +#endif + //-- // Get the error value as a NULL C string. The error string will be fetched and // cached on demand. The cached error string value will remain until the error @@ -128,6 +149,12 @@ m_string = llvm::sys::StrError(m_code); break; +case eErrorTypeWin32: +#if defined(_WIN32) + m_string = RetrieveWin32ErrorString(m_code); +#endif + break; + default: break; } Index: unittests/Utility/StatusTest.cpp === --- unittests/Utility/StatusTest.cpp +++ unittests/Utility/StatusTest.cpp @@ -10,6 +10,10 @@ #include "lldb/Utility/Status.h" #include "gtest/gtest.h" +#ifdef _WIN32 +#include +#endif + using namespace lldb_private; using namespace lldb; @@ -51,3 +55,22 @@ EXPECT_TRUE(bool(foo)); EXPECT_EQ("foo", llvm::toString(std::move(foo))); } + +#ifdef _WIN32 +TEST(StatusTest, ErrorWin32) { + auto success = Status(NO_ERROR, ErrorType::eErrorTypeWin32); + EXPECT_STREQ(NULL, success.AsCString()); + EXPECT_FALSE(success.ToError()); + EXPECT_TRUE(success.Success()); + + auto s = Status(ERROR_ACCESS_DENIED, ErrorType::eErrorTypeWin32); + EXPECT_TRUE(s.Fail()); + EXPECT_STREQ("Access is denied. ", s.AsCString()); + + s.SetError(ERROR_IPSEC_IKE_TIMED_OUT, ErrorType::eErrorTypeWin32); + EXPECT_STREQ("Negotiation timed out ", s.AsCString()); + + s.SetError(16000, ErrorType::eErrorTypeWin32); + EXPECT_STREQ("unknown error", s.AsCString()); +} +#endif Index: source/Utility/Status.cpp === --- source/Utility/Status.cpp +++ source/Utility/Status.cpp @@ -27,6 +27,9 @@ #include #endif +#ifdef _WIN32 +#include +#endif #include // for uint32_t namespace llvm { @@ -87,7 +90,8 @@ if (Success()) return llvm::Error::success(); if (m_type == ErrorType::eErrorTypePOSIX) -return llvm::errorCodeToError(std::error_code(m_code, std::generic_category())); +return llvm::errorCodeToError( +std::error_code(m_code, std::generic_category())); return llvm::make_error(AsCString(), llvm::inconvertibleErrorCode()); } @@ -106,6 +110,23 @@ Status::~Status() = default; +#ifdef _WIN32 +static std::string RetrieveWin32ErrorString(uint32_t erro
[Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()
asmith created this revision. asmith added reviewers: rnk, zturner, aleksandr.urakov, lldb-commits. Herald added subscribers: teemperor, mgrang, mgorny. This parses entries in pecoff import tables for imported DLLs and is intended as the first step to allow LLDB to load a PE's shared modules when creating a target on the LLDB console. Repository: rLLDB LLDB https://reviews.llvm.org/D53094 Files: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h unittests/ObjectFile/CMakeLists.txt unittests/ObjectFile/PECOFF/CMakeLists.txt unittests/ObjectFile/PECOFF/Inputs/BasicsTest.cpp unittests/ObjectFile/PECOFF/Inputs/BasicsTest.exe unittests/ObjectFile/PECOFF/Inputs/DllA.cpp unittests/ObjectFile/PECOFF/Inputs/DllA.dll unittests/ObjectFile/PECOFF/Inputs/DllB.cpp unittests/ObjectFile/PECOFF/Inputs/DllB.dll unittests/ObjectFile/PECOFF/ObjectFilePECOFFTests.cpp Index: unittests/ObjectFile/PECOFF/ObjectFilePECOFFTests.cpp === --- /dev/null +++ unittests/ObjectFile/PECOFF/ObjectFilePECOFFTests.cpp @@ -0,0 +1,134 @@ +//===-- ObjectFilePECOFFTests.cpp ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" +#include "TestingSupport/TestUtilities.h" +#include "lldb/Core/Address.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/Section.h" +#include "lldb/Host/HostInfo.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Utility/FileSpec.h" +#include "llvm/Support/Path.h" +#include "gtest/gtest.h" + +using namespace lldb_private; + +class ObjectFilePECOFFTests : public testing::Test { +public: + void SetUp() override { +HostInfo::Initialize(); +ObjectFilePECOFF::Initialize(); + +m_BasicsTest_exe = GetInputFilePath("BasicsTest.exe"); +m_DllA = GetInputFilePath("DllA.dll"); +m_DllB = GetInputFilePath("DllB.dll"); + } + + void TearDown() override { +ObjectFilePECOFF::Terminate(); +HostInfo::Terminate(); + } + +protected: + std::string m_BasicsTest_exe; + std::string m_DllA; + std::string m_DllB; +}; + +TEST_F(ObjectFilePECOFFTests, TestPECOFFBasics) { + ModuleSpec spec{FileSpec(m_BasicsTest_exe, false)}; + auto module = std::make_shared(spec); + auto list = module->GetSectionList(); + ASSERT_NE(nullptr, list); + + EXPECT_NE(nullptr, list->FindSectionByName(ConstString(".text"))); + EXPECT_NE(nullptr, list->FindSectionByName(ConstString(".data"))); + EXPECT_NE(nullptr, list->FindSectionByName(ConstString(".reloc"))); + EXPECT_NE(nullptr, list->FindSectionByName(ConstString(".pdata"))); + + auto obj = module->GetObjectFile(); + ASSERT_NE(nullptr, obj); + + EXPECT_STREQ("pe-coff", obj->GetPluginName().AsCString()); + EXPECT_TRUE(obj->IsExecutable()); + + // TODO: Check UUID + + // BasicsTest.exe is compiled without debug information. No exports either. + auto fspecs = obj->GetDebugSymbolFilePaths(); + EXPECT_EQ(0u, fspecs.GetSize()); + + auto symtab = obj->GetSymtab(); + ASSERT_NE(nullptr, symtab); + + EXPECT_EQ(0u, symtab->GetNumSymbols()); +} + +TEST_F(ObjectFilePECOFFTests, TestDLL) { + ModuleSpec spec{FileSpec(m_DllA, false)}; + auto module = std::make_shared(spec); + auto list = module->GetSectionList(); + ASSERT_NE(nullptr, list); + + auto text = list->FindSectionByName(ConstString(".text")); + ASSERT_NE(nullptr, text); + + auto obj = module->GetObjectFile(); + ASSERT_NE(nullptr, obj); + + EXPECT_FALSE(obj->IsExecutable()); + + { +ModuleSpecList specs; +auto fspec = FileSpec(m_DllA, false); +ASSERT_EQ(1u, obj->GetModuleSpecifications(fspec, 0, 0, specs)); + } + + auto symtab = obj->GetSymtab(); + ASSERT_NE(nullptr, symtab); + + ASSERT_EQ(1u, symtab->GetNumSymbols()); + + // DllA.dll is compiled without any debug information. + // We expect the symtab is searched. + auto symbol = + module->FindFirstSymbolWithNameAndType(ConstString("?DllFuncA@@YAHH@Z")); + ASSERT_NE(nullptr, symbol); + + // We expect the symbol is valid. + EXPECT_GT(symbol->GetByteSize(), 0); + EXPECT_EQ(text, symbol->GetAddress().GetSection()); + + // We expect the symbol from symtab has no debug information. + auto Symbol = *symbol; + EXPECT_EQ(nullptr, Symbol.CalculateSymbolContextFunction()); + EXPECT_EQ(0u, Symbol.GetPrologueByteSize()); +} + +TEST_F(ObjectFilePECOFFTests, TestDependModules) { + ModuleSpec spec{FileSpec(m_BasicsTest_exe, false)}; + auto module = std::make_shared(spec); + auto obj = module->GetObjectFile(); + ASSERT_NE(nullptr, obj); + + FileSpecList deps; + auto num_of_deps = obj->GetDependentModules(deps); + ASSERT_EQ(3u, num_of_deps); + +
[Lldb-commits] [PATCH] D53086: [PDB] Fix flaky `variables-locations.test` after PR38857
stella.stamenova accepted this revision. stella.stamenova added a comment. This revision is now accepted and ready to land. Could you document that in the test? Repository: rLLDB LLDB https://reviews.llvm.org/D53086 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53096: [lldb-test] Add a lit test for dependent modules in PECOFF
asmith created this revision. asmith added reviewers: rnk, zturner, aleksandr.urakov. Herald added a subscriber: lldb-commits. Add a new subcommand to lldb-test called 'dep-modules' to test dependent modules in PECOFF. Repository: rLLDB LLDB https://reviews.llvm.org/D53096 Files: lit/Modules/PECOFF/dep-modules.yaml lit/Modules/PECOFF/export-dllfunc.yaml lit/Modules/PECOFF/lit.local.cfg tools/lldb-test/lldb-test.cpp Index: tools/lldb-test/lldb-test.cpp === --- tools/lldb-test/lldb-test.cpp +++ tools/lldb-test/lldb-test.cpp @@ -90,6 +90,9 @@ cl::opt SectionContents("contents", cl::desc("Dump each section's contents"), cl::sub(ObjectFileSubcommand)); +cl::opt SectionDependentModules("dep-modules", + cl::desc("Dump each dependent module"), + cl::sub(ObjectFileSubcommand)); cl::list InputFilenames(cl::Positional, cl::desc(""), cl::OneOrMore, cl::sub(ObjectFileSubcommand)); @@ -612,8 +615,7 @@ if (DumpAST) { if (Find != FindType::None) - return make_string_error( - "Cannot both search and dump AST."); + return make_string_error("Cannot both search and dump AST."); if (Regex || !Context.empty() || !Name.empty() || !File.empty() || Line != 0) return make_string_error( @@ -758,6 +760,20 @@ } Printer.NewLine(); } + +if (opts::object::SectionDependentModules) { + // A non-empty section list ensures a valid object file. + auto Obj = ModulePtr->GetObjectFile(); + FileSpecList Files; + auto Count = Obj->GetDependentModules(Files); + Printer.formatLine("Showing {0} dependent module(s)", Count); + for (size_t I = 0; I < Files.GetSize(); ++I) { +AutoIndent Indent(Printer, 2); +Printer.formatLine("Name: {0}", + Files.GetFileSpecAtIndex(I).GetCString()); + } + Printer.NewLine(); +} } return HadErrors; } @@ -832,8 +848,8 @@ ++Probe; } - // Insert the new allocation into the interval map. Use unique allocation IDs - // to inhibit interval coalescing. + // Insert the new allocation into the interval map. Use unique allocation + // IDs to inhibit interval coalescing. static unsigned AllocationID = 0; if (Size) State.Allocations.insert(Addr, EndOfRegion, AllocationID++); Index: lit/Modules/PECOFF/lit.local.cfg === --- /dev/null +++ lit/Modules/PECOFF/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.yaml', '.test'] Index: lit/Modules/PECOFF/export-dllfunc.yaml === --- /dev/null +++ lit/Modules/PECOFF/export-dllfunc.yaml @@ -0,0 +1,172 @@ +# REQUIRES: windows +# RUN: yaml2obj < %s > %t.obj +# +# RUN: lld-link /machine:x64 /out:%t.dll /noentry /nodefaultlib /dll %t.obj /export:DllFunc +# +# RUN: lldb-test object-file %t.dll | FileCheck -check-prefix=BASIC-CHECK %s +# RUN: lldb-test object-file -dep-modules %t.dll | FileCheck -check-prefix=DEPS %s + + +# BASIC-CHECK: Showing 3 sections +# BASIC-CHECK: Index: 0 +# BASIC-CHECK: Name: .text +# BASIC-CHECK: Type: code +# BASIC-CHECK: VM size: 22 +# BASIC-CHECK: File size: 512 +# +# BASIC-CHECK: Index: 1 +# BASIC-CHECK: Name: .rdata +# BASIC-CHECK: Type: data +# BASIC-CHECK: VM size: {{.}} +# BASIC-CHECK: File size: 512 +# +# BASIC-CHECK: Index: 2 +# BASIC-CHECK: Name: .pdata +# BASIC-CHECK: Type: data +# BASIC-CHECK: VM size: 12 +# BASIC-CHECK: File size: 512 +# +# DEPS: Showing 0 dependent module(s) + + +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_AMD64 + Characteristics: [ ] +sections: + - Name:.text +Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] +Alignment: 16 +SectionData: 50894C24048B4C24040FAF4C2404890C248B042459C3 + - Name:.data +Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] +Alignment: 4 +SectionData: '' + - Name:.bss +Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] +Alignment: 4 +SectionData: '' + - Name:.xdata +Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] +Alignment: 4 +SectionData: '010101000102' + - Name:.drectve +Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] +Alignment: 1 +SectionData: 202F44454641554C544C49423A6C6962636D742E6C6962202F44454641554C544C49423A6F6C646E616D65732E6C6962 + - Name:.pdata +Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE
[Lldb-commits] [PATCH] D53086: [PDB] Fix flaky `variables-locations.test` after PR38857
zturner added a comment. > By the way, what do you think, how can we make LLDB support aligned stacks? > As far as I know, similar alignment problems are reproducible on non-Windows > too. When you see VFRAME, you need to look in FPO data. As you might have guessed, VFRAME only occurs in X86. I compiled your sample program with a few modifications, and I'll show some output of `llvm-pdbutil` to illustrate how analyzing FPO data works (which would also give you some insight into how this will eventually be implemented without DIA) Here is the source code I compiled: int g_var = ; void __fastcall with_double(short arg_0, float arg_1) { char loc_0 = 'x'; double dvar = 0.5678; } void __fastcall with_float(short arg_0, float arg_1) { char loc_0 = 'x'; float fvar = 0.5678f; } int main(int argc, char *argv[]) { bool loc_0 = true; int loc_1 = ; with_double(, 0.1234); with_float(, 0.1234); return 0; } Then I ran this command. $ llvm-pdbutil.exe dump -symbols -modi=0 vlt.pdb Symbols Mod | `D:\src\llvmbuild\cl\Debug\x64\vlt.obj`: 52 | S_GPROC32 [size = 52] `with_double` parent = 0, end = 268, addr = 0001:, code size = 50 type = `0x1001 (void (short, float))`, debug start = 0, debug end = 0, flags = none 104 | S_FRAMEPROC [size = 32] size = 28, padding size = 0, offset to padding = 0 bytes of callee saved registers = 0, exception handler addr = : local fp reg = VFRAME, param fp reg = EBP flags = 236 | S_LOCAL [size = 16] `dvar` type=0x0041 (double), flags = none 252 | S_DEFRANGE_FRAMEPOINTER_REL [size = 16] offset = -16, range = [0001:0027,+23) gaps = 2 268 | S_END [size = 4] 272 | S_GPROC32 [size = 52] `with_float` parent = 0, end = 484, addr = 0001:0064, code size = 44 type = `0x1001 (void (short, float))`, debug start = 0, debug end = 0, flags = none 324 | S_FRAMEPROC [size = 32] size = 16, padding size = 0, offset to padding = 0 bytes of callee saved registers = 0, exception handler addr = : local fp reg = EBP, param fp reg = EBP flags = 452 | S_LOCAL [size = 16] `fvar` type=0x0040 (float), flags = none 468 | S_DEFRANGE_FRAMEPOINTER_REL [size = 16] offset = -8, range = [0001:0087,+21) gaps = 2 484 | S_END [size = 4] the `S_GPROC32` and `S_END` records form a pair, so all relevant data for this function is inside of the matching pair. Both `dvar` and `fvar` are of type `S_DEFRANGE_FRAMEPOINTER_REL`, which means they're relative to the framepointer. So we need to search for the `S_FRAMEPROC` record inside of this function. It's immediately after the `S_GPROC32` record in both cases. In the case of `with_float` we find that it says "local fp reg = EBP". This means it's easy, nothing special to do which is why it fixed the issue for you changing to float. On the other hand, as you noticed the other one says `VFRAME`. This means we need to go to the FPO data. But first we need to find the address of this function. The `S_GPROC32` of `with_double` says it's at address `0001:`. So we check the section headers to find out what is section 1. $ llvm-pdbutil.exe dump -section-headers vlt.pdb Section Headers SECTION HEADER #1 .text name 3E3FD virtual size 1000 virtual address 3E400 size of raw data 600 file pointer to raw data 0 file pointer to relocation table 0 file pointer to line numbers 0 number of relocations 0 number of line numbers 6020 flags IMAGE_SCN_CNT_CODE IMAGE_SCN_MEM_EXECUTE IMAGE_SCN_MEM_READ So now we know section 1 starts at virtual address `0x1000`, and this particular function is at offset ``, so it is also at virtual address `0x1000`. The function has size 50, so we are looking for an FPO record in the range of `[0x1000,0x1032)` Now let's look at the FPO data in the PDB. Old FPO Data RVA| Code | Locals | Params | Prolog | Saved Regs | Use BP | Has SEH | Frame Type 131A | 20 | 0 | 0 | 0 | 0 | false | false | FPO 1483 | 19 | 0 | 0 | 0 | 0 | false | false | FPO New FPO Data RVA| Code | Locals | Params | Stack | Prolog | Saved Regs | Has
[Lldb-commits] [PATCH] D53086: [PDB] Fix flaky `variables-locations.test` after PR38857
zturner added a comment. You didn't include it here, but I notice the test file just writes `clang-cl /Zi`. Should we be passing `-m32` or `-m64`? Currently, the test just runs with whatever architecture happens to be set via the VS command prompt. The behavior here is different on x86 and x64 so perhaps it requires separate tests. Repository: rLLDB LLDB https://reviews.llvm.org/D53086 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53090: [ProcessWindows] Fix a bug that causes lldb to freeze
zturner accepted this revision. zturner added a comment. This revision is now accepted and ready to land. Nice find, thanks Repository: rLLDB LLDB https://reviews.llvm.org/D53090 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()
zturner added a comment. If you plan to invest in more substantial changes in `ObjectFilePECOFF`, it might worth considering a complete re-write in terms of `llvm::object::coff`. It has pretty comprehensive support for the PE/COFF spec, so it's just a matter of implementing `ObjectFilePECOFF` on top of it. Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:810 + + std::lock_guard guard(module_sp->GetMutex()); + Does this actually need to be a `recursive_mutex`? Repository: rLLDB LLDB https://reviews.llvm.org/D53094 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r344168 - [Windows] Fix a bug that causes lldb to freeze
Author: asmith Date: Wed Oct 10 11:30:32 2018 New Revision: 344168 URL: http://llvm.org/viewvc/llvm-project?rev=344168&view=rev Log: [Windows] Fix a bug that causes lldb to freeze Summary: If the process exits before any initial stop then notify the debugger of the error otherwise WaitForDebuggerConnection() will be blocked. An example of this issue is when a process fails to load a dependent DLL. In addition to the fix, remove a duplicate call to FreeProcessHandles() in DebuggerThread::HandleExitProcessEvent() and use decimal format for all thread IDs. Reviewers: rnk, zturner, aleksandr.urakov Reviewed By: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D53090 Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=344168&r1=344167&r2=344168&view=diff == --- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (original) +++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Wed Oct 10 11:30:32 2018 @@ -50,7 +50,7 @@ struct DebugAttachContext { lldb::pid_t m_pid; ProcessAttachInfo m_attach_info; }; -} +} // namespace DebuggerThread::DebuggerThread(DebugDelegateSP debug_delegate) : m_debug_delegate(debug_delegate), m_pid_to_detach(0), @@ -191,7 +191,8 @@ Status DebuggerThread::StopDebugging(boo handle, pid, terminate_suceeded); } else { LLDB_LOG(log, - "NOT calling TerminateProcess because the inferior is not valid ({0}, 0) (inferior={1})", + "NOT calling TerminateProcess because the inferior is not valid " + "({0}, 0) (inferior={1})", handle, pid); } } @@ -267,6 +268,8 @@ void DebuggerThread::DebugLoop() { if (wait_result) { DWORD continue_status = DBG_CONTINUE; switch (dbe.dwDebugEventCode) { + default: +llvm_unreachable("Unhandle debug event code!"); case EXCEPTION_DEBUG_EVENT: { ExceptionResult status = HandleExceptionEvent(dbe.u.Exception, dbe.dwThreadId); @@ -330,7 +333,7 @@ void DebuggerThread::DebugLoop() { FreeProcessHandles(); LLDB_LOG(log, "WaitForDebugEvent loop completed, exiting."); - SetEvent(m_debugging_ended_event); + ::SetEvent(m_debugging_ended_event); } ExceptionResult @@ -381,7 +384,7 @@ DebuggerThread::HandleCreateThreadEvent( DWORD thread_id) { Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_EVENT | WINDOWS_LOG_THREAD); - LLDB_LOG(log, "Thread {0:x} spawned in process {1}", thread_id, + LLDB_LOG(log, "Thread {0} spawned in process {1}", thread_id, m_process.GetProcessId()); HostThread thread(info.hThread); thread.GetNativeThread().SetOwnsHandle(false); @@ -439,7 +442,6 @@ DebuggerThread::HandleExitProcessEvent(c m_debug_delegate->OnExitProcess(info.dwExitCode); - FreeProcessHandles(); return DBG_CONTINUE; } 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=344168&r1=344167&r2=344168&view=diff == --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (original) +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Wed Oct 10 11:30:32 2018 @@ -812,6 +812,14 @@ void ProcessWindows::OnExitProcess(uint3 SetProcessExitStatus(GetID(), true, 0, exit_code); SetPrivateState(eStateExited); + + // If the process exits before any initial stop then notify the debugger + // of the error otherwise WaitForDebuggerConnection() will be blocked. + // An example of this issue is when a process fails to load a dependent DLL. + if (!m_session_data->m_initial_stop_received) { +Status error(exit_code, eErrorTypeWin32); +OnDebuggerError(error, 0); + } } void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r344173 - [SymbolFileNativePDB] Fix compilation errors with gcc.
Author: zturner Date: Wed Oct 10 11:52:37 2018 New Revision: 344173 URL: http://llvm.org/viewvc/llvm-project?rev=344173&view=rev Log: [SymbolFileNativePDB] Fix compilation errors with gcc. Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp?rev=344173&r1=344172&r2=344173&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp Wed Oct 10 11:52:37 2018 @@ -134,14 +134,15 @@ void PdbIndex::BuildAddrToSymbolMap(Comp // If the debug info is incorrect, we could have multiple symbols with the // same address. So use try_emplace instead of insert, and the first one // will win. -auto emplace_result = cci.m_symbols_by_va.try_emplace(va, cu_sym_uid); -(void)emplace_result; +auto insert_result = +cci.m_symbols_by_va.insert(std::make_pair(va, cu_sym_uid)); +(void)insert_result; // The odds of an error in some function such as GetSegmentAndOffset or // MakeVirtualAddress are much higher than the odds of encountering bad // debug info, so assert that this item was inserted in the map as opposed // to having already been there. -lldbassert(emplace_result.second); +lldbassert(insert_result.second); } } Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp?rev=344173&r1=344172&r2=344173&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp Wed Oct 10 11:52:37 2018 @@ -219,14 +219,14 @@ GetSegmentOffsetAndLength template <> SegmentOffsetLength GetSegmentOffsetAndLength(const CVSymbol &sym) { Thunk32Sym record = createRecord(sym); - return {record.Segment, record.Offset, record.Length}; + return SegmentOffsetLength{record.Segment, record.Offset, record.Length}; } template <> SegmentOffsetLength GetSegmentOffsetAndLength(const CVSymbol &sym) { CoffGroupSym record = createRecord(sym); - return {record.Segment, record.Offset, record.Size}; + return SegmentOffsetLength{record.Segment, record.Offset, record.Size}; } SegmentOffsetLength lldb_private::npdb::GetSegmentOffsetAndLength( Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h?rev=344173&r1=344172&r2=344173&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h Wed Oct 10 11:52:37 2018 @@ -20,11 +20,16 @@ namespace lldb_private { namespace npdb { struct SegmentOffset { + SegmentOffset() = default; + SegmentOffset(uint16_t s, uint32_t o) : segment(s), offset(o) {} uint16_t segment = 0; uint32_t offset = 0; }; struct SegmentOffsetLength { + SegmentOffsetLength() = default; + SegmentOffsetLength(uint16_t s, uint32_t o, uint32_t l) + : so(s, o), length(l) {} SegmentOffset so; uint32_t length = 0; }; Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=344173&r1=344172&r2=344173&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Wed Oct 10 11:52:37 2018 @@ -487,7 +487,6 @@ bool SymbolFileNativePDB::ParseCompileUn } // LLDB wants the index of the file in the list of support files. - llvm::StringRef file_name = *efn; auto fn_iter = llvm::find(cci->m_file_list, *efn); lldbassert(fn_iter != cci->m_file_list.end()); uint32_t file_index = std::distance(cci->m_file_list.begin(), fn_iter); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53010: Add an alias "var" for "frame var" and "vo" for "frame var -O"
aprantl added a comment. Currently `v` is an alias for `version`. I'd wager that — compared to printing a variable — LLDB user's almost never want to print LLDB's version. Would it make sense to re-purpose the single-letter `v` abbreviation for the much more frequently used `frame variable` action? Repository: rL LLVM https://reviews.llvm.org/D53010 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53010: Add an alias "var" for "frame var" and "vo" for "frame var -O"
xbolva00 added a comment. In https://reviews.llvm.org/D53010#1260956, @aprantl wrote: > Currently `v` is an alias for `version`. I'd wager that — compared to > printing a variable — LLDB user's almost never want to print LLDB's version. > Would it make sense to re-purpose the single-letter `v` abbreviation for the > much more frequently used `frame variable` action? +1 for v as an alias for frame variable. Repository: rL LLVM https://reviews.llvm.org/D53010 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52851: Adding support to step into the callable wrapped by libc++ std::function
shafik updated this revision to Diff 169105. shafik marked 5 inline comments as done. shafik added a comment. - Addressing comments - Adding test to make sure we step through a std::function wrapping a member variable https://reviews.llvm.org/D52851 Files: include/lldb/Target/CPPLanguageRuntime.h packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/Makefile packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp source/Target/CPPLanguageRuntime.cpp source/Target/ThreadPlanStepThrough.cpp Index: source/Target/ThreadPlanStepThrough.cpp === --- source/Target/ThreadPlanStepThrough.cpp +++ source/Target/ThreadPlanStepThrough.cpp @@ -13,6 +13,7 @@ // Project includes #include "lldb/Target/ThreadPlanStepThrough.h" #include "lldb/Breakpoint/Breakpoint.h" +#include "lldb/Target/CPPLanguageRuntime.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" @@ -95,6 +96,15 @@ if (objc_runtime) m_sub_plan_sp = objc_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others); + +CPPLanguageRuntime *cpp_runtime = +m_thread.GetProcess()->GetCPPLanguageRuntime(); + +// If the ObjC runtime did not provide us with a step though plan then if we +// have it check the C++ runtime for a step though plan. +if (!m_sub_plan_sp.get() && cpp_runtime) + m_sub_plan_sp = + cpp_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others); } Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); Index: source/Target/CPPLanguageRuntime.cpp === --- source/Target/CPPLanguageRuntime.cpp +++ source/Target/CPPLanguageRuntime.cpp @@ -26,6 +26,7 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/ThreadPlanRunToAddress.h" +#include "lldb/Target/ThreadPlanStepInRange.h" using namespace lldb; using namespace lldb_private; @@ -158,7 +159,6 @@ // We do this by find the first < and , and extracting in between. // // This covers the case of the lambda known at compile time. - // size_t first_open_angle_bracket = vtable_name.find('<') + 1; size_t first_comma = vtable_name.find_first_of(','); @@ -262,3 +262,76 @@ return optional_info; } + +lldb::ThreadPlanSP +CPPLanguageRuntime::GetStepThroughTrampolinePlan(Thread &thread, + bool stop_others) { + ThreadPlanSP ret_plan_sp; + + lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC(); + + TargetSP target_sp(thread.CalculateTarget()); + + if (target_sp->GetSectionLoadList().IsEmpty()) +return ret_plan_sp; + + Address pc_addr_resolved; + SymbolContext sc; + Symbol *symbol; + + if (!target_sp->GetSectionLoadList().ResolveLoadAddress(curr_pc, + pc_addr_resolved)) +return ret_plan_sp; + + target_sp->GetImages().ResolveSymbolContextForAddress( + pc_addr_resolved, eSymbolContextEverything, sc); + symbol = sc.symbol; + + if (symbol == nullptr) +return ret_plan_sp; + + llvm::StringRef function_name(symbol->GetName().GetCString()); + + // Handling the case where we are attempting to step into std::function. + // The behavior will be that we will attempt to obtain the wrapped + // callable via FindLibCppStdFunctionCallableInfo() and if we find it we + // will return a ThreadPlanRunToAddress to the callable. Therefore we will + // step into the wrapped callable. + // + bool found_expected_start_string = + function_name.startswith("std::__1::function<"); + + if (!found_expected_start_string) +return ret_plan_sp; + + AddressRange range_of_curr_func; + sc.GetAddressRange(eSymbolContextEverything, 0, false, range_of_curr_func); + + StackFrameSP frame = thread.GetStackFrameAtIndex(0); + + if (frame) { +ValueObjectSP value_sp = frame->FindVariable(ConstString("this")); + +CPPLanguageRuntime::LibCppStdFunctionCallableInfo callable_info = +FindLibCppStdFunctionCallableInfo(value_sp); + +if (callable_info.callable_case != LibCppStdFunctionCallableCase::Invalid && +value_sp->GetValueIsValid()) { + // We found the std::function wrapped callable and we have its address. + // We now create a ThreadPlan to run to the callable. + ret_plan_sp.reset(new ThreadPlanRunToAddress( + thread, callable_info.callable_address, stop_others)); + return ret_plan_sp; +} else { + // We are in std::function but we could not obtain the callable. + // We create a ThreadPlan to keep stepping through using the address range + // of the current function. + ret_plan_sp.reset(new ThreadPlanStepInR
[Lldb-commits] [PATCH] D52851: Adding support to step into the callable wrapped by libc++ std::function
shafik added a comment. @jingham I believe I addressed your comments, please review again. https://reviews.llvm.org/D52851 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D51934: [target] Change target create's behavior wrt loading dependent files.
stella.stamenova added a comment. This test has been failing on Windows since it was added as it doesn't build correctly. I noticed some of the tests are also disabled on Linux. Is this supposed to pass on all platforms? Error when building test subject. Build Command: make VPATH=E:\_work\60\s\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\target_create_deps -C E:\_work\60\b\LLVMBuild\lldb-test-build.noindex\functionalities\target_create_deps\TestTargetCreateDeps.test_dependents_explicit_default_lib -I E:\_work\60\s\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\target_create_deps -f E:\_work\60\s\llvm\tools\lldb\packages\Python\lldbsuite\test\functionalities\target_create_deps\Makefile all ARCH=x86_64 CC="E:\_work\60\b\LLVMBuild\Release\bin\clang.exe" ##[error]lld-link(0,0): Error : undefined symbol: "int __cdecl a_function(void)" (?a_function@@YAHXZ) lld-link : error : undefined symbol: "int __cdecl a_function(void)" (?a_function@@YAHXZ) [e:\_work\60\b\LLVMBuild\check-all.vcxproj] >>> referenced by main.o:(main) ##[error]clang(0,0): Error : linker command failed with exit code 1 (use -v to see invocation) clang : error : linker command failed with exit code 1 (use -v to see invocation) [e:\_work\60\b\LLVMBuild\check-all.vcxproj] make: *** [a.out] Error 1 Repository: rLLDB LLDB https://reviews.llvm.org/D51934 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D51934: [target] Change target create's behavior wrt loading dependent files.
jingham added a comment. IIRC, the test is disabled on Linux not because of problems with building the test executables, but because the Linux port doesn't currently load the dependencies of an binary when it loads the binary. So the test was irrelevant on Linux, as was the feature. Repository: rLLDB LLDB https://reviews.llvm.org/D51934 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D52851: Adding support to step into the callable wrapped by libc++ std::function
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. Couple more lines you can delete from the test case, and I think you should make this a debug-variant insensitive test. Do that and this is good. Comment at: packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py:29-30 +self.build() +self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) + +exe = self.getBuildArtifact("a.out") You don't need these two lines anymore. You never use the exe variable, and the target you make with this "file" command is never used (you correctly use the one returned by run_to_source_breakpoint.) Also, this doesn't seem like a debug variant sensitive test, so you really should make this a NO_DEBUG_INFO test. We're trying to do that wherever it makes sense just to keep down the number of tests we run. https://reviews.llvm.org/D52851 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r344209 - Upstreaming the BridgeOS device support and the
Author: jmolenda Date: Wed Oct 10 17:28:35 2018 New Revision: 344209 URL: http://llvm.org/viewvc/llvm-project?rev=344209&view=rev Log: Upstreaming the BridgeOS device support and the LC_BUILD_VERSION load command handling - this commit is a combination of patches by Adrian Prantl and myself. llvm::Triple::BridgeOS isn't defined yet, so all references to that are currently commented out. Also update Xcode project file to build the NativePDB etc plugins. Added: lldb/trunk/lit/Modules/lc_build_version.yaml lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Xcode/package-clang-headers.py lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/Platform/MacOSX/CMakeLists.txt lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/trunk/source/Utility/ArchSpec.cpp Added: lldb/trunk/lit/Modules/lc_build_version.yaml URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/lc_build_version.yaml?rev=344209&view=auto == --- lldb/trunk/lit/Modules/lc_build_version.yaml (added) +++ lldb/trunk/lit/Modules/lc_build_version.yaml Wed Oct 10 17:28:35 2018 @@ -0,0 +1,210 @@ +# RUN: yaml2obj %s > %t.out +# RUN: lldb-test symbols %t.out | FileCheck %s +# REQUIRES: darwin +# Test that the deployment target is parsed from the load commands. +# CHECK: x86_64-apple-macosx10.14.0 +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x0107 + cpusubtype: 0x8003 + filetype:0x0002 + ncmds: 14 + sizeofcmds: 744 + flags: 0x00200085 + reserved:0x +LoadCommands: + - cmd: LC_SEGMENT_64 +cmdsize: 72 +segname: __PAGEZERO +vmaddr: 0 +vmsize: 4294967296 +fileoff: 0 +filesize:0 +maxprot: 0 +initprot:0 +nsects: 0 +flags: 0 + - cmd: LC_SEGMENT_64 +cmdsize: 232 +segname: __TEXT +vmaddr: 4294967296 +vmsize: 4096 +fileoff: 0 +filesize:4096 +maxprot: 7 +initprot:5 +nsects: 2 +flags: 0 +Sections: + - sectname:__text +segname: __TEXT +addr:0x00010FB0 +size:8 +offset: 0x0FB0 +align: 4 +reloff: 0x +nreloc: 0 +flags: 0x8400 +reserved1: 0x +reserved2: 0x +reserved3: 0x + - sectname:__unwind_info +segname: __TEXT +addr:0x00010FB8 +size:72 +offset: 0x0FB8 +align: 2 +reloff: 0x +nreloc: 0 +flags: 0x +reserved1: 0x +reserved2: 0x +reserved3: 0x + - cmd: LC_SEGMENT_64 +cmdsize: 72 +segname: __LINKEDIT +vmaddr: 4294971392 +vmsize: 4096 +fileoff: 4096 +filesize:152 +maxprot: 7 +initprot:1 +nsects: 0 +flags: 0 + - cmd: LC_DYLD_INFO_ONLY +cmdsize: 48 +rebase_off: 0 +rebase_size: 0 +bind_off:0 +bind_size: 0 +weak_bind_off: 0 +weak_bind_size: 0 +lazy_bind_off: 0 +lazy_bind_size: 0 +export_off: 4096 +export_size: 48 + - cmd: LC_SYMTAB +cmdsize: 24 +symoff: 4152 +nsyms: 3 +stroff: 4200 +strsize: 48 + - cmd: LC_DYSYMTAB +cmdsize: 80 +ilocalsym: 0 +nlocalsym: 0 +i
[Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()
Hui added inline comments. Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:810 + + std::lock_guard guard(module_sp->GetMutex()); + zturner wrote: > Does this actually need to be a `recursive_mutex`? I think there is access to the member 'm_filespec_ap'. Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:862 + + // Note that at this moment we only have the base name of the dll. + m_filespec_ap->Append(FileSpec(dll_name_cstr, true)); Given no valid UUID for PECOFF for now, you can't get a valid image based on a filename only. So if the exe target is filed on LLDB, its shared modules probably can't be appended to the target's image list **until the process is launched**. This makes it impossible for developers to lookup any symbol from the shared libraries or set any breakpoint by name to the shared libraries. For example, ``` $ ldd main.exe ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffc5e07) KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffc5ddb) KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffc5ad0) DllB.dll => /c/DllB.dll (0x7ffc3145) DllA.dll => /c/DllA.dll (0x7ffc2f7b) ``` ``` ./lldb.exe main.exe (lldb) image list [ 0] C:\main.exe ``` However we expect 3 images at the moment (excluding windows system libraries) ``` ./lldb.exe main.exe (lldb) image list [ 0] C:\main.exe [ 1] C:\DllA.dll [ 2] C:\DllB.dll ``` So it will be better to have full path of the imported modules here. Repository: rLLDB LLDB https://reviews.llvm.org/D53094 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()
On Wed, Oct 10, 2018 at 6:38 PM Hui Huang via Phabricator < revi...@reviews.llvm.org> wrote: > Hui added inline comments. > > > > Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:810 > + > + std::lock_guard guard(module_sp->GetMutex()); > + > > zturner wrote: > > Does this actually need to be a `recursive_mutex`? > I think there is access to the member 'm_filespec_ ap'. I mean instead of a non recursive mutex. > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits