Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h =================================================================== --- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -88,6 +88,10 @@ /// Rendezvous breakpoint. lldb::break_id_t m_dyld_bid; + /// Contains AT_SYSINFO_EHDR, which means a vDSO has been + /// mapped to the address space + lldb::addr_t m_vdso_base; + /// Loaded module list. (link map for each module) std::map> m_loaded_modules; @@ -159,6 +163,11 @@ lldb::addr_t GetEntryPoint(); + /// Evaluate if Aux vectors contain vDSO information + /// in case they do, read and assign the address to m_vdso_base + void + EvalVdsoStatus(); + /// Loads Module from inferior process. void ResolveExecutableModule(lldb::ModuleSP &module_sp); Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -91,7 +91,8 @@ m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS), m_auxv(), - m_dyld_bid(LLDB_INVALID_BREAK_ID) + m_dyld_bid(LLDB_INVALID_BREAK_ID), + m_vdso_base(LLDB_INVALID_ADDRESS) { } @@ -126,6 +127,8 @@ if (log) log->Printf ("DynamicLoaderPOSIXDYLD::%s pid %" PRIu64 " executable '%s', load_offset 0x%" PRIx64, __FUNCTION__, m_process ? m_process->GetID () : LLDB_INVALID_PROCESS_ID, executable_sp ? executable_sp->GetFileSpec().GetPath().c_str () : "", load_offset); + EvalVdsoStatus(); + // if we dont have a load address we cant re-base bool rebase_exec = (load_offset == LLDB_INVALID_ADDRESS) ? false : true; @@ -213,6 +216,7 @@ executable = GetTargetExecutable(); load_offset = ComputeLoadOffset(); + EvalVdsoStatus(); if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { @@ -503,7 +507,15 @@ // that ourselves here. ModuleSP executable = GetTargetExecutable(); m_loaded_modules[executable] = m_rendezvous.GetLinkMapAddress(); - + if (m_vdso_base != LLDB_INVALID_ADDRESS) + { + FileSpec file_spec("[vdso]", false); + ModuleSP module_sp = LoadModuleAtAddress(file_spec, LLDB_INVALID_ADDRESS, m_vdso_base, false); + if (module_sp.get()) + { + module_list.Append(module_sp); + } + } for (I = m_rendezvous.begin(), E = m_rendezvous.end(); I != E; ++I) { ModuleSP module_sp = LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true); @@ -551,6 +563,16 @@ return m_load_offset; } +void +DynamicLoaderPOSIXDYLD::EvalVdsoStatus() +{ + AuxVector::iterator I = m_auxv->FindEntry(AuxVector::AT_SYSINFO_EHDR); + + if (I != m_auxv->end()) + m_vdso_base = I->value; + +} + addr_t DynamicLoaderPOSIXDYLD::GetEntryPoint() { Index: test/functionalities/inferior-assert/TestInferiorAssert.py =================================================================== --- test/functionalities/inferior-assert/TestInferiorAssert.py +++ test/functionalities/inferior-assert/TestInferiorAssert.py @@ -12,7 +12,6 @@ mydir = TestBase.compute_mydir(__file__) - @expectedFailurei386("llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly") @expectedFailureWindows("llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") def test_inferior_asserting(self): """Test that lldb reliably catches the inferior asserting (command).""" @@ -26,7 +25,6 @@ self.build() self.inferior_asserting_registers() - @expectedFailurei386("llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly") @expectedFailureWindows("llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") def test_inferior_asserting_disassemble(self): """Test that lldb reliably disassembles frames after asserting (command).""" @@ -40,14 +38,12 @@ self.build() self.inferior_asserting_python() - @expectedFailurei386('llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly') @expectedFailureWindows("llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") def test_inferior_asserting_expr(self): """Test that the lldb expression interpreter can read from the inferior after asserting (command).""" self.build() self.inferior_asserting_expr() - @expectedFailurei386("llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly") @expectedFailureWindows("llvm.org/pr21793: need to implement support for detecting assertion / abort on Windows") def test_inferior_asserting_step(self): """Test that lldb functions correctly after stepping through a call to assert().""" @@ -146,6 +142,12 @@ thread = process.GetThreadAtIndex(0) self.assertTrue(thread.IsValid(), "current thread is valid") + lastframeID = thread.GetFrameAtIndex(thread.GetNumFrames() - 1).GetFrameID() + + isi386Arch = False + if "i386" in self.getArchitecture(): + isi386Arch = True + # lldb should be able to disassemble frames from the inferior after asserting. for frame in thread: self.assertTrue(frame.IsValid(), "current frame is valid") @@ -160,6 +162,9 @@ pc_backup_offset = 1 if frame.GetFrameID() == 0: pc_backup_offset = 0 + if isi386Arch == True: + if lastframeID == frame.GetFrameID(): + pc_backup_offset = 0 self.expect("disassemble -a %s" % (frame.GetPC() - pc_backup_offset), substrs = ['<+0>: ']) Index: test/python_api/hello_world/TestHelloWorld.py =================================================================== --- test/python_api/hello_world/TestHelloWorld.py +++ test/python_api/hello_world/TestHelloWorld.py @@ -73,7 +73,6 @@ self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE) @add_test_categories(['pyapi']) - @expectedFailurei386 # llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly @expectedFailureWindows("llvm.org/pr24600") def test_with_attach_to_process_with_id_api(self): """Create target, spawn a process, and attach to it with process id.""" @@ -102,7 +101,6 @@ '(int)argc=3']) @add_test_categories(['pyapi']) - @expectedFailurei386 # llvm.org/pr17384: lldb needs to be aware of linux-vdso.so to unwind stacks properly @expectedFailureWindows("llvm.org/pr24600") def test_with_attach_to_process_with_name_api(self): """Create target, spawn a process, and attach to it with process name."""