Fix a bug in linux core file handling

Summary:
There was a bug in linux core file handling, where if there was a running process with the same
process id as the id in the core file, the core file debugging would fail, as we would pull some
pieces of information (ProcessInfo structure) from the running process instead of the core file.
I fix this by routing the ProcessInfo requests through the Process class and overriding it in
ProcessElfCore to return correct data.

A (slightly convoluted) test is included.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D18697

llvm-svn: 265391
This commit is contained in:
Pavel Labath
2016-04-05 13:07:16 +00:00
parent d9d41f531e
commit a933d5179e
10 changed files with 106 additions and 10 deletions

View File

@@ -3422,7 +3422,7 @@ Process::CompleteAttach ()
else if (!process_arch.IsValid())
{
ProcessInstanceInfo process_info;
platform_sp->GetProcessInfo (GetID(), process_info);
GetProcessInfo(process_info);
const ArchSpec &process_arch = process_info.GetArchitecture();
if (process_arch.IsValid() && !GetTarget().GetArchitecture().IsExactMatch(process_arch))
{
@@ -6481,6 +6481,18 @@ Process::PrintWarningOptimization (const SymbolContext &sc)
}
}
bool
Process::GetProcessInfo(ProcessInstanceInfo &info)
{
info.Clear();
PlatformSP platform_sp = GetTarget().GetPlatform();
if (! platform_sp)
return false;
return platform_sp->GetProcessInfo(GetID(), info);
}
ThreadCollectionSP
Process::GetHistoryThreads(lldb::addr_t addr)
{