Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Associate source file position with closures #10350

Closed

Description

@orenbenkiki

Allow the source file and line number to be shown in stack traces (e.g. in GDB). See https://mail.mozilla.org/pipermail/rust-dev/2013-November/006356.html

Activity

  1. jdm commented on Nov 8, 2013

    @jdm
    Contributor

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

  2. emberian commented on Nov 8, 2013

    @emberian
    Contributor

    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.

  3. emberian commented on Nov 8, 2013

    @emberian
    Contributor

    Given:

    foo.rs:

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

    bar.rs:

    extern mod foo;
    
    fn main() {
        let mut y = 2;
        let x = || {
            42 * 7 + y
        };
        y = 5;
        foo::bar(x);
    }

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

  4. sanxiyn commented on Nov 8, 2013

    @sanxiyn
    Contributor

    Does someone have a non-working case?

  5. orenbenkiki commented on Nov 8, 2013

    @orenbenkiki
    Author

    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.

  6. added a commit that references this issue on Mar 24, 2023
  7. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions