[Lldb-commits] [PATCH] D70238: [lldb] Allow loading of minidumps with no process id

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 14 05:49:13 PST 2019


labath created this revision.
labath added reviewers: jingham, clayborg.
Herald added a project: LLDB.
labath added a comment.

Note: I am certain that there will be things which will fail for these kinds of "processes" -- there's plenty of `!= LLDB_INVALID_PID` checks, but most of them seem to be on the launch/attach code paths which are not exercised here. I am fine with fixing these as they are discovered -- the bigger question here is whether this is a reasonable direction to take lldb in. I think it is, because most of the `!= LLDB_INVALID_PID` checks look like they could be replaced by a check of the process state.


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)

At first I wanted to do something similar to what the gdb-remote plugin
does when talking to bare metal gdb stubs and like, and "invent" a
process ID in this case. However, then I noticed that most of the things
"just work" even if I leave the proces ID as "invalid".

Since it seems we have multiple use cases for a "process" without a
"process id", what I do in this patch instead is "downgrade" the missing
pid case to a warning. I also changes the "process status" output to
better handle the case of a missing/unknown pid.

The test case in this patch verifies that basic functionality still
works even with a pid-less minidump.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70238

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/source/Target/Process.cpp
  lldb/test/Shell/Minidump/no-process-id.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70238.229290.patch
Type: text/x-patch
Size: 5903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191114/629a3299/attachment.bin>


More information about the lldb-commits mailing list