Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breakpoint doesn't work in tests #2453

Closed
emekoi opened this issue May 8, 2019 · 2 comments
Closed

breakpoint doesn't work in tests #2453

emekoi opened this issue May 8, 2019 · 2 comments
Milestone

Comments

@emekoi
Copy link
Contributor

emekoi commented May 8, 2019

when building the following as an executable, and running that executable in a debugger such as lldb, breakpoints work as expected:

// example.zig

pub fn main() void {
    var a: usize = 0;
    @breakpoint();
    var b = a;
}

test "@breakpoint in a test" {
    main();
}

however, running zig test example.zig, causes the test to fail.

@Sahnvour
Copy link
Contributor

Sahnvour commented May 8, 2019

Breakpoints usually boil down to a trap instruction that triggers a hardware interrupt, eg. int 3 on x86_64. The OS can have handlers for these, possibly installed by userland programs, such as debuggers. In your case it's likely that the first handler is the default one from the OS that aborts the program.
What would you expect it to do ?

@andrewrk andrewrk added this to the 0.6.0 milestone May 9, 2019
@andrewrk
Copy link
Member

This is working as intended. You'd have to run the test in a debugger to observe the breakpoint and continue the test to completion.

@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants