[all-commits] [llvm/llvm-project] 1f04d1: [lldb/test] Move `platform process list` tests to ...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Fri Feb 21 13:44:48 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1f04d1b7069bf6c513526f36b8c7327c8dec6604
      https://github.com/llvm/llvm-project/commit/1f04d1b7069bf6c513526f36b8c7327c8dec6604
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    R lldb/test/API/commands/platform/process/Makefile
    R lldb/test/API/commands/platform/process/TestProcessList.py
    A lldb/test/API/commands/platform/process/list/Makefile
    A lldb/test/API/commands/platform/process/list/TestProcessList.py
    A lldb/test/API/commands/platform/process/list/main.cpp
    R lldb/test/API/commands/platform/process/main.cpp

  Log Message:
  -----------
  [lldb/test] Move `platform process list` tests to its own directory (NFC)

Since the `platform process` commamnd has more tests now, this commits
separates each of the `platform process` subcommand's test in its own directory.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: d7c403e64043281b9c5883e3e034da5ebaf4985a
      https://github.com/llvm/llvm-project/commit/d7c403e64043281b9c5883e3e034da5ebaf4985a
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2020-02-21 (Fri, 21 Feb 2020)

  Changed paths:
    M lldb/bindings/interface/SBTarget.i
    M lldb/include/lldb/API/SBTarget.h
    M lldb/include/lldb/Target/Platform.h
    M lldb/include/lldb/Target/Process.h
    M lldb/source/API/SBTarget.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Commands/Options.td
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    M lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
    A lldb/test/API/functionalities/process_crash_info/Makefile
    A lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py
    A lldb/test/API/functionalities/process_crash_info/main.c

  Log Message:
  -----------
  [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 at gmail.com>


Compare: https://github.com/llvm/llvm-project/compare/dc046c70de96...d7c403e64043


More information about the All-commits mailing list