Skip to content

Commit 6feab48

Browse files
committed
Fix test case when we have a processminidump created placeholder main executable
1 parent f3b01d7 commit 6feab48

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

lldb/source/Core/DynamicLoader.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ ModuleSP DynamicLoader::GetTargetExecutable() {
8383
ModuleSpec module_spec(executable->GetFileSpec(),
8484
executable->GetArchitecture());
8585
auto module_sp = std::make_shared<Module>(module_spec);
86-
86+
// If we're a coredump and we already have a main executable, we don't
87+
// need to reload the module list that target already has
88+
if (!m_process->IsLiveDebugSession()) {
89+
return executable;
90+
}
8791
// Check if the executable has changed and set it to the target
8892
// executable if they differ.
8993
if (module_sp && module_sp->GetUUID().IsValid() &&
@@ -369,4 +373,3 @@ void DynamicLoader::LoadOperatingSystemPlugin(bool flush)
369373
if (m_process)
370374
m_process->LoadOperatingSystemPlugin(flush);
371375
}
372-

lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() {
298298
"Rendezvous breakpoint breakpoint id {0} for pid {1}"
299299
"is already set.",
300300
m_dyld_bid,
301+
m_process ? m_process->GetID() : LLDB_INVALID_PROCESS_ID);
301302
return true;
302303
}
303304

lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "lldb/Target/SectionLoadList.h"
2828
#include "lldb/Target/Target.h"
2929
#include "lldb/Target/UnixSignals.h"
30+
#include "lldb/Utility/DataBufferHeap.h"
3031
#include "lldb/Utility/LLDBAssert.h"
3132
#include "lldb/Utility/LLDBLog.h"
3233
#include "lldb/Utility/Log.h"
@@ -335,14 +336,6 @@ ArchSpec ProcessMinidump::GetArchitecture() {
335336
return ArchSpec(triple);
336337
}
337338

338-
DynamicLoader *ProcessMinidump::GetDynamicLoader() {
339-
if (m_dyld_up.get() == nullptr
340-
&& GetArchitecture().GetTriple().isOSLinux())
341-
m_dyld_up.reset(DynamicLoader::FindPlugin(
342-
this, DynamicLoaderPOSIXDYLD::GetPluginNameStatic()));
343-
return m_dyld_up.get();
344-
}
345-
346339
DataExtractor ProcessMinidump::GetAuxvData() {
347340
std::optional<llvm::ArrayRef<uint8_t>> auxv =
348341
m_minidump_parser->GetStream(StreamType::LinuxAuxv);
@@ -482,7 +475,6 @@ ModuleSP ProcessMinidump::GetOrCreateModule(UUID minidump_uuid,
482475
void ProcessMinidump::ReadModuleList() {
483476
std::vector<const minidump::Module *> filtered_modules =
484477
m_minidump_parser->GetFilteredModuleList();
485-
486478
Log *log = GetLog(LLDBLog::DynamicLoader);
487479

488480
for (auto module : filtered_modules) {
@@ -551,9 +543,13 @@ void ProcessMinidump::ReadModuleList() {
551543
"Unable to locate the matching object file, creating a "
552544
"placeholder module for: {0}",
553545
name);
554-
555546
module_sp = Module::CreateModuleFromObjectFile<ObjectFilePlaceholder>(
556547
module_spec, load_addr, load_size);
548+
// If we haven't loaded a main executable yet, set the first module to be
549+
// main executable
550+
if (!GetTarget().GetExecutableModule())
551+
GetTarget().SetExecutableModule(module_sp);
552+
else
557553
GetTarget().GetImages().Append(module_sp, true /* notify */);
558554
}
559555

lldb/source/Plugins/Process/minidump/ProcessMinidump.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ class ProcessMinidump : public PostMortemProcess {
5656
// Returns AUXV structure found in the core file
5757
lldb_private::DataExtractor GetAuxvData() override;
5858

59-
DynamicLoader *GetDynamicLoader() override;
60-
6159
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
6260

6361
Status DoDestroy() override;

0 commit comments

Comments
 (0)