[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action

Explicitly consider the libraries reported on the initial eTakeSnapshot
action added, through adding them to the added soentry list
in DYLDRendezvous::SaveSOEntriesFromRemote().  This is necessary
on FreeBSD since the dynamic loader issues only a single 'consistent'
state rendezvous breakpoint hit for all the libraries present
in DT_NEEDED (while Linux issues an added-consistent event pair).

Reenable memory maps on FreeBSD since this fixed the issue triggered
by them.

Differential Revision: https://reviews.llvm.org/D92187
This commit is contained in:
Michał Górny
2020-12-04 18:56:46 +01:00
parent 1a1cc0ba7d
commit 09b08833f3
8 changed files with 9 additions and 13 deletions

View File

@@ -295,8 +295,15 @@ bool DYLDRendezvous::SaveSOEntriesFromRemote(
return false;
// Only add shared libraries and not the executable.
if (!SOEntryIsMainExecutable(entry))
if (!SOEntryIsMainExecutable(entry)) {
m_soentries.push_back(entry);
// This function is called only once, at the very beginning
// of the program. Make sure to add all soentries that are
// already present at this point. This is necessary to cover
// DT_NEEDED on FreeBSD since (unlike Linux) it does not report
// loading these libraries separately.
m_added_soentries.push_back(entry);
}
}
m_loaded_modules = module_list;

View File

@@ -485,9 +485,6 @@ Status NativeProcessFreeBSD::Kill() {
Status NativeProcessFreeBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,
MemoryRegionInfo &range_info) {
// TODO: figure out why it breaks stuff
return Status("currently breaks determining module list");
if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
// We're done.
return Status("unsupported");

View File

@@ -31,7 +31,6 @@ class SBBreakpointCallbackCase(TestBase):
@skipIfNoSBHeaders
# clang-cl does not support throw or catch (llvm.org/pr24538)
@skipIfWindows
@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr48370')
def test_python_stop_hook(self):
"""Test that you can run a python command in a stop-hook when stdin is File based. """
self.build_and_test('driver.cpp test_stop-hook.cpp',

View File

@@ -15,7 +15,6 @@ class TestBreakpointInGlobalConstructors(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
@expectedFailureAll(oslist=["freebsd"], bugnumber='llvm.org/pr48373')
@expectedFailureNetBSD
def test(self):
self.build()

View File

@@ -23,7 +23,6 @@ class MemoryCommandRegion(TestBase):
'main.cpp',
'// Run here before printing memory regions')
@expectedFailureAll(oslist=["freebsd"])
def test(self):
self.build()

View File

@@ -843,7 +843,6 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.qMemoryRegionInfo_is_supported()
@llgs_test
@expectedFailureAll(oslist=["freebsd"])
def test_qMemoryRegionInfo_is_supported_llgs(self):
self.init_llgs_test()
self.build()
@@ -908,7 +907,6 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.qMemoryRegionInfo_reports_code_address_as_executable()
@skipIfWindows # No pty support to test any inferior output
@expectedFailureAll(oslist=["freebsd"])
@llgs_test
def test_qMemoryRegionInfo_reports_code_address_as_executable_llgs(self):
self.init_llgs_test()
@@ -975,7 +973,6 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.qMemoryRegionInfo_reports_stack_address_as_readable_writeable()
@skipIfWindows # No pty support to test any inferior output
@expectedFailureAll(oslist=["freebsd"])
@llgs_test
def test_qMemoryRegionInfo_reports_stack_address_as_readable_writeable_llgs(
self):
@@ -1042,7 +1039,6 @@ class LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
self.qMemoryRegionInfo_reports_heap_address_as_readable_writeable()
@skipIfWindows # No pty support to test any inferior output
@expectedFailureAll(oslist=["freebsd"])
@llgs_test
def test_qMemoryRegionInfo_reports_heap_address_as_readable_writeable_llgs(
self):

View File

@@ -120,7 +120,7 @@ class TestGdbRemoteLibrariesSvr4Support(gdbremote_testcase.GdbRemoteTestCaseBase
@llgs_test
@skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
@expectedFailureAll(oslist=["freebsd", "netbsd"])
@expectedFailureNetBSD
def test_libraries_svr4_load_addr(self):
self.setup_test()
self.libraries_svr4_has_correct_load_addr()

View File

@@ -3,7 +3,6 @@
# REQUIRES: target-x86_64
# UNSUPPORTED: system-windows
# XFAIL: system-freebsd
# RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp %p/Inputs/thread-step-out-ret-addr-check.s -o %t
# RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s