mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 11:39:35 +00:00
[lldb] Fix TestDyldExecLinux with xml enabled
NativeProcessLinux is not able to properly read libraries-svr4 data when running with ld.so as the "main" executable. Normally, this is not a big problem, as it returns an error message, and lldb can fallback to manual library loading. Unfortunately, lldb-server also does not clear cached svr4 data on exec, which means that it does *not* return an error when the application execs from the "regular" to the "ld.so" mode. Instead it returns incorrect data (it is missing the main executable) and causes TestDyldExecLinux to fail (but only when building with xml support enabled). This patch makes ensures that cached process data is cleared on exec, fixing the test. Since TestDyldExecLinux has shown to be sensitive to the way we read library info, I fork it into two (with svr4 enabled and disabled).
This commit is contained in:
parent
782e912246
commit
cf2c8e419d
@ -457,7 +457,7 @@ protected:
|
||||
///
|
||||
/// Provide a mechanism for a delegate to clear out any exec-
|
||||
/// sensitive data.
|
||||
void NotifyDidExec();
|
||||
virtual void NotifyDidExec();
|
||||
|
||||
NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid);
|
||||
|
||||
|
@ -322,6 +322,8 @@ void NativeProcessProtocol::NotifyDidExec() {
|
||||
Log *log = GetLog(LLDBLog::Process);
|
||||
LLDB_LOG(log, "process {0} exec()ed", GetID());
|
||||
|
||||
m_software_breakpoints.clear();
|
||||
|
||||
m_delegate.DidExec(this);
|
||||
}
|
||||
|
||||
|
@ -180,4 +180,9 @@ NativeProcessELF::GetLoadedSVR4Libraries() {
|
||||
return library_list;
|
||||
}
|
||||
|
||||
void NativeProcessELF::NotifyDidExec() {
|
||||
NativeProcessProtocol::NotifyDidExec();
|
||||
m_shared_library_info_addr.reset();
|
||||
}
|
||||
|
||||
} // namespace lldb_private
|
||||
|
@ -45,6 +45,8 @@ protected:
|
||||
llvm::Expected<SVR4LibraryInfo>
|
||||
ReadSVR4LibraryInfo(lldb::addr_t link_map_addr);
|
||||
|
||||
void NotifyDidExec() override;
|
||||
|
||||
std::unique_ptr<AuxVector> m_aux_vector;
|
||||
llvm::Optional<lldb::addr_t> m_shared_library_info_addr;
|
||||
};
|
||||
|
@ -12,11 +12,20 @@ from lldbsuite.test import lldbutil
|
||||
|
||||
class TestLinux64ExecViaDynamicLoader(TestBase):
|
||||
mydir = TestBase.compute_mydir(__file__)
|
||||
NO_DEBUG_INFO_TESTCASE = True
|
||||
|
||||
@skipIfXmlSupportMissing
|
||||
@skipIf(oslist=no_match(['linux']))
|
||||
def test_with_svr4(self):
|
||||
self.runCmd("settings set plugin.process.gdb-remote.use-libraries-svr4 true")
|
||||
self._test()
|
||||
|
||||
@skipIf(oslist=no_match(['linux']))
|
||||
@no_debug_info_test
|
||||
@skipIf(oslist=["linux"], archs=["arm"])
|
||||
def test(self):
|
||||
def test_without_svr4(self):
|
||||
self.runCmd("settings set plugin.process.gdb-remote.use-libraries-svr4 false")
|
||||
self._test()
|
||||
|
||||
def _test(self):
|
||||
self.build()
|
||||
|
||||
# Extracts path of the interpreter.
|
||||
|
Loading…
Reference in New Issue
Block a user