[lldb][trace] Add a basic function call dump [2] - Implement the reconstruction algorithm
authorWalter Erquinigo <wallace@fb.com>
Mon, 10 Oct 2022 19:57:13 +0000 (12:57 -0700)
committerWalter Erquinigo <wallace@fb.com>
Tue, 18 Oct 2022 20:57:53 +0000 (13:57 -0700)
commit840d861d6e524637a96fe9b7f6d2d77091521167
treee09aeecd1bddd5faffd1c74f7bdb0c75e43ca53d
parent566146c03b054db2530f6b5997dfd0cd1a243657
[lldb][trace] Add a basic function call dump [2] - Implement the reconstruction algorithm

This diff implements the reconstruction algorithm for the call tree and
add tests.

See TraceDumper.h for documentation and explanations.

One important detail is that the tree objects are in TraceDumper, even
though Trace.h is a better home. I'm leaving that as future work.

Another detail is that this code is as slow as dumping the entire
symolicated trace, which is not that bad tbh. The reason is that we use
symbols throughout the algorithm and we are not being careful about
memory and speed. This is also another area for future improvement.

Lastly, I made sure that incomplete traces work, i.e. you start tracing
very deep in the stack or failures randomly appear in the trace.

Differential Revision: https://reviews.llvm.org/D135917
lldb/include/lldb/Target/TraceDumper.h
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Target/TraceDumper.cpp
lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
lldb/test/API/commands/trace/TestTraceLoad.py
lldb/test/API/commands/trace/inline-function/a.out [new file with mode: 0755]
lldb/test/API/commands/trace/inline-function/inline.cpp [new file with mode: 0644]