Git Product home page Git Product logo

Comments (5)

workingjubilee avatar workingjubilee commented on June 20, 2024

I think the easiest way to do this would be to try to move the __rust_begin_short_backtrace and __rust_end_short_backtrace symbols around. That way everything continues working as normal.

It should be fine if this accidentally results in some duplication in the full trace. The filtering must already be resilient against the fact that we are neither guaranteed that these symbols only appear once, or at all.

from rust.

jyn514 avatar jyn514 commented on June 20, 2024

I think the easiest way to do this would be to try to move the __rust_begin_short_backtrace and __rust_end_short_backtrace symbols around. That way everything continues working as normal.

i don't see how this helps? if you move it to expect_failed, you now need a bunch of begin_short_backtrace stubs, one for each possible approach to the panic machinery. i see 10 calls to panic_fmt alone, that doesn't seem maintainable.

the backtrace crate gives us access to the module names, that seems much simpler than trying to hack it by inserting custom frames.

from rust.

workingjubilee avatar workingjubilee commented on June 20, 2024

Hmm. Making the backtrace filtering logic more fragile does not seem automatically "simpler" to me, since now it has to handle a number of other conditions and it has to be aware that it can only exclude these frames at the beginning of the (shortened) backtrace, not if they somehow appear elsewhere, but I would be willing to review such a PR.

from rust.

conradludgate avatar conradludgate commented on June 20, 2024

For short backtraces, I would also like to propose trimming the pre-main frames too

from rust.

saethlin avatar saethlin commented on June 20, 2024

I think that's in the OP:

and the core::ops::function::FnOnce::call_once that show up at the end of the backtrace as well.

I've been thinking about how to do this. I agree with Jubilee's concern that just going off module path is fragile, but I'm not totally sure that alternative approaches are worth the complexity.

Omitting the FnOnce::call_once entry is straightforward in that the heuristic is just to omit the frame before we encounter __rust_begin_short_backtrace. I don't see a straightforward way to make this happen because the backtrace printing needs to manage state in a way it doesn't right now. I don't see any fragility, we should just do this.

Omitting frames based on the core::panicking path looks like a good heuristic based on the backtrace for assert_eq!, but I'm wary of what would happen in a backtrace that exits the module then comes back to it. Perhaps we can also make this resilient this by adding yet more state to the backtrace printing? If we keep track of the fact that saw __rust_end_short_backtrace then continue skipping frames until we get something that isn't rust_begin_unwind or in core::panicking... maybe that works well enough? At that point though I'd really like to see a refactor of the backtrace printing state machine. It's quite unwieldy already.

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.