[trace] Avoid a crash in the dumper when disassembling fails
authorWalter Erquinigo <wallace@fb.com>
Tue, 12 Jul 2022 19:41:30 +0000 (12:41 -0700)
committerWalter Erquinigo <wallace@fb.com>
Tue, 12 Jul 2022 23:23:03 +0000 (16:23 -0700)
commitdbc0cb0198129fbded7ff3be5d080cd12ad91783
tree48affbb2a5aca9bb12e16e354af93534eaa2da7d
parentad7bcda9402d4473c12461a76a2bc27a600a8001
[trace] Avoid a crash in the dumper when disassembling fails

In rare situations, disassemblying would fail that produce an invalid
InstructionSP object. We need to check that it's valid before using.

With this change, now the dumper doesn't crash with dumping instructions of
ioctl. In fact, it now dumps this output

 {
    "id": 6135,
    "loadAddress": "0x7f4bfe5c7515",
    "module": "libc.so.6",
    "symbol": "ioctl",
    "source": "glibc/2.34/src/glibc-2.34/sysdeps/unix/syscall-template.S",
    "line": 120,
    "column": 0
 }

Anyway, we need to investigate why the diassembler failed disassembling that
instruction. From over 2B instructions I was disassembling today, just this
one failed, so this could be a bug in LLVM's core disassembler.

Differential Revision: https://reviews.llvm.org/D129588
lldb/source/Target/TraceDumper.cpp