[all-commits] [llvm/llvm-project] 566146: [lldb][trace] Add a basic function call dumpdump [...

walter erquinigo via All-commits all-commits at lists.llvm.org
Tue Oct 18 13:58:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 566146c03b054db2530f6b5997dfd0cd1a243657
      https://github.com/llvm/llvm-project/commit/566146c03b054db2530f6b5997dfd0cd1a243657
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

  Changed paths:
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Commands/Options.td
    A lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py

  Log Message:
  -----------
  [lldb][trace] Add a basic function call dumpdump [1] - Add the command scaffolding

The command is thread trace dump function-calls and as minimum will
require printing to a file in json and non-json format

I added a test

Differential Revision: https://reviews.llvm.org/D135521


  Commit: 840d861d6e524637a96fe9b7f6d2d77091521167
      https://github.com/llvm/llvm-project/commit/840d861d6e524637a96fe9b7f6d2d77091521167
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

  Changed paths:
    M lldb/include/lldb/Target/TraceDumper.h
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Target/TraceDumper.cpp
    M lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py
    M lldb/test/API/commands/trace/TestTraceLoad.py
    A lldb/test/API/commands/trace/inline-function/a.out
    A lldb/test/API/commands/trace/inline-function/inline.cpp

  Log Message:
  -----------
  [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


  Commit: f1e63855b08e366dc9d3bf1d3394a8f5c77ab3a6
      https://github.com/llvm/llvm-project/commit/f1e63855b08e366dc9d3bf1d3394a8f5c77ab3a6
  Author: Walter Erquinigo <wallace at fb.com>
  Date:   2022-10-18 (Tue, 18 Oct 2022)

  Changed paths:
    M lldb/include/lldb/Target/TraceDumper.h
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Target/TraceDumper.cpp
    M lldb/test/API/commands/trace/TestTraceDumpFunctionCalls.py

  Log Message:
  -----------
  [lldb][trace] Add a basic function call dump [3] - Add a JSON dumper

The JSON dumper is very minimalistic. It pretty much only shows the
delimiting instruction IDs of every segment, so that further queries to
the SBCursor can be used to make sense of the data. It's main purpose is
to be serialized somewhat cheaply.

I also renamed untracedSegment to untracedPrefixSegment, in case in the
future we add an untracedSuffixSegment. In any case, this new name is
more explicit, which I like.

Differential Revision: https://reviews.llvm.org/D136034


Compare: https://github.com/llvm/llvm-project/compare/b2a294bcf8e6...f1e63855b08e


More information about the All-commits mailing list