Before we add bindings for the TraceCursor to allow for programatic traversal of traces, we need to bindings to load a trace from a trace session file.
This diff adds trace load functionality to SBDebugger via the LoadTraceFromFile method and updates the intelpt test case class to have testTraceLoad method so we can take advantage of the testApiAndSB decorator to test both the CLI and SB without duplicating code.
Details
- Reviewers
wallace - Commits
- rG50f936796072: Add LoadTraceFromFile to SBDebugger and SBTrace
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lldb/include/lldb/API/SBDebugger.h | ||
---|---|---|
403 | Can this take a filespec? |
just some minor changes, including requiring the FileSpec as input to the SB function
lldb/include/lldb/API/SBDebugger.h | ||
---|---|---|
394–395 | ||
403 | +1 | |
403 | We need to come up with a good public name for the json file. I've been using trace session file, but I dislike. What about trace description file? Then we can have a "trace bundle" that contains "trace description file". Do you have better suggestions? | |
lldb/include/lldb/API/SBTrace.h | ||
15 | +1 | |
24–41 | you can also refer to the documentation of the other function if you don't want to repeat yourself | |
lldb/source/API/SBTrace.cpp | ||
33 | you'll need LLDB_INSTRUMENT_VA(this, error, debugger, trace_session_file_path). This LLDB_INSTRUMENT_VA macro is used for diagnosing test failures on some systems. I haven't used this diagnostics systems myself but let's adhere to the convention | |
34–39 | if you want, add using namespace llvm so that you don't have to write llvm:: everywhere. You can also omit lldb:: already | |
lldb/source/Commands/CommandObjectTrace.cpp | ||
94–108 | nice refactor | |
105 | you can drop the trace_sp check because it should be valid because otherwise you'd have gotten an Expected | |
lldb/source/Target/Trace.cpp | ||
92–114 | you can drop all llvm:: and lldb:: if you want | |
lldb/test/API/commands/trace/TestTraceLoad.py | ||
10 | thanks! | |
100–101 | split into multiple lines |
Address comments
Note: I changed "trace session file" to "trace description file" in the new methods, but saving the project wide rename/adoption of "trace description file" for a separate diff as to not cloud the purpose of this diff.
nice job!
lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py | ||
---|---|---|
139 | i don't think it's deprecated, but you should pass the resolve flag anyone |
rebase and use SBFileSpec constructor with that requires an explicit resolve flag before landing
lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py | ||
---|---|---|
139 | You can find the deprecation warning in the comments here: |
lldb/packages/Python/lldbsuite/test/tools/intelpt/intelpt_testcase.py | ||
---|---|---|
139 | TIL! |