================
@@ -294,3 +310,83 @@ def test_stack_frame_module_id(self) -> None:
expected_id,
f"expected moduleId '{expected_id}' for {source_name},
got: {module_id}",
)
+
+ @skipIfWindows
+ def test_stack_frame_compile_unit_id(self) -> None:
+ """Test that a stack frame's compileUnitId resolves to its source
file."""
+ program = self.getBuildArtifact("a.out")
+ session = self.build_and_create_session()
+ source = self.getSourcePath("main.c")
+ lines = [line_number(source, "recurse end")]
+
+ with session.configure(LaunchArgs(program=program)) as ctx:
+ breakpoint_ids = session.resolve_source_breakpoints(source, lines)
+
+ stop_event = session.verify_stopped_on_breakpoint(
+ breakpoint_ids, after=ctx.process_event
+ )
+ thread_id = self.expect_not_none(stop_event.body.threadId)
+ stack_frames = session.stack_trace(thread_id).body.stackFrames
+
+ ids = {
+ frame.compileUnitId
+ for frame in stack_frames
+ if frame.compileUnitId is not None
+ }
+ self.assertEqual(len(ids), 1, f"expected a single compile unit, got:
{ids}")
----------------
rupprecht wrote:
This assertion fails downstream: `expected a single compile unit, got: {0, 4}`
Most frames point to compile unit 4, but the bottom frame points to unit 0 for
start.S:
* `StackFrame(id=524328, name='main', line=10, column=3,
source=Source(name='main.c',
path='/path/to/lldb/test/API/tools/lldb-dap/stackTrace/main.c',
sourceReference=None, presentationHint=None, origin=None, sources=None,
adapterData=None, checksums=None), endLine=None, endColumn=None,
canRestart=None, instructionPointerReference='0x2016E0', moduleId='963CB580',
compileUnitId=4, presentationHint=None)`
* `StackFrame(id=524329, name='__libc_start_main', line=60, column=1,
source=Source(name='__libc_start_main',
path='/path/to/libc.so.6``__libc_start_main', sourceReference=1,
presentationHint='deemphasize', origin=None, sources=None, adapterData=None,
checksums=None), endLine=None, endColumn=None, canRestart=None,
instructionPointerReference='0x7FCA6B34CF12',
moduleId='30449E71-7B2F-9B62-0629-3B5F90426DA2', compileUnitId=None,
presentationHint=None)`
* `StackFrame(id=524330, name='_start', line=120, column=0,
source=Source(name='start.S', path='/path/to/start.S', sourceReference=None,
presentationHint='deemphasize', origin=None, sources=None, adapterData=None,
checksums=None), endLine=None, endColumn=None, canRestart=None,
instructionPointerReference='0x20160A', moduleId='963CB580', compileUnitId=0,
presentationHint=None)`
https://github.com/llvm/llvm-project/pull/222512
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits