[Lldb-commits] [PATCH] D137614: [trace] Add a new call graph reconstructor

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 7 23:44:04 PST 2022


wallace created this revision.
wallace added reviewers: jj10306, persona0220.
Herald added a subscriber: pengfei.
Herald added a project: All.
wallace requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The previous reconstructor was flawed and served well as prototype, but
this new one is meant to stay for a while. Some features

- Strictly typing of the different variants of calls (functions, inlined functions, symbols, etc).
- Special handling of inline function, including inlined functions that have no instructions of their own
- Better formatting for the dumper
- Extensible code structure. It's easy to create new call types and special handlers based on instruction types and symbol information
- Added better tests

As a note, the latest version of libipt included a new instruction kind "indirect" with is either an indirect jump or a call that libipt can't distinguish better. It used to be signaled as an error instruction but not anymore (see https://github.com/intel/libipt/commit/27513274c897851e15a46bb19a3861219d87c6cb). Besides that, the LLVM disassembler fails to disassembly some functions that libipt doesn't. I imagine Intel is doing a better job than LLVM at disassembling x86 instructions. So I decided to use the instruction kinds from libipt until we improve the disassembler.

In a following diff I'll add a JSON dumper for the graph.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137614

Files:
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/Target/TraceCallGraph.h
  lldb/include/lldb/Target/TraceCursor.h
  lldb/include/lldb/Target/TraceDumper.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/Options.td
  lldb/source/Core/Disassembler.cpp
  lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.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/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/SectionLoadList.cpp
  lldb/source/Target/Trace.cpp
  lldb/source/Target/TraceCallGraph.cpp
  lldb/source/Target/TraceCursor.cpp
  lldb/source/Target/TraceDumper.cpp
  lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
  lldb/test/API/commands/trace/function_calls/Makefile
  lldb/test/API/commands/trace/function_calls/TestTraceDumpFunctionCalls.py
  lldb/test/API/commands/trace/function_calls/bar.cpp
  lldb/test/API/commands/trace/function_calls/bar.h
  lldb/test/API/commands/trace/function_calls/foo.cpp
  lldb/test/API/commands/trace/inline-function/a.out
  lldb/test/API/commands/trace/inline-function/inline.cpp
  lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137614.473888.patch
Type: text/x-patch
Size: 140222 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221108/3d2d2de3/attachment-0001.bin>


More information about the lldb-commits mailing list