[Lldb-commits] [PATCH] D128477: [trace] Add a flag to the decoder to output the instruction type

Sujin Park via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 28 16:36:08 PDT 2022


persona0220 updated this revision to Diff 440806.
persona0220 added a comment.
Herald added subscribers: Michael137, MaskRay.

This new diff attach additional metadata 'control flow kind' for instruction.
Add '-k / --kind' flag for both `disassemble` and `thread trace dump` command.

Thanks to @jingham for the suggestion!

Sample output:

  (lldb) disas -k
  a.out`main:
      0x4005b6 <+0>:  other     pushq  %rbp
      0x4005b7 <+1>:  other     movq   %rsp, %rbp
      0x4005ba <+4>:  other     movl   $0x400668, %edi           ; imm = 0x400668
      0x4005bf <+9>:  call      callq  0x4004c0                  ; symbol stub for: puts
  ->  0x4005c4 <+14>: other     movl   $0x0, %eax
      0x4005c9 <+19>: other     popq   %rbp
      0x4005ca <+20>: return    retq
  
  (lldb) thread trace dump instruction --kind
      thread #1: tid = 1893259
    libc.so.6`write + 30
      2027: 0x00007ffff71fa86e    cond jump ja     0x1208c8                  ; <+120>
      2026: 0x00007ffff71fa868    other     cmpq   $-0x1000, %rax            ; imm = 0xF000
      2025: 0x00007ffff71fa866    far call  syscall
      2024: 0x00007ffff71fa861    other     movl   $0x1, %eax
      2023: 0x00007ffff71fa85f    cond jump jne    0x120878                  ; <+40>
      2022: 0x00007ffff71fa85d    other     testl  %eax, %eax
      2021: 0x00007ffff71fa85b    other     movl   (%rax), %eax
      2020: 0x00007ffff71fa854    other     leaq   0x2a4d35(%rip), %rax      ; __libc_multiple_threads
      2019: 0x00007ffff71fa850    other     endbr64


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128477/new/

https://reviews.llvm.org/D128477

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/Driver/aarch64-target-as-march.s
  clang/test/Driver/arm-cortex-cpus-2.c
  clang/test/Driver/arm-ias-Wa.s
  clang/test/Preprocessor/aarch64-target-features.c
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Target/TraceCursor.h
  lldb/include/lldb/Target/TraceInstructionDumper.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/API/SBInstruction.cpp
  lldb/source/API/SBInstructionList.cpp
  lldb/source/Commands/CommandObjectDisassemble.cpp
  lldb/source/Commands/CommandObjectDisassemble.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/Disassembler.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
  lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
  lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
  lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/source/Target/ThreadPlanTracer.cpp
  lldb/source/Target/TraceCursor.cpp
  lldb/source/Target/TraceInstructionDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128477.440806.patch
Type: text/x-patch
Size: 41910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220628/d2450ac7/attachment-0001.bin>


More information about the lldb-commits mailing list