Author: Pavel Labath Date: 2020-01-20T13:08:58+01:00 New Revision: 468ca490c6030462066f8e731902d81bab11c356
URL: https://github.com/llvm/llvm-project/commit/468ca490c6030462066f8e731902d81bab11c356 DIFF: https://github.com/llvm/llvm-project/commit/468ca490c6030462066f8e731902d81bab11c356.diff LOG: [lldb] Allow loading of minidumps with no process id Summary: Normally, on linux we retrieve the process ID from the LinuxProcStatus stream (which is just the contents of /proc/%d/status pseudo-file). However, this stream is not strictly required (it's a breakpad extension), and we are encountering a fair amount of minidumps which do not have it present. It's not clear whether this is the case with all these minidumps, but the two known situations where this stream can be missing are: - /proc filesystem not mounted (or something to that effect) - process crashing after exhausting (almost) all file descriptors (so the minidump writer may not be able to open the /proc file) Since this is a corner case which will become less and less relevant (crashpad-generated minidumps should not suffer from this problem), I work around this problem by hardcoding the PID to 1 in these cases. The same thing is done by the gdb plugin when talking to a stub which does not report a process id (e.g. a hardware probe). Reviewers: jingham, clayborg Subscribers: markmentovai, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70238 Added: lldb/test/Shell/Minidump/no-process-id.yaml Modified: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 5c090dc6e12f..895ebb11e1f7 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -226,8 +226,10 @@ Status ProcessMinidump::DoLoadCore() { llvm::Optional<lldb::pid_t> pid = m_minidump_parser->GetPid(); if (!pid) { - error.SetErrorString("failed to parse PID"); - return error; + GetTarget().GetDebugger().GetAsyncErrorStream()->PutCString( + "Unable to retrieve process ID from minidump file, setting process ID " + "to 1.\n"); + pid = 1; } SetID(pid.getValue()); diff --git a/lldb/test/Shell/Minidump/no-process-id.yaml b/lldb/test/Shell/Minidump/no-process-id.yaml new file mode 100644 index 000000000000..3dd666a5aa1a --- /dev/null +++ b/lldb/test/Shell/Minidump/no-process-id.yaml @@ -0,0 +1,38 @@ +# RUN: yaml2obj %s > %t +# RUN: %lldb -c %t -o "thread list" -o "register read" -b 2>&1 | FileCheck %s + +# CHECK: (lldb) target create --core +# CHECK: Unable to retrieve process ID from minidump file, setting process ID to 1. +# CHECK: Core file {{.*}} was loaded. + +# CHECK: (lldb) thread list +# CHECK: Process 1 stopped +# CHECK: * thread #1: tid = 16001, 0x0000000000401dc6 a.out + +# CHECK: (lldb) register read +# CHECK: rsp = 0x00007ffceb34a210 + +--- !minidump +Streams: + - Type: ThreadList + Threads: + - Thread Id: 0x00003E81 + Context: 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000B0010000000000033000000000000000000000006020100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000010A234EBFC7F000010A234EBFC7F00000000000000000000F09C34EBFC7F0000C0A91ABCE97F00000000000000000000A0163FBCE97F00004602000000000000921C40000000000030A434EBFC7F000000000000000000000000000000000000C61D4000000000007F0300000000000000000000000000000000000000000000801F0000FFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFF00FFFFFFFFFFFFFF00FFFFFFFF25252525252525252525252525252525000000000000000000000000000000000000000000000000000000000000000000FFFF00FFFFFFFFFFFFFF00FFFFFFFF0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + Stack: + Start of Memory Range: 0x00007FFCEB34A000 + Content: '' + - Type: ModuleList + Modules: + - Base of Image: 0x0000000000400000 + Size of Image: 0x00017000 + Module Name: 'a.out' + CodeView Record: '' + - Type: SystemInfo + Processor Arch: AMD64 + Platform ID: Linux + CSD Version: 'Linux 3.13' + CPU: + Vendor ID: GenuineIntel + Version Info: 0x00000000 + Feature Info: 0x00000000 +... _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits