Skip to content

Add basic backtrace functionality #10128

Closed
@alexcrichton

Description

@alexcrichton

There are a number of locations where it would be really nice if we had some very simple support for backtraces. By simple I just mean the ability to know the name of the function and possibly the instruction pointer inside the function.

Some possible use case:

  • Traces for each gc allocation (the old C++ managed box allocator did this)
  • Stack trace printing on failure
  • Less codegen bloat from failure functions that pass around file/line number. (function name isn't equivalent, but maybe sufficient?)

This is obviously a tricky thing to do, and I don't think that we should bring in libunwind for just this (it's pretty simple), but it appears that each platform has their own solution for acquiring a simple backtrace, and we can take the least common denominator of all of them:

This would probably be a module in std::unstable like the way dynamic_lib is a module. This isn't really a high priority, but it would certainly be something nice to have!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions