aboutsummaryrefslogtreecommitdiff
path: root/test/src/Debugger.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/Debugger.zig')
-rw-r--r--test/src/Debugger.zig86
1 files changed, 73 insertions, 13 deletions
diff --git a/test/src/Debugger.zig b/test/src/Debugger.zig
index 2ff141dd84..f92f7f8a95 100644
--- a/test/src/Debugger.zig
+++ b/test/src/Debugger.zig
@@ -587,7 +587,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void {
},
);
db.addLldbTest(
- "cross_module_call",
+ "inline_call",
target,
&.{
.{
@@ -595,8 +595,18 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void {
.source =
\\const module = @import("module");
\\pub fn main() void {
- \\ module.foo(123);
- \\ module.bar(456);
+ \\ fa(12);
+ \\ fb(34);
+ \\ module.fc(56);
+ \\ module.fd(78);
+ \\}
+ \\fn fa(pa: u32) void {
+ \\ const la = ~pa;
+ \\ _ = la;
+ \\}
+ \\inline fn fb(pb: u32) void {
+ \\ const lb = ~pb;
+ \\ _ = lb;
\\}
\\
,
@@ -605,34 +615,84 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void {
.import = "module",
.path = "module.zig",
.source =
- \\pub fn foo(x: u32) void {
- \\ _ = x;
+ \\pub fn fc(pc: u32) void {
+ \\ const lc = ~pc;
+ \\ _ = lc;
\\}
- \\pub inline fn bar(y: u32) void {
- \\ _ = y;
+ \\pub inline fn fd(pd: u32) void {
+ \\ const ld = ~pd;
+ \\ _ = ld;
\\}
\\
,
},
},
- \\breakpoint set --file module.zig --source-pattern-regexp '_ = x;'
+ \\settings set frame-format 'frame #${frame.index}:{ ${module.file.basename}{\`${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${line.file.basename}:${line.number}{:${line.column}}}{${function.is-optimized} [opt]}{${frame.is-artificial} [artificial]}\n'
+ \\
+ \\breakpoint set --file main.zig --source-pattern-regexp '_ = la;'
\\process launch
- \\source info
+ \\frame variable pa la
+ \\thread backtrace --count 2
\\breakpoint delete --force 1
\\
- \\breakpoint set --file module.zig --line 5
+ \\breakpoint set --file main.zig --source-pattern-regexp '_ = lb;'
\\process continue
- \\source info
+ \\frame variable pb lb
+ \\thread backtrace --count 2
\\breakpoint delete --force 2
+ \\
+ \\breakpoint set --file module.zig --source-pattern-regexp '_ = lc;'
+ \\process continue
+ \\frame variable pc lc
+ \\thread backtrace --count 2
+ \\breakpoint delete --force 3
+ \\
+ \\breakpoint set --file module.zig --line 7
+ \\process continue
+ \\frame variable pd ld
+ \\thread backtrace --count 2
+ \\breakpoint delete --force 4
,
&.{
- \\/module.zig:2:5
+ \\(lldb) frame variable pa la
+ \\(u32) pa = 12
+ \\(u32) la = 4294967283
+ \\(lldb) thread backtrace --count 2
+ \\* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
+ \\ * frame #0: inline_call`main.fa(pa=12) at main.zig:10:5
+ \\ frame #1: inline_call`main.main at main.zig:3:7
\\(lldb) breakpoint delete --force 1
\\1 breakpoints deleted; 0 breakpoint locations disabled.
,
- \\/module.zig:5:5
+ \\(lldb) frame variable pb lb
+ \\(u32) pb = 34
+ \\(u32) lb = 4294967261
+ \\(lldb) thread backtrace --count 2
+ \\* thread #1, name = 'inline_call', stop reason = breakpoint 2.1
+ \\ * frame #0: inline_call`main.main [inlined] fb(pb=34) at main.zig:14:5
+ \\ frame #1: inline_call`main.main at main.zig:4:7
\\(lldb) breakpoint delete --force 2
\\1 breakpoints deleted; 0 breakpoint locations disabled.
+ ,
+ \\(lldb) frame variable pc lc
+ \\(u32) pc = 56
+ \\(u32) lc = 4294967239
+ \\(lldb) thread backtrace --count 2
+ \\* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
+ \\ * frame #0: inline_call`module.fc(pc=56) at module.zig:3:5
+ \\ frame #1: inline_call`main.main at main.zig:5:14
+ \\(lldb) breakpoint delete --force 3
+ \\1 breakpoints deleted; 0 breakpoint locations disabled.
+ ,
+ \\(lldb) frame variable pd ld
+ \\(u32) pd = 78
+ \\(u32) ld = 4294967217
+ \\(lldb) thread backtrace --count 2
+ \\* thread #1, name = 'inline_call', stop reason = breakpoint 4.1
+ \\ * frame #0: inline_call`main.main [inlined] fd(pd=78) at module.zig:7:5
+ \\ frame #1: inline_call`main.main at main.zig:6:14
+ \\(lldb) breakpoint delete --force 4
+ \\1 breakpoints deleted; 0 breakpoint locations disabled.
},
);
}