Skip to content

Commit

Permalink
Revert "[lldb] Add support for debugging via the dynamic linker."
Browse files Browse the repository at this point in the history
This reverts commit 1cbdc07.

Buildbot failure started after this patch with failure in
api/multithreaded/TestMultithreaded.py:
https://lab.llvm.org/buildbot/#/builders/68/builds/17556
  • Loading branch information
rdhindsa14 committed Aug 24, 2021
1 parent 88125e8 commit 120d97b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 142 deletions.
30 changes: 0 additions & 30 deletions lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
Expand Up @@ -56,19 +56,6 @@ static addr_t ResolveRendezvousAddress(Process *process) {
"%s resolved via direct object file approach to 0x%" PRIx64,
__FUNCTION__, info_location);
} else {
const Symbol *_r_debug =
target->GetExecutableModule()->FindFirstSymbolWithNameAndType(
ConstString("_r_debug"));
if (_r_debug) {
info_addr = _r_debug->GetAddress().GetLoadAddress(target);
if (info_addr != LLDB_INVALID_ADDRESS) {
LLDB_LOGF(log,
"%s resolved by finding symbol '_r_debug' whose value is "
"0x%" PRIx64,
__FUNCTION__, info_addr);
return info_addr;
}
}
LLDB_LOGF(log,
"%s FAILED - direct object file approach did not yield a "
"valid address",
Expand Down Expand Up @@ -289,14 +276,6 @@ bool DYLDRendezvous::FillSOEntryFromModuleInfo(
entry.base_addr = base_addr;
entry.dyn_addr = dyn_addr;

// ld.so saves empty file name for the executable file in the link map.
// When executable is run using ld.so, we need to be update executable path.
if (name.empty()) {
MemoryRegionInfo region;
Status region_status =
m_process->GetMemoryRegionInfo(entry.dyn_addr, region);
name = region.GetName().AsCString();
}
entry.file_spec.SetFile(name, FileSpec::Style::native);

UpdateBaseAddrIfNecessary(entry, name);
Expand Down Expand Up @@ -568,15 +547,6 @@ bool DYLDRendezvous::ReadSOEntryFromMemory(lldb::addr_t addr, SOEntry &entry) {
return false;

std::string file_path = ReadStringFromMemory(entry.path_addr);

// ld.so saves empty file name for the executable file in the link map.
// When executable is run using ld.so, we need to be update executable path.
if (file_path.empty()) {
MemoryRegionInfo region;
Status region_status =
m_process->GetMemoryRegionInfo(entry.dyn_addr, region);
file_path = region.GetName().AsCString();
}
entry.file_spec.SetFile(file_path, FileSpec::Style::native);

UpdateBaseAddrIfNecessary(entry, file_path);
Expand Down
Expand Up @@ -333,48 +333,28 @@ bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() {
LLDB_LOG(log, "Rendezvous structure is not set up yet. "
"Trying to locate rendezvous breakpoint in the interpreter "
"by symbol name.");
// Function names from different dynamic loaders that are known to be
// used as rendezvous between the loader and debuggers.
ModuleSP interpreter = LoadInterpreterModule();
if (!interpreter) {
LLDB_LOG(log, "Can't find interpreter, rendezvous breakpoint isn't set.");
return false;
}

// Function names from different dynamic loaders that are known to be used
// as rendezvous between the loader and debuggers.
static std::vector<std::string> DebugStateCandidates{
"_dl_debug_state", "rtld_db_dlactivity", "__dl_rtld_db_dlactivity",
"r_debug_state", "_r_debug_state", "_rtld_debug_state",
};

ModuleSP interpreter = LoadInterpreterModule();
if (!interpreter) {
if (NameMatches(m_process->GetTarget()
.GetExecutableModulePointer()
->GetFileSpec()
.GetFilename()
.GetCString(),
NameMatch::StartsWith, "ld-")) {
FileSpecList containingModules;
containingModules.Append(
m_process->GetTarget().GetExecutableModulePointer()->GetFileSpec());

dyld_break = target.CreateBreakpoint(
&containingModules, /*containingSourceFiles=*/nullptr,
DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC,
/*offset=*/0,
/*skip_prologue=*/eLazyBoolNo,
/*internal=*/true,
/*request_hardware=*/false);
} else {
LLDB_LOG(log,
"Can't find interpreter, rendezvous breakpoint isn't set.");
return false;
}
} else {
FileSpecList containingModules;
containingModules.Append(interpreter->GetFileSpec());
dyld_break = target.CreateBreakpoint(
&containingModules, /*containingSourceFiles=*/nullptr,
DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC,
/*offset=*/0,
/*skip_prologue=*/eLazyBoolNo,
/*internal=*/true,
/*request_hardware=*/false);
}
FileSpecList containingModules;
containingModules.Append(interpreter->GetFileSpec());
dyld_break = target.CreateBreakpoint(
&containingModules, nullptr /* containingSourceFiles */,
DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC,
0, /* offset */
eLazyBoolNo, /* skip_prologue */
true, /* internal */
false /* request_hardware */);
}

if (dyld_break->GetNumResolvedLocations() != 1) {
Expand Down
15 changes: 0 additions & 15 deletions lldb/test/API/functionalities/dyld-launch-linux/Makefile

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions lldb/test/API/functionalities/dyld-launch-linux/main.cpp

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 120d97b

Please sign in to comment.