[Lldb-commits] [lldb] r245831 - [NativeProcessLinux] Pass around threads by reference
Author: labath Date: Mon Aug 24 04:22:04 2015 New Revision: 245831 URL: http://llvm.org/viewvc/llvm-project?rev=245831&view=rev Log: [NativeProcessLinux] Pass around threads by reference Summary: Most NPL private functions took (shared) pointers to threads as arguments. This meant that the callee could not be sure if the pointer was valid and so most functions were peppered with null-checks. Now, I move the check closer to the source, and pass around the threads as references (which are then assumed to be valid). Reviewers: tberghammer Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12237 Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=245831&r1=245830&r2=245831&view=diff == --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon Aug 24 04:22:04 2015 @@ -988,20 +988,47 @@ NativeProcessLinux::MonitorCallback(lldb return; } -// Get details on the signal raised. siginfo_t info; -const auto err = GetSignalInfo(pid, &info); -if (err.Success()) +const auto info_err = GetSignalInfo(pid, &info); +auto thread_sp = GetThreadByID(pid); + +if (! thread_sp) +{ +// Normally, the only situation when we cannot find the thread is if we have just +// received a new thread notification. This is indicated by GetSignalInfo() returning +// si_code == SI_USER and si_pid == 0 +if (log) +log->Printf("NativeProcessLinux::%s received notification about an unknown tid %" PRIu64 ".", __FUNCTION__, pid); + +if (info_err.Fail()) +{ +if (log) +log->Printf("NativeProcessLinux::%s (tid %" PRIu64 ") GetSignalInfo failed (%s). Ingoring this notification.", __FUNCTION__, pid, info_err.AsCString()); +return; +} + +if (log && (info.si_code != SI_USER || info.si_pid != 0)) +log->Printf("NativeProcessLinux::%s (tid %" PRIu64 ") unexpected signal info (si_code: %d, si_pid: %d). Treating as a new thread notification anyway.", __FUNCTION__, pid, info.si_code, info.si_pid); + +auto thread_sp = AddThread(pid); +// Resume the newly created thread. +ResumeThread(*thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER); +ThreadWasCreated(*thread_sp); +return; +} + +// Get details on the signal raised. +if (info_err.Success()) { // We have retrieved the signal info. Dispatch appropriately. if (info.si_signo == SIGTRAP) -MonitorSIGTRAP(&info, pid); +MonitorSIGTRAP(info, *thread_sp); else -MonitorSignal(&info, pid, exited); +MonitorSignal(info, *thread_sp, exited); } else { -if (err.GetError() == EINVAL) +if (info_err.GetError() == EINVAL) { // This is a group stop reception for this tid. // We can reach here if we reinject SIGSTOP, SIGSTP, SIGTTIN or SIGTTOU into the @@ -1013,7 +1040,7 @@ NativeProcessLinux::MonitorCallback(lldb // correctly for all signals. if (log) log->Printf("NativeProcessLinux::%s received a group stop for pid %" PRIu64 " tid %" PRIu64 ". Transparent handling of group stops not supported, resuming the thread.", __FUNCTION__, GetID (), pid); -Resume(pid, signal); +ResumeThread(*thread_sp, thread_sp->GetState(), LLDB_INVALID_SIGNAL_NUMBER); } else { @@ -1028,7 +1055,7 @@ NativeProcessLinux::MonitorCallback(lldb if (log) log->Printf ("NativeProcessLinux::%s GetSignalInfo failed: %s, tid = %" PRIu64 ", signal = %d, status = %d (%s, %s, %s)", - __FUNCTION__, err.AsCString(), pid, signal, status, err.GetError() == ESRCH ? "thread/process killed" : "unknown reason", is_main_thread ? "is main thread" : "is not main thread", thread_found ? "thread metadata removed" : "thread metadata not found"); + __FUNCTION__, info_err.AsCString(), pid, signal, status, info_err.GetError() == ESRCH ? "thread/process killed" : "unknown reason", is_main_thread ? "is main thread" : "is not main thread", thread_found ? "thread metadata removed" : "thread metadata not found"); if (is_main_thread) { @@ -,31 +1138,21 @@ NativeProcessLinux::WaitForNewThread(::p __FUNCTION__, GetID (), tid); new_thread_sp = AddThread(tid); -ResumeThread(new_thread_sp, eStateRunning, LLDB_I
Re: [Lldb-commits] [PATCH] D12237: [NativeProcessLinux] Pass around threads by reference
This revision was automatically updated to reflect the committed changes. Closed by commit rL245831: [NativeProcessLinux] Pass around threads by reference (authored by labath). Changed prior to commit: http://reviews.llvm.org/D12237?vs=32824&id=32937#toc Repository: rL LLVM http://reviews.llvm.org/D12237 Files: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h === --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h @@ -225,25 +225,25 @@ WaitForNewThread(::pid_t tid); void -MonitorSIGTRAP(const siginfo_t *info, lldb::pid_t pid); +MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thread); void -MonitorTrace(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp); +MonitorTrace(NativeThreadLinux &thread); void -MonitorBreakpoint(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp); +MonitorBreakpoint(NativeThreadLinux &thread); void MonitorWatchpoint(NativeThreadLinux &thread, uint32_t wp_index); void -MonitorSignal(const siginfo_t *info, lldb::pid_t pid, bool exited); +MonitorSignal(const siginfo_t &info, NativeThreadLinux &thread, bool exited); bool SupportHardwareSingleStepping() const; Error -SetupSoftwareSingleStepping(NativeThreadProtocolSP thread_sp); +SetupSoftwareSingleStepping(NativeThreadLinux &thread); #if 0 static ::ProcessMessage::CrashReason @@ -262,20 +262,17 @@ bool HasThreadNoLock (lldb::tid_t thread_id); -NativeThreadProtocolSP -MaybeGetThreadNoLock (lldb::tid_t thread_id); - bool StopTrackingThread (lldb::tid_t thread_id); NativeThreadLinuxSP AddThread (lldb::tid_t thread_id); Error -GetSoftwareBreakpointPCOffset (NativeRegisterContextSP context_sp, uint32_t &actual_opcode_size); +GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); Error -FixupBreakpointPCAsNeeded(const NativeThreadLinuxSP &thread_sp); +FixupBreakpointPCAsNeeded(NativeThreadLinux &thread); /// Writes a siginfo_t structure corresponding to the given thread ID to the /// memory region pointed to by @p siginfo. @@ -317,7 +314,7 @@ // Resume the given thread, optionally passing it the given signal. The type of resume // operation (continue, single-step) depends on the state parameter. Error -ResumeThread(const NativeThreadLinuxSP &thread_sp, lldb::StateType state, int signo); +ResumeThread(NativeThreadLinux &thread, lldb::StateType state, int signo); void ThreadWasCreated(NativeThreadLinux &thread); Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp === --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -988,20 +988,47 @@ return; } -// Get details on the signal raised. siginfo_t info; -const auto err = GetSignalInfo(pid, &info); -if (err.Success()) +const auto info_err = GetSignalInfo(pid, &info); +auto thread_sp = GetThreadByID(pid); + +if (! thread_sp) +{ +// Normally, the only situation when we cannot find the thread is if we have just +// received a new thread notification. This is indicated by GetSignalInfo() returning +// si_code == SI_USER and si_pid == 0 +if (log) +log->Printf("NativeProcessLinux::%s received notification about an unknown tid %" PRIu64 ".", __FUNCTION__, pid); + +if (info_err.Fail()) +{ +if (log) +log->Printf("NativeProcessLinux::%s (tid %" PRIu64 ") GetSignalInfo failed (%s). Ingoring this notification.", __FUNCTION__, pid, info_err.AsCString()); +return; +} + +if (log && (info.si_code != SI_USER || info.si_pid != 0)) +log->Printf("NativeProcessLinux::%s (tid %" PRIu64 ") unexpected signal info (si_code: %d, si_pid: %d). Treating as a new thread notification anyway.", __FUNCTION__, pid, info.si_code, info.si_pid); + +auto thread_sp = AddThread(pid); +// Resume the newly created thread. +ResumeThread(*thread_sp, eStateRunning, LLDB_INVALID_SIGNAL_NUMBER); +ThreadWasCreated(*thread_sp); +return; +} + +// Get details on the signal raised. +if (info_err.Success()) { // We have retrieved the signal info. Dispatch appropriately. if (info.si_signo == SIGTRAP) -MonitorSIGTRAP
[Lldb-commits] [lldb] r245834 - Add absolute load address support for the DynamicLoader plugins
Author: tberghammer Date: Mon Aug 24 05:21:55 2015 New Revision: 245834 URL: http://llvm.org/viewvc/llvm-project?rev=245834&view=rev Log: Add absolute load address support for the DynamicLoader plugins The POSIX linker generally reports the load bias for the loaded libraries but in some case it is useful to handle a library based on absolute load address. Example usecases: * Windows linker uses absolute addresses * Library list came from different source (e.g. /proc//maps) Differential revision: http://reviews.llvm.org/D12233 Modified: lldb/trunk/include/lldb/Target/DynamicLoader.h lldb/trunk/source/Core/DynamicLoader.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Modified: lldb/trunk/include/lldb/Target/DynamicLoader.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/DynamicLoader.h?rev=245834&r1=245833&r2=245834&view=diff == --- lldb/trunk/include/lldb/Target/DynamicLoader.h (original) +++ lldb/trunk/include/lldb/Target/DynamicLoader.h Mon Aug 24 05:21:55 2015 @@ -263,12 +263,14 @@ protected: virtual void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, - lldb::addr_t base_addr); + lldb::addr_t base_addr, + bool base_addr_is_offset); // Utility method so base classes can share implementation of UpdateLoadedSections void UpdateLoadedSectionsCommon(lldb::ModuleSP module, - lldb::addr_t base_addr); + lldb::addr_t base_addr, + bool base_addr_is_offset); /// Removes the loaded sections from the target in @p module. /// @@ -282,8 +284,11 @@ protected: /// Locates or creates a module given by @p file and updates/loads the /// resulting module at the virtual base address @p base_addr. -lldb::ModuleSP -LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr); +virtual lldb::ModuleSP +LoadModuleAtAddress(const lldb_private::FileSpec &file, +lldb::addr_t link_map_addr, +lldb::addr_t base_addr, +bool base_addr_is_offset); const lldb_private::SectionList * GetSectionListFromModule(const lldb::ModuleSP module) const; Modified: lldb/trunk/source/Core/DynamicLoader.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DynamicLoader.cpp?rev=245834&r1=245833&r2=245834&view=diff == --- lldb/trunk/source/Core/DynamicLoader.cpp (original) +++ lldb/trunk/source/Core/DynamicLoader.cpp Mon Aug 24 05:21:55 2015 @@ -119,16 +119,20 @@ DynamicLoader::GetTargetExecutable() } void -DynamicLoader::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, addr_t base_addr) +DynamicLoader::UpdateLoadedSections(ModuleSP module, +addr_t link_map_addr, +addr_t base_addr, +bool base_addr_is_offset) { -UpdateLoadedSectionsCommon(module, base_addr); +UpdateLoadedSectionsCommon(module, base_addr, base_addr_is_offset); } void -DynamicLoader::UpdateLoadedSectionsCommon(ModuleSP module, addr_t base_addr) +DynamicLoader::UpdateLoadedSectionsCommon(ModuleSP module, + addr_t base_addr, + bool base_addr_is_offset) { bool changed; -const bool base_addr_is_offset = true; module->SetLoadAddress(m_process->GetTarget(), base_addr, base_addr_is_offset, changed); } @@ -171,7 +175,10 @@ DynamicLoader::GetSectionListFromModule( } ModuleSP -DynamicLoader::LoadModuleAtAddress(const FileSpec &file, addr_t link_map_addr, addr_t base_addr) +DynamicLoader::LoadModuleAtAddress(const FileSpec &file, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { Target &target = m_process->GetTarget(); ModuleList &modules = target.GetImages(); @@ -180,27 +187,28 @@ DynamicLoader::LoadModuleAtAddress(const ModuleSpec module_spec (file, target.GetArchitecture()); if ((module_sp = modules.FindFirstModule (module_spec))) { -UpdateLoadedSections(module_sp, link_map_addr, base_addr); +UpdateLoadedSections(module_sp, link_map_addr, base_
Re: [Lldb-commits] [PATCH] D12233: Add absolute load address support for the DynamicLoader plugins
This revision was automatically updated to reflect the committed changes. Closed by commit rL245834: Add absolute load address support for the DynamicLoader plugins (authored by tberghammer). Changed prior to commit: http://reviews.llvm.org/D12233?vs=32813&id=32939#toc Repository: rL LLVM http://reviews.llvm.org/D12233 Files: lldb/trunk/include/lldb/Target/DynamicLoader.h lldb/trunk/source/Core/DynamicLoader.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h === --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -103,7 +103,7 @@ /// Enables a breakpoint on a function called by the runtime /// linker each time a module is loaded or unloaded. -void +virtual void SetRendezvousBreakpoint(); /// Callback routine which updates the current list of loaded modules based @@ -126,16 +126,17 @@ /// @param link_map_addr The virtual address of the link map for the @p module. /// /// @param base_addr The virtual base address @p module is loaded at. -virtual void +void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, - lldb::addr_t base_addr); + lldb::addr_t base_addr, + bool base_addr_is_offset) override; /// Removes the loaded sections from the target in @p module. /// /// @param module The module to traverse. -virtual void -UnloadSections(const lldb::ModuleSP module); +void +UnloadSections(const lldb::ModuleSP module) override; /// Resolves the entry point for the current inferior process and sets a /// breakpoint at that address. @@ -155,7 +156,7 @@ /// Helper for the entry breakpoint callback. Resolves the load addresses /// of all dependent modules. -void +virtual void LoadAllCurrentModules(); /// Computes a value for m_load_offset returning the computed address on Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp === --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -165,7 +165,7 @@ m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID, executable_sp->GetFileSpec().GetPath().c_str ()); -UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset); +UpdateLoadedSections(executable_sp, LLDB_INVALID_ADDRESS, load_offset, true); // When attaching to a target, there are two possible states: // (1) We already crossed the entry point and therefore the rendezvous @@ -223,7 +223,7 @@ { ModuleList module_list; module_list.Append(executable); -UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset); +UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, load_offset, true); if (log) log->Printf ("DynamicLoaderPOSIXDYLD::%s about to call ProbeEntry()", __FUNCTION__); @@ -252,11 +252,13 @@ } void -DynamicLoaderPOSIXDYLD::UpdateLoadedSections(ModuleSP module, addr_t link_map_addr, addr_t base_addr) +DynamicLoaderPOSIXDYLD::UpdateLoadedSections(ModuleSP module, + addr_t link_map_addr, + addr_t base_addr, + bool base_addr_is_offset) { m_loaded_modules[module] = link_map_addr; - -UpdateLoadedSectionsCommon(module, base_addr); +UpdateLoadedSectionsCommon(module, base_addr, base_addr_is_offset); } void @@ -414,7 +416,7 @@ E = m_rendezvous.loaded_end(); for (I = m_rendezvous.loaded_begin(); I != E; ++I) { -ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr); +ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true); if (module_sp.get()) { loaded_modules.AppendIfNeeded(module_sp); @@ -432,8 +434,7 @@ for (I = m_rendezvous.unloaded_begin(); I != E; ++I) { ModuleSpec module_spec{I->file_spec}; -ModuleSP module_sp = -loaded_modules.F
[Lldb-commits] [lldb] r245836 - Fix teardown cleanup in TestRecursiveTypes
Author: tberghammer Date: Mon Aug 24 05:31:36 2015 New Revision: 245836 URL: http://llvm.org/viewvc/llvm-project?rev=245836&view=rev Log: Fix teardown cleanup in TestRecursiveTypes Modified: lldb/trunk/test/types/TestRecursiveTypes.py Modified: lldb/trunk/test/types/TestRecursiveTypes.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestRecursiveTypes.py?rev=245836&r1=245835&r2=245836&view=diff == --- lldb/trunk/test/types/TestRecursiveTypes.py (original) +++ lldb/trunk/test/types/TestRecursiveTypes.py Mon Aug 24 05:31:36 2015 @@ -30,12 +30,14 @@ class RecursiveTypesTestCase(TestBase): def test_recursive_dsym_type_1(self): """Test that recursive structs are displayed correctly.""" self.buildDsym(dictionary=self.d1) +self.setTearDownCleanup(dictionary=self.d1) self.print_struct() @dwarf_test def test_recursive_dwarf_type_1(self): """Test that recursive structs are displayed correctly.""" self.buildDwarf(dictionary=self.d1) +self.setTearDownCleanup(dictionary=self.d1) self.print_struct() @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @@ -43,12 +45,14 @@ class RecursiveTypesTestCase(TestBase): def test_recursive_dsym_type_2(self): """Test that recursive structs are displayed correctly.""" self.buildDsym(dictionary=self.d2) +self.setTearDownCleanup(dictionary=self.d2) self.print_struct() @dwarf_test def test_recursive_dwarf_type_2(self): """Test that recursive structs are displayed correctly.""" self.buildDwarf(dictionary=self.d2) +self.setTearDownCleanup(dictionary=self.d2) self.print_struct() def print_struct(self): ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12239: Fix buffer overflow for fixed_form_sizes
tberghammer updated this revision to Diff 32946. tberghammer added a comment. Address review comments http://reviews.llvm.org/D12239 Files: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -8941,7 +8941,9 @@ case DW_TAG_template_type_parameter: case DW_TAG_template_value_parameter: { -const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64()); +DWARFFormValue::FixedFormSizes fixed_form_sizes = +DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), + dwarf_cu->IsDWARF64()); DWARFDebugInfoEntry::Attributes attributes; const size_t num_attributes = die->GetAttributes (dwarf, @@ -9460,7 +9462,9 @@ size_t enumerators_added = 0; const DWARFDebugInfoEntry *die; -const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64()); +DWARFFormValue::FixedFormSizes fixed_form_sizes = +DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), + dwarf_cu->IsDWARF64()); for (die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling()) { @@ -9818,7 +9822,9 @@ size_t count = 0; const DWARFDebugInfoEntry *die; -const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64()); +DWARFFormValue::FixedFormSizes fixed_form_sizes = +DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), + dwarf_cu->IsDWARF64()); uint32_t member_idx = 0; BitfieldInfo last_field_info; ModuleSP module_sp = dwarf->GetObjectFile()->GetModule(); @@ -10394,7 +10400,9 @@ if (parent_die == NULL) return 0; -const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64()); +DWARFFormValue::FixedFormSizes fixed_form_sizes = +DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), + dwarf_cu->IsDWARF64()); size_t arg_idx = 0; const DWARFDebugInfoEntry *die; @@ -10570,7 +10578,9 @@ return; const DWARFDebugInfoEntry *die; -const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), dwarf_cu->IsDWARF64()); +DWARFFormValue::FixedFormSizes fixed_form_sizes = +DWARFFormValue::GetFixedFormSizesForAddressSize (dwarf_cu->GetAddressByteSize(), + dwarf_cu->IsDWARF64()); for (die = parent_die->GetFirstChild(); die != NULL; die = die->GetSibling()) { const dw_tag_t tag = die->Tag(); @@ -10928,7 +10938,10 @@ // Set a bit that lets us know that we are currently parsing this dwarf->m_die_to_type[die] = DIE_IS_BEING_PARSED; -const size_t num_attributes = die->GetAttributes(dwarf, dwarf_cu, NULL, attributes); +const size_t num_attributes = die->GetAttributes(dwarf, + dwarf_cu, + DWARFFormValue::FixedFormSizes(), + attributes); uint32_t encoding = 0; lldb::user_id_t encoding_uid = LLDB_INVALID_UID; @@ -5,7 +11128,10 @@ LanguageType class_language = eLanguageTypeUnknown; bool is_complete_objc_class = false; //bool struct_is_class = false; -const size_t num_attributes = die->GetAttributes(dwarf, dwarf_cu, NULL, attributes); +const size_t num_attributes = die->GetAttributes(dwarf, + dwarf_cu, + DWARFFormValue::FixedFormSizes(), +
Re: [Lldb-commits] [PATCH] D12239: Fix buffer overflow for fixed_form_sizes
tberghammer added inline comments. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h:165 @@ -164,3 +164,3 @@ const DWARFCompileUnit* cu, -const uint8_t *fixed_form_sizes, +DWARFFormValue::FixedFormSizes fixed_form_sizes, DWARFDebugInfoEntry::Attributes& attrs, Note: Get attributes have to make a copy of fixed_form_sizes because it query a new fixed_form_sizes object if an empty object was passed in. http://reviews.llvm.org/D12239 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index
tberghammer updated this revision to Diff 32949. tberghammer added a comment. Change DWARFFormValue::AsCString to take SymbolFileDWARF as an argument instead of DWARFDataExtractor http://reviews.llvm.org/D12238 Files: include/lldb/lldb-enumerations.h source/Expression/IRExecutionUnit.cpp source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp source/Plugins/SymbolFile/DWARF/DWARFFormValue.h source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp source/Symbol/ClangASTContext.cpp source/Symbol/ObjectFile.cpp source/Utility/ConvertEnum.cpp Index: source/Utility/ConvertEnum.cpp === --- source/Utility/ConvertEnum.cpp +++ source/Utility/ConvertEnum.cpp @@ -63,6 +63,8 @@ return "objc-cfstrings"; case eSectionTypeDWARFDebugAbbrev: return "dwarf-abbrev"; +case eSectionTypeDWARFDebugAddr: +return "dwarf-addr"; case eSectionTypeDWARFDebugAranges: return "dwarf-aranges"; case eSectionTypeDWARFDebugFrame: @@ -83,6 +85,8 @@ return "dwarf-ranges"; case eSectionTypeDWARFDebugStr: return "dwarf-str"; +case eSectionTypeDWARFDebugStrOffsets: +return "dwarf-str-offsets"; case eSectionTypeELFSymbolTable: return "elf-symbol-table"; case eSectionTypeELFDynamicSymbols: Index: source/Symbol/ObjectFile.cpp === --- source/Symbol/ObjectFile.cpp +++ source/Symbol/ObjectFile.cpp @@ -354,6 +354,7 @@ return eAddressClassData; case eSectionTypeDebug: case eSectionTypeDWARFDebugAbbrev: +case eSectionTypeDWARFDebugAddr: case eSectionTypeDWARFDebugAranges: case eSectionTypeDWARFDebugFrame: case eSectionTypeDWARFDebugInfo: @@ -364,6 +365,7 @@ case eSectionTypeDWARFDebugPubTypes: case eSectionTypeDWARFDebugRanges: case eSectionTypeDWARFDebugStr: +case eSectionTypeDWARFDebugStrOffsets: case eSectionTypeDWARFAppleNames: case eSectionTypeDWARFAppleTypes: case eSectionTypeDWARFAppleNamespaces: Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -8966,7 +8966,7 @@ { case DW_AT_name: if (attributes.ExtractFormValueAtIndex(dwarf, i, form_value)) -name = form_value.AsCString(&dwarf->get_debug_str_data()); +name = form_value.AsCString(dwarf); break; case DW_AT_type: @@ -9498,7 +9498,7 @@ break; case DW_AT_name: -name = form_value.AsCString(&dwarf->get_debug_str_data()); +name = form_value.AsCString(dwarf); break; case DW_AT_description: @@ -9877,7 +9877,7 @@ case DW_AT_decl_file: decl.SetFile(sc.comp_unit->GetSupportFiles().GetFileSpecAtIndex(form_value.Unsigned())); break; case DW_AT_decl_line: decl.SetLine(form_value.Unsigned()); break; case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break; -case DW_AT_name:name = form_value.AsCString(&dwarf->get_debug_str_data()); break; +case DW_AT_name:name = form_value.AsCString(dwarf); break; case DW_AT_type:encoding_uid = form_value.Reference(); break; case DW_AT_bit_offset: bit_offset = form_value.Unsigned(); break; case DW_AT_bit_size:bit_size = form_value.Unsigned(); break; @@ -9917,9 +9917,12 @@ case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break; case DW_AT_artificial: is_artificial = form_value.Boolean(
Re: [Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index
tberghammer added inline comments. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:729 @@ -727,3 +728,3 @@ if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) -name = form_value.AsCString(debug_str); +name = form_value.AsCString(debug_str, debug_str_offsets); break; clayborg wrote: > Don't we need to pass both debug_str and debug_str_offsets here? Other places > seem to pass both like on DWARFDebugInfoEntry.cpp:826 Both of them is passed in here. The only difference is that they are pre-fetched in line 662-663. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:745 @@ -743,3 +744,3 @@ if (attributes.ExtractFormValueAtIndex(m_dwarf2Data, i, form_value)) -mangled_cstr = form_value.AsCString(debug_str); +mangled_cstr = form_value.AsCString(debug_str, debug_str_offsets); break; clayborg wrote: > Don't we need to pass both debug_str and debug_str_offsets here? Other places > seem to pass both like on DWARFDebugInfoEntry.cpp:826 > Both of them is passed in here. The only difference is that they are pre-fetched in line 662-663. Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp:190 @@ -189,7 +189,3 @@ case DW_FORM_data8: m_value.value.uval = data.GetU64(offset_ptr); break; -case DW_FORM_string:m_value.value.cstr = data.GetCStr(offset_ptr); -// Set the string value to also be the data for inlined cstr form values only -// so we can tell the difference between DW_FORM_string and DW_FORM_strp form -// values; -m_value.data = (const uint8_t*)m_value.value.cstr; break; +case DW_FORM_string:m_value.value.cstr = data.GetCStr(offset_ptr); break; case DW_FORM_exprloc: clayborg wrote: > We we not longer need "m_value.data" set to the cstring value to tell the > difference between DW_FORM_string and DW_FORM_strp? This might have been left > over from the code this originated from and might be able to be removed, but > I just wanted to verify that you intended to remove this. We store the information in the m_form field, so we don't have to rely on this magic anymore (I don't see why we needed it at the first place). Comment at: source/Plugins/SymbolFile/DWARF/DWARFFormValue.h:68 @@ -68,1 +67,3 @@ + const lldb_private::DWARFDataExtractor* debug_str_offsets_data_ptr) const; +dw_addr_t Address(const lldb_private::DWARFDataExtractor* debug_addr_data_ptr) const; boolSkipValue(const lldb_private::DWARFDataExtractor& debug_info_data, lldb::offset_t *offset_ptr) const; clayborg wrote: > Should be pass in a lldb::addr_t base_addr in case the DW_FORM is one where > we need to add to the low_pc? Then code like this: > > ``` > dw_form_t form = form_value.Form(); > if (form == DW_FORM_addr || form == DW_FORM_GNU_addr_index) > return form_value.Address(&dwarf2Data->get_debug_addr_data()); > > // DWARF4 can specify the hi_pc as an > return lo_pc + form_value.Unsigned(); > ``` > > Becomes: > > ``` > return form_value.Address(&dwarf2Data->get_debug_addr_data(), > lo_pc); > ``` > > The "base_addr" could default to LLDB_INVALID_ADDRESS and if we get a > relative address we should assert in debug builds using LLDB_ASSERT. > We have a dedicated function for that called DWARFDebugInfoEntry::GetAttributeHighPC. The purpose of this function is to fetch a value where the attribute encoding value class is "address" (http://www.dwarfstd.org/doc/DWARF4.pdf page 155) http://reviews.llvm.org/D12238 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D12280: Make TestCreateDuringInstructionStep linux-specific
labath created this revision. labath added a reviewer: tberghammer. labath added a subscriber: lldb-commits. Herald added subscribers: srhines, danalbert, tberghammer. There were a number of issues about the way I have designed this test originally: - it relied on single-stepping through large parts of code, which was slow and unreliable - the threading libraries interfered with the exact thing we wanted to test For this reason, I have rewritted the test using low-level linux api, which allows the test to be much more focused. The functionality for other platforms will need to be tested separately. http://reviews.llvm.org/D12280 Files: test/functionalities/thread/create_during_instruction_step/Makefile test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py test/functionalities/thread/create_during_instruction_step/main.cpp test/linux/create_during_instruction_step/Makefile test/linux/create_during_instruction_step/TestCreateDuringInstructionStep.py test/linux/create_during_instruction_step/main.cpp Index: test/linux/create_during_instruction_step/main.cpp === --- /dev/null +++ test/linux/create_during_instruction_step/main.cpp @@ -0,0 +1,55 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +// This file deliberately uses low level linux-specific API for thread creation because: +// - instruction-stepping over thread creation using higher-level functions was very slow +// - it was also unreliable due to single-stepping bugs unrelated to this test +// - some threading libraries do not create or destroy threads when we would expect them to + +#include + +#include +#include + +enum { STACK_SIZE = 0x2000 }; + +static uint8_t child_stack[STACK_SIZE]; + +pid_t child_tid; + +std::atomic flag(false); + +int thread_main(void *) +{ +while (! flag) // Make sure the child does not exit prematurely +; + +return 0; +} + +int main () +{ +int ret = clone(thread_main, +child_stack + STACK_SIZE/2, // Don't care whether the stack grows up or down, +// just point to the middle +CLONE_CHILD_CLEARTID | CLONE_FILES | CLONE_FS | CLONE_PARENT_SETTID | CLONE_SETTLS | +CLONE_SIGHAND | CLONE_SYSVSEM | CLONE_THREAD | CLONE_VM, +nullptr, // thread_main argument +&child_tid); + +if (ret == -1) +{ +perror("clone"); +return 1; +} + +flag = true; + +return 0; +} Index: test/linux/create_during_instruction_step/TestCreateDuringInstructionStep.py === --- test/linux/create_during_instruction_step/TestCreateDuringInstructionStep.py +++ test/linux/create_during_instruction_step/TestCreateDuringInstructionStep.py @@ -16,17 +16,13 @@ def setUp(self): # Call super's setUp(). TestBase.setUp(self) -# Find the line numbers to break and continue. -self.breakpoint = line_number('main.cpp', '// Set breakpoint here') @dsym_test def test_step_inst_with_dsym(self): self.buildDsym(dictionary=self.getBuildFlags()) self.create_during_step_inst_test() @dwarf_test -@skipIfTargetAndroid(archs=['aarch64']) -@expectedFailureAndroid("llvm.org/pr23944", archs=['aarch64']) # We are unable to step through std::thread::_M_start_thread def test_step_inst_with_dwarf(self): self.buildDwarf(dictionary=self.getBuildFlags()) self.create_during_step_inst_test() @@ -37,39 +33,28 @@ self.assertTrue(target and target.IsValid(), "Target is valid") # This should create a breakpoint in the stepping thread. -self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=-1) +breakpoint = target.BreakpointCreateByName("main") +self.assertTrue(breakpoint and breakpoint.IsValid(), "Breakpoint is valid") # Run the program. process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) # The stop reason of the thread should be breakpoint. self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) -self.assertEqual(lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint).IsValid(), 1, -STOPPED_DUE_TO_BREAKPOINT) -# Get the number of threads -num_threads = process.GetNumThreads() +threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint)
Re: [Lldb-commits] [PATCH] D12280: Make TestCreateDuringInstructionStep linux-specific
tberghammer accepted this revision. tberghammer added a comment. This revision is now accepted and ready to land. Looks good with 2 minor comments - After the renames the test path don't say that the test is thread related. I think you should add it back to somewhere (e.g. to the test name) - Should we test the thread destroy during instruction single stepping scenario also? Can it hit the same or a similar issue? http://reviews.llvm.org/D12280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12280: Make TestCreateDuringInstructionStep linux-specific
labath added a comment. There is a similar issue during thread destruction, although the underlying reason is a bit different. I have created bug #24551 to track that. http://reviews.llvm.org/D12280 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r245838 - Make TestCreateDuringInstructionStep linux-specific
Author: labath Date: Mon Aug 24 08:23:48 2015 New Revision: 245838 URL: http://llvm.org/viewvc/llvm-project?rev=245838&view=rev Log: Make TestCreateDuringInstructionStep linux-specific Summary: There were a number of issues about the way I have designed this test originally: - it relied on single-stepping through large parts of code, which was slow and unreliable - the threading libraries interfered with the exact thing we wanted to test For this reason, I have rewritted the test using low-level linux api, which allows the test to be much more focused. The functionality for other platforms will need to be tested separately. Reviewers: tberghammer Subscribers: tberghammer, danalbert, srhines, lldb-commits Differential Revision: http://reviews.llvm.org/D12280 Added: lldb/trunk/test/linux/thread/ lldb/trunk/test/linux/thread/create_during_instruction_step/ lldb/trunk/test/linux/thread/create_during_instruction_step/Makefile - copied, changed from r245831, lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py - copied, changed from r245831, lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp Removed: lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py lldb/trunk/test/functionalities/thread/create_during_instruction_step/main.cpp Removed: lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile?rev=245837&view=auto == --- lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile (original) +++ lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile (removed) @@ -1,5 +0,0 @@ -LEVEL = ../../../make - -CXX_SOURCES := main.cpp -ENABLE_THREADS := YES -include $(LEVEL)/Makefile.rules Removed: lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py?rev=245837&view=auto == --- lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py (original) +++ lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py (removed) @@ -1,91 +0,0 @@ -""" -This tests that we do not lose control of the inferior, while doing an instruction-level step -over a thread creation instruction. -""" - -import os -import unittest2 -import lldb -from lldbtest import * -import lldbutil - -class CreateDuringInstructionStepTestCase(TestBase): - -mydir = TestBase.compute_mydir(__file__) - -def setUp(self): -# Call super's setUp(). -TestBase.setUp(self) -# Find the line numbers to break and continue. -self.breakpoint = line_number('main.cpp', '// Set breakpoint here') - -@dsym_test -def test_step_inst_with_dsym(self): -self.buildDsym(dictionary=self.getBuildFlags()) -self.create_during_step_inst_test() - -@dwarf_test -@skipIfTargetAndroid(archs=['aarch64']) -@expectedFailureAndroid("llvm.org/pr23944", archs=['aarch64']) # We are unable to step through std::thread::_M_start_thread -def test_step_inst_with_dwarf(self): -self.buildDwarf(dictionary=self.getBuildFlags()) -self.create_during_step_inst_test() - -def create_during_step_inst_test(self): -exe = os.path.join(os.getcwd(), "a.out") -target = self.dbg.CreateTarget(exe) -self.assertTrue(target and target.IsValid(), "Target is valid") - -# This should create a breakpoint in the stepping thread. -self.bp_num = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.breakpoint, num_expected_locations=-1) - -# Run the program. -process = target.LaunchSimple(None, None, self.get_process_working_directory()) -self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) - -# The stop reason of the thread should be breakpoint. -self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) -self.assertEqual(lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint).IsValid(), 1, -STOPPED_DUE_TO_BREAKPOINT) - -# Get the number of threads -num_threads = process.GetNumThreads() - -# Make sure we see
Re: [Lldb-commits] [PATCH] D12280: Make TestCreateDuringInstructionStep linux-specific
This revision was automatically updated to reflect the committed changes. Closed by commit rL245838: Make TestCreateDuringInstructionStep linux-specific (authored by labath). Changed prior to commit: http://reviews.llvm.org/D12280?vs=32950&id=32952#toc Repository: rL LLVM http://reviews.llvm.org/D12280 Files: lldb/trunk/test/functionalities/thread/create_during_instruction_step/Makefile lldb/trunk/test/functionalities/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py lldb/trunk/test/functionalities/thread/create_during_instruction_step/main.cpp lldb/trunk/test/linux/thread/create_during_instruction_step/Makefile lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp Index: lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp === --- lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp +++ lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp @@ -0,0 +1,55 @@ +//===-- main.cpp *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +// This file deliberately uses low level linux-specific API for thread creation because: +// - instruction-stepping over thread creation using higher-level functions was very slow +// - it was also unreliable due to single-stepping bugs unrelated to this test +// - some threading libraries do not create or destroy threads when we would expect them to + +#include + +#include +#include + +enum { STACK_SIZE = 0x2000 }; + +static uint8_t child_stack[STACK_SIZE]; + +pid_t child_tid; + +std::atomic flag(false); + +int thread_main(void *) +{ +while (! flag) // Make sure the thread does not exit prematurely +; + +return 0; +} + +int main () +{ +int ret = clone(thread_main, +child_stack + STACK_SIZE/2, // Don't care whether the stack grows up or down, +// just point to the middle +CLONE_CHILD_CLEARTID | CLONE_FILES | CLONE_FS | CLONE_PARENT_SETTID | CLONE_SETTLS | +CLONE_SIGHAND | CLONE_SYSVSEM | CLONE_THREAD | CLONE_VM, +nullptr, // thread_main argument +&child_tid); + +if (ret == -1) +{ +perror("clone"); +return 1; +} + +flag = true; + +return 0; +} Index: lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py === --- lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py +++ lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py @@ -0,0 +1,76 @@ +""" +This tests that we do not lose control of the inferior, while doing an instruction-level step +over a thread creation instruction. +""" + +import os +import unittest2 +import lldb +from lldbtest import * +import lldbutil + +class CreateDuringInstructionStepTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +# Call super's setUp(). +TestBase.setUp(self) + +@dsym_test +def test_step_inst_with_dsym(self): +self.buildDsym(dictionary=self.getBuildFlags()) +self.create_during_step_inst_test() + +@dwarf_test +def test_step_inst_with_dwarf(self): +self.buildDwarf(dictionary=self.getBuildFlags()) +self.create_during_step_inst_test() + +def create_during_step_inst_test(self): +exe = os.path.join(os.getcwd(), "a.out") +target = self.dbg.CreateTarget(exe) +self.assertTrue(target and target.IsValid(), "Target is valid") + +# This should create a breakpoint in the stepping thread. +breakpoint = target.BreakpointCreateByName("main") +self.assertTrue(breakpoint and breakpoint.IsValid(), "Breakpoint is valid") + +# Run the program. +process = target.LaunchSimple(None, None, self.get_process_working_directory()) +self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) + +# The stop reason of the thread should be breakpoint. +self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) + +threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint) +self.assertEquals(len(threads), 1, STOPPED_DUE_TO_BREAKPOINT) + +thread = threads[0] +self.assertTrue(thread and thread.IsValid(), "Thread is valid") + +# Make sure we see only one threads +self.assertEqual(process.GetNumThreads(), 1, 'Number of expected threads and
[Lldb-commits] [lldb] r245839 - Simplify NativeThreadLinux includes
Author: labath Date: Mon Aug 24 08:25:54 2015 New Revision: 245839 URL: http://llvm.org/viewvc/llvm-project?rev=245839&view=rev Log: Simplify NativeThreadLinux includes there is no need to include architecture-specific register contexts when the generic one will suffice. Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Modified: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp?rev=245839&r1=245838&r2=245839&view=diff == --- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp Mon Aug 24 08:25:54 2015 @@ -13,10 +13,7 @@ #include #include "NativeProcessLinux.h" -#include "NativeRegisterContextLinux_arm.h" -#include "NativeRegisterContextLinux_arm64.h" -#include "NativeRegisterContextLinux_x86_64.h" -#include "NativeRegisterContextLinux_mips64.h" +#include "NativeRegisterContextLinux.h" #include "lldb/Core/Log.h" #include "lldb/Core/State.h" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r245842 - Fix TestCreateDuringInstructionStep on i386
Author: labath Date: Mon Aug 24 09:24:20 2015 New Revision: 245842 URL: http://llvm.org/viewvc/llvm-project?rev=245842&view=rev Log: Fix TestCreateDuringInstructionStep on i386 Modified: lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp Modified: lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp?rev=245842&r1=245841&r2=245842&view=diff == --- lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp (original) +++ lldb/trunk/test/linux/thread/create_during_instruction_step/main.cpp Mon Aug 24 09:24:20 2015 @@ -38,7 +38,7 @@ int main () int ret = clone(thread_main, child_stack + STACK_SIZE/2, // Don't care whether the stack grows up or down, // just point to the middle -CLONE_CHILD_CLEARTID | CLONE_FILES | CLONE_FS | CLONE_PARENT_SETTID | CLONE_SETTLS | +CLONE_CHILD_CLEARTID | CLONE_FILES | CLONE_FS | CLONE_PARENT_SETTID | CLONE_SIGHAND | CLONE_SYSVSEM | CLONE_THREAD | CLONE_VM, nullptr, // thread_main argument &child_tid); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r245848 - Add the correct decorator to TestCreateDuringInstructionStep
Author: labath Date: Mon Aug 24 10:49:12 2015 New Revision: 245848 URL: http://llvm.org/viewvc/llvm-project?rev=245848&view=rev Log: Add the correct decorator to TestCreateDuringInstructionStep apparently, just placing the file under linux/ does not make the test linux specific. :) Modified: lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py Modified: lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py?rev=245848&r1=245847&r2=245848&view=diff == --- lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py (original) +++ lldb/trunk/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py Mon Aug 24 10:49:12 2015 @@ -17,11 +17,7 @@ class CreateDuringInstructionStepTestCas # Call super's setUp(). TestBase.setUp(self) -@dsym_test -def test_step_inst_with_dsym(self): -self.buildDsym(dictionary=self.getBuildFlags()) -self.create_during_step_inst_test() - +@skipUnlessPlatform(['linux']) @dwarf_test def test_step_inst_with_dwarf(self): self.buildDwarf(dictionary=self.getBuildFlags()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] LLVM buildmaster will be tonight
Hello everyone, LLVM buildmaster will be restarted after 5 PM Pacific time today. Thanks Galina ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12239: Fix buffer overflow for fixed_form_sizes
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. http://reviews.llvm.org/D12239 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12238: Add support for DW_FORM_GNU_[addr, str]_index
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. http://reviews.llvm.org/D12238 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D12290: Handle DW_OP_GNU_addr_index in DWARF expressions
tberghammer created this revision. tberghammer added reviewers: labath, clayborg. tberghammer added a subscriber: lldb-commits. Handle DW_OP_GNU_addr_index in DWARF expressions This is a new operand in the dwarf expressions used when split dwarf is enabled http://reviews.llvm.org/D12290 Files: include/lldb/Expression/DWARFExpression.h source/Expression/DWARFExpression.cpp source/Plugins/Process/Utility/RegisterContextLLDB.cpp source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp source/Symbol/Function.cpp Index: source/Symbol/Function.cpp === --- source/Symbol/Function.cpp +++ source/Symbol/Function.cpp @@ -217,7 +217,7 @@ m_mangled (mangled), m_block (func_uid), m_range (range), -m_frame_base (), +m_frame_base (nullptr), m_flags (), m_prologue_byte_size (0) { @@ -241,7 +241,7 @@ m_mangled (ConstString(mangled), true), m_block (func_uid), m_range (range), -m_frame_base (), +m_frame_base (nullptr), m_flags (), m_prologue_byte_size (0) { Index: source/Symbol/ClangASTContext.cpp === --- source/Symbol/ClangASTContext.cpp +++ source/Symbol/ClangASTContext.cpp @@ -9677,7 +9677,7 @@ int call_file = 0; int call_line = 0; int call_column = 0; -DWARFExpression frame_base; +DWARFExpression frame_base(dwarf_cu); assert (die->Tag() == DW_TAG_subprogram); @@ -9896,6 +9896,7 @@ NULL, // RegisterContext * module_sp, debug_info_data, + dwarf_cu, block_offset, block_length, eRegisterKindDWARF, @@ -10265,7 +10266,7 @@ if (num_attributes > 0) { Declaration decl; -DWARFExpression location; +DWARFExpression location(dwarf_cu); lldb::user_id_t encoding_uid = LLDB_INVALID_UID; AccessType accessibility = default_accessibility; bool is_virtual = false; @@ -10298,6 +10299,7 @@ NULL, module_sp, debug_info_data, + dwarf_cu, block_offset, block_length, eRegisterKindDWARF, Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4012,7 +4012,7 @@ Declaration decl; uint32_t i; lldb::user_id_t type_uid = LLDB_INVALID_UID; -DWARFExpression location; +DWARFExpression location(dwarf_cu); bool is_external = false; bool is_artificial = false; bool location_is_const_value_data = false; Index: source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFLocationDescription.cpp @@ -149,6 +149,8 @@ size = 128; break; case DW_OP_regx: size = 128; break; +case DW_OP_GNU_addr_index: +size = 128; break; default: s.Printf("UNKNOWN ONE-OPERAND OPCODE, #%u", opcode); return 1; Index: source/Plugins/Process/Utility/RegisterContextLLDB.cpp === --- source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -1488,7 +1488,11 @@ unwindplan_regloc.GetDWARFExpressionLength(), process->GetByteOrder(), process->GetAddressByteSize()); ModuleSP opcode_ctx; -DWARFExpression dwarfexpr (opcode_ctx, dwarfdata, 0, unwindplan_regloc.GetDWARFExpressionLength());
[Lldb-commits] [PATCH] D12291: Add split dwarf support to SymbolFileDWARF
tberghammer created this revision. tberghammer added reviewers: labath, clayborg. tberghammer added a subscriber: lldb-commits. Add split dwarf support to SymbolFileDWARF * Create new dwo symbol file class * Add handling for .dwo sections * Propagate queries from SymbolFileDWARF to the dwo symbol file when necessary After this change and the other split dwarf related changes (D12238, D12239, D12290) most of the tests passes with split dwarf enabled (25 failures, most of them expression evaluation related) http://reviews.llvm.org/D12291 Files: include/lldb/Symbol/ObjectFile.h source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp source/Plugins/SymbolFile/DWARF/CMakeLists.txt source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h source/Symbol/ObjectFile.cpp Index: source/Symbol/ObjectFile.cpp === --- source/Symbol/ObjectFile.cpp +++ source/Symbol/ObjectFile.cpp @@ -602,15 +602,23 @@ } SectionList * -ObjectFile::GetSectionList() +ObjectFile::GetSectionList(bool update_module_section_list) { if (m_sections_ap.get() == nullptr) { -ModuleSP module_sp(GetModule()); -if (module_sp) +if (update_module_section_list) { -lldb_private::Mutex::Locker locker(module_sp->GetMutex()); -CreateSections(*module_sp->GetUnifiedSectionList()); +ModuleSP module_sp(GetModule()); +if (module_sp) +{ +lldb_private::Mutex::Locker locker(module_sp->GetMutex()); +CreateSections(*module_sp->GetUnifiedSectionList()); +} +} +else +{ +SectionList unified_section_list; +CreateSections(unified_section_list); } } return m_sections_ap.get(); Index: source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h === --- source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h +++ source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.h @@ -86,7 +86,7 @@ lldb::TypeSP m_type_sp; SymbolFileDWARF *m_symfile; -const DWARFCompileUnit *m_cu; +DWARFCompileUnit *m_cu; const DWARFDebugInfoEntry *m_die; lldb_private::Declaration m_declaration; int32_t m_byte_size; @@ -118,7 +118,7 @@ bool Find (SymbolFileDWARF *symfile, - const DWARFCompileUnit *cu, + DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die, const lldb_private::Declaration &decl, const int32_t byte_size, @@ -151,7 +151,7 @@ bool Find (const lldb_private::ConstString &name, SymbolFileDWARF *symfile, - const DWARFCompileUnit *cu, + DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die, const lldb_private::Declaration &decl, const int32_t byte_size, Index: source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp === --- source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp +++ source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp @@ -21,7 +21,7 @@ UniqueDWARFASTTypeList::Find ( SymbolFileDWARF *symfile, -const DWARFCompileUnit *cu, +DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die, const lldb_private::Declaration &decl, const int32_t byte_size, Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h === --- /dev/null +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -0,0 +1,45 @@ +//===-- SymbolFileDWARFDwo.h *- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_ +#define SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "SymbolFileDWARF.h" + +class SymbolFileDWARFDwo : public SymbolFileDWARF +{ +public: +SymbolFileDWARFDwo(lldb_private::ObjectFile* objfile, DWARFCompileUnit* dwarf_cu); + +virtual +~SymbolFileDWARFDwo() = default; + +const lldb_private
Re: [Lldb-commits] [Diffusion] rL237053: Fix selecting the Platform in TargetList::CreateTargetInternal()
dawn added a subscriber: lldb-commits. Users: ted (Author) http://reviews.llvm.org/rL237053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12290: Handle DW_OP_GNU_addr_index in DWARF expressions
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Looks good. DWARFExpression is unique in that it is separate from the DWARF plug-in itself because DWARF expressions are in .eh_frame and other things that don't require the rest of DWARF. It would be nice to not pass a DWARFCompileUnit to DWARFExpression, but then we would need to abstract everything we needed from DWARFCompileUnit into lldb_private::CompileUnit and the things we get from the DWARFCompileUnit are not things we want in the lldb_private::CompileUnit API, so this is the right solution. http://reviews.llvm.org/D12290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [Diffusion] rL237053: Fix selecting the Platform in TargetList::CreateTargetInternal()
dawn added a subscriber: dawn. dawn raised a concern with this commit. dawn added a comment. This broke dotest.py on OSX. When running tests via: ./dotest.py -v --executable $INSTALLDIR/bin/lldb Before this commit, all tests run: Configuration: arch=x86_64 compiler=clang -- Collected 1324 tests 1: test_sb_api_directory (TestPublicAPIHeaders.SBDirCheckerCase) [...] 850: test_disassemble_invalid_vst_1_64_raw_data (TestDisassemble_VST1_64.Disassemble_VST1_64) Test disassembling invalid vst1.64 raw bytes with the API. ... ok 851: test_disassemble_raw_data (TestDisassembleRawData.DisassembleRawDataTestCase) Test disassembling raw bytes with the API. ... ok [...] -- Ran 1324 tests in 4017.285s FAILED (failures=2, errors=3, skipped=118, expected failures=61, unexpected successes=28) After this commit, all tests folloing test_disassemble_invalid_vst_1_64_raw_data get ERRORs: Configuration: arch=x86_64 compiler=clang -- Collected 1324 tests 1: test_sb_api_directory (TestPublicAPIHeaders.SBDirCheckerCase) Test the SB API directory and make sure there's no unwanted stuff. ... skipped 'skip because LLDB.h header not found' [...] 850: test_disassemble_invalid_vst_1_64_raw_data (TestDisassemble_VST1_64.Disassemble_VST1_64) Test disassembling invalid vst1.64 raw bytes with the API. ... ok ERROR ERROR ERROR [...] - Ran 850 tests in 3052.121s FAILED (failures=2, errors=86, skipped=40, expected failures=57, unexpected successes=25) Users: ted (Author) dawn (Auditor) http://reviews.llvm.org/rL237053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12291: Add split dwarf support to SymbolFileDWARF
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. I see the need for a lot of this, but I feel like there are way too many places where we do this: SymbolFileDWARFDwo* dwo_symbol_file = dwarf_cu->GetDwoSymbolFile(); if (dwo_symbol_file) return dwo_symbol_file-> (...); I would like us to more cleanly abstract ourselves from SymbolFileDWARFDwo. Ideally we wouldn't even see "SymbolFileDWARFDwo" anywhere inside SymbolFileDWARF because it has been abstracted behind DWARFCompileUnit and DWARFDebugInfoEntry and any other low level classes that need to know about them. So I would like to see if the following is possible: - DWARFCompileUnit should return the DIEs from the DWO file when DWARFCompileUnit::GetCompileUnitDIEOnly() or DWARFCompileUnit::DIE() is called. - Any code that was doing the pattern from above that was calling dwarf_cu->GetDwoSymbolFile() and deferring to the DWO symbol file should just work normally if the correct DIEs are being handed out. - All references to SymbolFileDWARFDwo should be removed from SymbolFileDWARF if we abstract things correctly. Comment at: include/lldb/Symbol/ObjectFile.h:372 @@ -371,3 +371,3 @@ virtual SectionList * -GetSectionList (); +GetSectionList (bool update_module_section_list = true); Why is this needed? Can you clarify. I don't like this change and would rather avoid it if possible. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:16 @@ -15,2 +15,3 @@ #include "SymbolFileDWARF.h" +#include "SymbolFileDWARFDwo.h" This shouldn't be needed here, just a forward declaration for SymbolFileDWARFDwo should do and then include this in DWARFCompileUnit.cpp. No one outside of this class should need to know anything about SymbolFileDWARFDwo. It should be an implementation detail that only DWARFCompileUnit and DWARFDebugInfoEntry need to know about. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:208-214 @@ -202,1 +207,9 @@ + +SymbolFileDWARFDwo* +GetDwoSymbolFile() +{ +// Extract the compile unit DIE as that one contains the dwo symbol file information +ExtractDIEsIfNeeded(true); +return m_dwo_symbol_file.get(); +} Make protected and hide this from anyone but DWARFCompileUnit and DWARFDebugInfoEntry. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:330 @@ +329,3 @@ +dw_addr_t base_address = form_value.Address(dwarf2Data); + ((DWARFCompileUnit*)cu)->SetBaseAddress(base_address); +} I don't think the cast is needed anymore now that "cu" isn't const. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:806-818 @@ -802,10 +805,15 @@ case DW_AT_high_pc: -hi_pc = form_value.Unsigned(); -if (form_value.Form() != DW_FORM_addr) +if (form_value.Form() == DW_FORM_addr || +form_value.Form() == DW_FORM_GNU_addr_index) { +form_value.Address(dwarf2Data); +} +else +{ +hi_pc = form_value.Unsigned(); if (lo_pc == LLDB_INVALID_ADDRESS) do_offset = hi_pc != LLDB_INVALID_ADDRESS; else hi_pc += lo_pc; // DWARF 4 introduces to save on relocations } break; Shouldn't this be: ``` if (form_value.Form() == DW_FORM_addr || form_value.Form() == DW_FORM_GNU_addr_index) hi_pc = form_value.Address(dwarf2Data); else hi_pc = form_value.Unsigned(); if (hi_pc != LLDB_INVALID_ADDRESS) { if (lo_pc == LLDB_INVALID_ADDRESS) do_offset = hi_pc != LLDB_INVALID_ADDRESS; else hi_pc += lo_pc; // DWARF 4 introduces to save on relocations } ``` Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1437-1438 @@ -1384,3 +1436,4 @@ DWARFFormValue form_value; -if (GetAttributeValue(dwarf2Data, cu, attr, form_value)) +if (GetAttributeValue(dwarf2Data, cu, attr, form_value) || +GetAttributeValueForDwoCompileUnit(dwarf2Data, cu, attr, form_value)) return form_value.Unsigned(); GetAttributeValue(...) should just "do the right thing" and look into the DWO file if needed. Then this change isn't needed. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp:1458-1459 @@ -1404,3 +1457,4 @@ DWARFFormValue form_value; -if (GetAttributeValue(dwarf2Data, cu, attr, form_value)) +if (GetAttributeValue(dwarf2Data, cu, at
Re: [Lldb-commits] [Diffusion] rL238467: Refactor test runner to print sub-test-case pass/fail rate.
dawn accepted this commit. dawn added a comment. After some investigation, it appears your patch may have simply exposed an existing bug, so in one sense I owe an appology, but in another, your patch made that bug impossible to workaround. :) Before your change, it was possible to count the total tests run via adding up all the Ns in the lines: Ran N tests in .* and this would give the correct total. But after your change, these lines were no longer getting printed, forcing one to depend on the final count from: Ran N test cases .* Which is wrong, as I'll explain below. Below I've done a comparison between dosep and dotest on a narrowed subset of tests to show how dosep can omit the test cases from a test suite in its count. Tested on subset of lldb/test with just the following directories/files (i.e. all others directories/files were removed): test/make test/pexpect-2.4 test/plugins test/types test/unittest2 # The .py files kept in test/types are as follows (so test/types/TestIntegerTypes.py* was removed): test/types/AbstractBase.py test/types/HideTestFailures.py test/types/TestFloatTypes.py test/types/TestFloatTypesExpr.py test/types/TestIntegerTypesExpr.py test/types/TestRecursiveTypes.py Tests were run in the lldb/test directory using the following commands: dotest: ./dotest.py -v dosep: ./dosep.py -s --options "-v" Comparing the test case totals, dotest correctly counts 46, but dosep counts only 16: dotest: Ran 46 tests in 75.934s dosep: Testing: 23 tests, 4 threads ## note: this number changes randonmly Ran 6 tests in 7.049s [PASSED TestFloatTypes.py] - 1 out of 23 test suites processed Ran 6 tests in 11.165s [PASSED TestFloatTypesExpr.py] - 2 out of 23 test suites processed Ran 30 tests in 54.581s ## FIXME: not counted? [PASSED TestIntegerTypesExpr.py] - 3 out of 23 test suites processed Ran 4 tests in 3.212s [PASSED TestRecursiveTypes.py] - 4 out of 23 test suites processed Ran 4 test suites (0 failed) (0.00%) Ran 16 test cases (0 failed) (0.00%) With test/types/TestIntegerTypesExpr.py* removed, both correctly count 16 test cases: dosep: Testing: 16 tests, 4 threads Ran 6 tests in 7.059s Ran 6 tests in 11.186s Ran 4 tests in 3.241s Ran 3 test suites (0 failed) (0.00%) Ran 16 test cases (0 failed) (0.00%) In rev.238454 (before your change), results didn't count the number of test cases, but the test suite count is wrong. Running dosep on the above test subset but with all tests in types (i.e. adding back TestIntegerTypes.py so we have 5 tests in types), we get: dosep: Ran 6 tests in 7.871s Ran 6 tests in 13.812s Ran 30 tests in 36.102s Ran 30 tests in 64.063s Ran 4 tests. It seems now that, with dosep's -s option, we can once again see the output: Ran N tests in .* So counting the totals via: ./dosep.py -s --options "-v --executable $INSTALLDIR/bin/lldb" 2>&1 | tee test_out.log || true export total=`grep -E "^Ran [0-9]+ tests? in" test_out.log | awk '{count+=$2} END {print count}'` works once again. BTW, what about tests that time out? I don't see where dosep will report any information about tests which time out. Note: I couldn't compare the test counts on all the tests because of the concern raised in http://reviews.llvm.org/rL237053. That is, dotest can no longer complete the tests, as all test suites fail after test case 898: test_disassemble_invalid_vst_1_64_raw_data get ERRORs. I don't think that issue is related to problems in dosep, but I could be wrong. Note also: When running dotest on earlier sources, it can hang on several tests. To work around this, delete these tests from lldb/test: rm -rf ./functionalities/thread/create_after_attach/TestCreateAfterAttach.py* rm -rf ./functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py* rm -rf ./functionalities/unwind/sigtramp/TestSigtrampUnwind.py* rm -rf ./test/macosx/queues/TestQueues.py* rm -rf ./test/functionalities/inferior-crashing/TestInferiorCrashing.py* In summary, dosep is unable to count the test cases correctly, but this problem existed before your change, and I'm happy that I'm able to use my workaround again. It would be nice to get that fixed someday, as well as see information about the tests that timed out. Thanks, -Dawn Users: zturner (Author) dawn (Auditor) http://reviews.llvm.org/rL238467 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12291: Add split dwarf support to SymbolFileDWARF
tberghammer added a comment. In the current version of the patch the compile units in the main object file hands out only the compile unit DIE with the information what is available in the main object file. I considered the other approach (hand out all DIEs by the DWARF compile unit in the main object file) but I dropped it for the following reasons: - If we hand out DIEs from a dwo symbol file then each DIE have to store a pointer to the symbol file (or compile unit) it belongs to what is a significant memory overhead (we have more DIEs then Symbols) if we ever want to store all DIE in memory. Even worse is that we have to change all name to DIE index to contain a pointer (compile unit / dwo symbol file) and an offset to find the DIE belongs to (compared to just an offset now) what is more entry then the number DIEs. - In an average debug session run from an IDE the user usually sets the breakpoints based on file name + line number, display some stack traces, some variables and do some stepping. If we can index each dwo file separately then we can handle all of these features without parsing the full debug info what can give us some significant speed benefits at debugger startup time. Comment at: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:208-214 @@ -202,1 +207,9 @@ + +SymbolFileDWARFDwo* +GetDwoSymbolFile() +{ +// Extract the compile unit DIE as that one contains the dwo symbol file information +ExtractDIEsIfNeeded(true); +return m_dwo_symbol_file.get(); +} clayborg wrote: > Make protected and hide this from anyone but DWARFCompileUnit and > DWARFDebugInfoEntry. I don't really like friend classes and have the opinion that inside a plugin we can let the visibility a bit more open, but don't feel to strongly about it. I can change it if zou prefer that way. Comment at: source/Symbol/ObjectFile.cpp:604-625 @@ -603,15 +603,23 @@ SectionList * -ObjectFile::GetSectionList() +ObjectFile::GetSectionList(bool update_module_section_list) { if (m_sections_ap.get() == nullptr) { -ModuleSP module_sp(GetModule()); -if (module_sp) +if (update_module_section_list) { -lldb_private::Mutex::Locker locker(module_sp->GetMutex()); -CreateSections(*module_sp->GetUnifiedSectionList()); +ModuleSP module_sp(GetModule()); +if (module_sp) +{ +lldb_private::Mutex::Locker locker(module_sp->GetMutex()); +CreateSections(*module_sp->GetUnifiedSectionList()); +} +} +else +{ +SectionList unified_section_list; +CreateSections(unified_section_list); } } return m_sections_ap.get(); } clayborg wrote: > Can you explain why this is needed? We create all of the dwo object files with the same module what we used for the executable object file (belongs to them). Because of it we have several section with the same section name (several dwo file + object file) what can't be stored inside a single module. This check is to disable adding the sections in the dwo object file into the modules section list because they will be fetched by SymbolFileDWARFDwo::GetCachedSectionData what handles it correctly. http://reviews.llvm.org/D12291 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D12303: Fix for dotest.py ERRORs on OSX caused by svn rev.237053.
dawn created this revision. dawn added reviewers: ted, clayborg. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM. This fixes dotest.py on OSX after svn rev.237053. After that commit, running dotest.py on OSX would return nothing but ERRORs after running test test_disassemble_invalid_vst_1_64_raw_data (TestDisassemble_VST1_64.Disassemble_VST1_64), and the total tests dropped from 1324 to 850. See my comments in http://reviews.llvm.org/rL237053. Repository: rL LLVM http://reviews.llvm.org/D12303 Files: source/Target/TargetList.cpp Index: source/Target/TargetList.cpp === --- source/Target/TargetList.cpp +++ source/Target/TargetList.cpp @@ -291,27 +291,34 @@ } } -// If we have a valid architecture, make sure the current platform is -// compatible with that architecture -if (!prefer_platform_arch && arch.IsValid()) +if (!platform_sp) { -if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) +// Get the current platform. +platform_sp = debugger.GetPlatformList().GetSelectedPlatform(); +assert(platform_sp); + +// If we have a valid architecture, make sure the current platform is +// compatible with that architecture +if (!prefer_platform_arch && arch.IsValid()) { -platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch); -if (!is_dummy_target && platform_sp) -debugger.GetPlatformList().SetSelectedPlatform(platform_sp); +if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) +{ +platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch); +if (!is_dummy_target && platform_sp) + debugger.GetPlatformList().SetSelectedPlatform(platform_sp); +} } -} -else if (platform_arch.IsValid()) -{ -// if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with -// a single architecture which should be used -ArchSpec fixed_platform_arch; -if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch)) +else if (platform_arch.IsValid()) { -platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch); -if (!is_dummy_target && platform_sp) -debugger.GetPlatformList().SetSelectedPlatform(platform_sp); +// if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with +// a single architecture which should be used +ArchSpec fixed_platform_arch; +if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch)) +{ +platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch); +if (!is_dummy_target && platform_sp) + debugger.GetPlatformList().SetSelectedPlatform(platform_sp); +} } } Index: source/Target/TargetList.cpp === --- source/Target/TargetList.cpp +++ source/Target/TargetList.cpp @@ -291,27 +291,34 @@ } } -// If we have a valid architecture, make sure the current platform is -// compatible with that architecture -if (!prefer_platform_arch && arch.IsValid()) +if (!platform_sp) { -if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) +// Get the current platform. +platform_sp = debugger.GetPlatformList().GetSelectedPlatform(); +assert(platform_sp); + +// If we have a valid architecture, make sure the current platform is +// compatible with that architecture +if (!prefer_platform_arch && arch.IsValid()) { -platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch); -if (!is_dummy_target && platform_sp) -debugger.GetPlatformList().SetSelectedPlatform(platform_sp); +if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch)) +{ +platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch); +if (!is_dummy_target && platform_sp) +debugger.GetPlatformList().SetSelectedPlatform(platform_sp); +} } -} -else if (platform_arch.IsValid()) -{ -// if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with -// a single architecture which should be used -ArchSpec fixed_platform_arch; -if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch)) +else
Re: [Lldb-commits] [PATCH] D12303: Fix for dotest.py ERRORs on OSX caused by svn rev.237053.
ted added a comment. This is essentially reverting http://reviews.llvm.org/rL237053 , so we'd go back to the problem with it - LLDB won't be able to set the platform based on the architecture in the target binary, but will use the currently selected platform, even if it's not compatible. Line 131 has this: platform_sp = debugger.GetPlatformList().GetSelectedPlatform(); So platform_sp will always be true, unless LLDB doesn't have a current (or default host) platform. The code to check to see if the target arch and the platform are compatible will never be run. What error is causing the tests to fail? Repository: rL LLVM http://reviews.llvm.org/D12303 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12303: Fix for dotest.py ERRORs on OSX caused by svn rev.237053.
dawn added a comment. In http://reviews.llvm.org/D12303#231759, @ted wrote: > This is essentially reverting http://reviews.llvm.org/rL237053 , so we'd go > back to the problem with it - LLDB won't be able to set the platform based on > the architecture in the target binary, but will use the currently selected > platform, even if it's not compatible. Hmm. Looking at test test_disassemble_invalid_vst_1_64_raw_data, this appeared to be intentional since it does: target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "thumbv7") and expects the target arch to be set from that. There are a couple other tests which are setting the arch manually like this also. It's certainly possible that the test cases are wrong. Should I replace this patch with skips for those tests? > So platform_sp will always be true, unless LLDB doesn't have a current (or > default host) platform. Exactly. Again, this looked intentional. Hmm. > What error is causing the tests to fail? Please see my comment at http://reviews.llvm.org/rL237053. On OSX, all you see is ERROR and nothing else. Repository: rL LLVM http://reviews.llvm.org/D12303 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits