Skip to content

Better backtrace cleaning on panic #40201

Closed
@Yamakaky

Description

@Yamakaky

Followup of #38165.

The current behaviour is to maintain a blacklist of frames to remove from the backtrace. This poses problems in portability and accuracy. For example, the bottom of the backtrace is not cleaned when the panic is in a test or an other thread.

I propose that just before calling the user main/test/closure, the calling code would capture a backtrace. Then, on panic, the frames present is the backtrace pre and post panic would be removed. That way, no need to have a big whitelist. Some small post-processing may be needed to remove some additional frames.

A few questions:

  • Is __rust_maybe_catch_panic used on all the platforms? If so, it could be used as a basis for this technique, since it's used for tests, the main thread and the secondary threads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions