llvm-project/lldb
Med Ismail Bennani d7c403e640 [lldb/Plugins] Add ability to fetch crash information on crashed processes
Currently, in macOS, when a process crashes, lldb halts inside the
implementation disassembly without yielding any useful information.
The only way to get more information is to detach from the process, then wait
for ReportCrash to generate a report, find the report, then see what error
message was included in it. Instead of waiting for this to happen, lldb could
locate the error_string and make it available to the user.

This patch addresses this issue by enabling the user to fetch extended
crash information for crashed processes using `process status --verbose`.

Depending on the platform, this will try to gather different crash information
into an structured data dictionnary. This dictionnary is generic and extensible,
as it contains an array for each different type of crash information.

On Darwin Platforms, lldb will iterate over each of the target's images,
extract their `__crash_info` section and generated a StructuredData::Array
containing, in each entry, the module spec, its UUID, the crash messages
and the abort cause. The array will be inserted into the platform's
`m_extended_crash_info` dictionnary and `FetchExtendedCrashInformation` will
return its JSON representation like this:

```
{
  "crash-info annotations": [
    {
      "abort-cause": 0,
      "image": "/usr/lib/system/libsystem_malloc.dylib",
      "message": "main(76483,0x1000cedc0) malloc: *** error for object 0x1003040a0: pointer being freed was not allocated",
      "message2": "",
      "uuid": "5747D0C9-900D-3306-8D70-1E2EA4B7E821"
    },
    ...
  ],
  ...
}
```

This crash information can also be fetched using the SB API or lldb-rpc protocol
using SBTarget::GetExtendedCrashInformation().

rdar://37736535

Differential Revision: https://reviews.llvm.org/D74657

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-02-21 22:44:36 +01:00
..
bindings [lldb/Plugins] Add ability to fetch crash information on crashed processes 2020-02-21 22:44:36 +01:00
cmake Allow customized relative PYTHONHOME 2020-02-21 12:49:10 -08:00
docs [lldb]: fix typo in lldb-gdb-remote.txt 2020-02-20 14:30:12 +01:00
examples [lldb] Make gdbremote.py utility py2and3 compatible 2020-02-13 09:18:55 +01:00
include/lldb [lldb/Plugins] Add ability to fetch crash information on crashed processes 2020-02-21 22:44:36 +01:00
packages/Python/lldbsuite Add target.xml support for qXfer request. 2020-02-20 23:03:54 +05:00
resources [CMake] Revised LLDB.framework builds 2019-01-04 12:46:50 +00:00
scripts [lldb/Scripts] Remove swig_bot_lib/__init__.py 2020-01-16 09:15:41 -08:00
source [lldb/Plugins] Add ability to fetch crash information on crashed processes 2020-02-21 22:44:36 +01:00
test [lldb/Plugins] Add ability to fetch crash information on crashed processes 2020-02-21 22:44:36 +01:00
third_party/Python/module Increase timeout in pexpect to lower chances of tests failing under ASAN. 2019-10-10 16:16:49 +00:00
tools [lldb-vscode] Use libOption with tablegen to parse command line options. 2020-02-21 08:15:06 -08:00
unittests [lldb][NFC] Fix compilation of SymbolFilePDBTests.cpp after FindNamespace API change 2020-02-18 11:25:12 +01:00
utils [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
.arcconfig
.clang-format
.gitignore Add .noindex to the gitignore 2019-04-05 17:57:42 +00:00
CMakeLists.txt [lldb/Cmake] Add a CMakeLists.txt to the utils directory... 2020-01-16 22:31:01 -08:00
CODE_OWNERS.txt [lldb][NFC] Cleanup mentions and code related to lldb-mi 2019-07-19 15:55:23 +00:00
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
use_lldb_suite_root.py