Associate source file position with closures #10350

orenbenkiki opened this Issue Nov 8, 2013 · 5 comments


None yet

4 participants


Allow the source file and line number to be shown in stack traces (e.g. in GDB). See

jdm commented Nov 8, 2013

Are you building with -Z debug-info ? That should make source files and line numbers show up.

cmr commented Nov 8, 2013

This shouldn't be that hard, I don't think. gdb would just need to know to dereference the fn pointer and look for debuginfo where it points to.

cmr commented Nov 8, 2013


pub fn bar(x: || -> int) -> int {

extern mod foo;

fn main() {
    let mut y = 2;
    let x = || {
        42 * 7 + y
    y = 5;

Compiling with rustc -Z extra-debug-info --lib; rustc -L . -Z extra-debug-info, and breaking on foo::bar, I do get file/line numbers in the stack trace for the closure.

sanxiyn commented Nov 8, 2013

Does someone have a non-working case?


My bad, I followed up on the thread not realizing -Z debug-info solves the problem. Now, if there was a flag to get stack trace outside GDB... but that's another issue.

Thanks and apologies for needlessly opening the issue.

@orenbenkiki orenbenkiki closed this Nov 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment