[all-commits] [llvm/llvm-project] ad7bcd: [trace] Add a flag to the decoder to output the in...
walter erquinigo via All-commits
all-commits at lists.llvm.org
Tue Jul 12 16:23:23 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ad7bcda9402d4473c12461a76a2bc27a600a8001
https://github.com/llvm/llvm-project/commit/ad7bcda9402d4473c12461a76a2bc27a600a8001
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-07-12 (Tue, 12 Jul 2022)
Changed paths:
M lldb/include/lldb/Core/Disassembler.h
M lldb/include/lldb/Target/TraceDumper.h
M lldb/include/lldb/lldb-enumerations.h
M lldb/source/API/SBInstruction.cpp
M lldb/source/API/SBInstructionList.cpp
M lldb/source/Commands/CommandObjectDisassemble.cpp
M lldb/source/Commands/CommandObjectDisassemble.h
M lldb/source/Commands/CommandObjectThread.cpp
M lldb/source/Commands/Options.td
M lldb/source/Core/Disassembler.cpp
M lldb/source/Core/DumpDataExtractor.cpp
M lldb/source/Expression/IRExecutionUnit.cpp
M lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
M lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
M lldb/source/Symbol/Function.cpp
M lldb/source/Symbol/Symbol.cpp
M lldb/source/Target/ThreadPlanTracer.cpp
M lldb/source/Target/TraceDumper.cpp
A lldb/unittests/Disassembler/ARM/CMakeLists.txt
A lldb/unittests/Disassembler/ARM/TestArm64Disassembly.cpp
A lldb/unittests/Disassembler/ARM/TestArmv7Disassembly.cpp
M lldb/unittests/Disassembler/CMakeLists.txt
R lldb/unittests/Disassembler/TestArm64Disassembly.cpp
R lldb/unittests/Disassembler/TestArmv7Disassembly.cpp
A lldb/unittests/Disassembler/x86/CMakeLists.txt
A lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp
Log Message:
-----------
[trace] Add a flag to the decoder to output the instruction type
To build complex binding upon instruction trace, additional metadata 'instruction type' is needed.
This diff has followings:
- Add a flag -k / --kind for instruction dump
- Remove SetGranularity and SetIgnoreErros from Trace cursor
Sample output:
```
(lldb) thread trace dump instruction -k
thread #1: tid = 3198805
libc.so.6`_IO_puts + 356
2107: 0x00007ffff7163594 ( return) retq
2106: 0x00007ffff7163592 ( other) popq %r13
2105: 0x00007ffff7163590 ( other) popq %r12
2104: 0x00007ffff716358f ( other) popq %rbp
2103: 0x00007ffff716358e ( other) popq %rbx
2102: 0x00007ffff716358c ( other) movl %ebx, %eax
2101: 0x00007ffff7163588 ( other) addq $0x8, %rsp
2100: 0x00007ffff7163570 ( cond jump) je 0x89588 ; <+344>
2099: 0x00007ffff716356e ( other) decl (%rdx)
2098: 0x00007ffff7163565 ( cond jump) je 0x8956e ; <+318>
2097: 0x00007ffff716355e ( other) cmpl $0x0, 0x33c02b(%rip) ; __libc_multiple_threads
2096: 0x00007ffff7163556 ( other) movq $0x0, 0x8(%rdx)
2095: 0x00007ffff7163554 ( cond jump) jne 0x89588 ; <+344>
2094: 0x00007ffff7163550 ( other) subl $0x1, 0x4(%rdx)
2093: 0x00007ffff7163549 ( other) movq 0x88(%rbp), %rdx
2092: 0x00007ffff7163547 ( cond jump) jne 0x89588 ; <+344>
2091: 0x00007ffff7163540 ( other) testl $0x8000, (%rbp) ; imm = 0x8000
2090: 0x00007ffff716353c ( other) cmovaq %rax, %rbx
2089: 0x00007ffff7163535 ( other) cmpq $0x7fffffff, %rbx ; imm = 0x7FFFFFFF
2088: 0x00007ffff7163530 ( other) movl $0x7fffffff, %eax ; imm = 0x7FFFFFFF
```
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D128477
Commit: dbc0cb0198129fbded7ff3be5d080cd12ad91783
https://github.com/llvm/llvm-project/commit/dbc0cb0198129fbded7ff3be5d080cd12ad91783
Author: Walter Erquinigo <wallace at fb.com>
Date: 2022-07-12 (Tue, 12 Jul 2022)
Changed paths:
M lldb/source/Target/TraceDumper.cpp
Log Message:
-----------
[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
Compare: https://github.com/llvm/llvm-project/compare/5f8cefebd900...dbc0cb019812
More information about the All-commits
mailing list