Hi, I'd like to send a PR for an enhancement to the backward::Printer printer. It will optionally accept a user callback that, if specified, will be called on each stack frame to decide whether to print it. That is, in the Printer::print_trace function, if there is a filename, it will call the user callback with the file path name and the callback will return either true (display the stack frame) or false (skip displaying it).
One application of this is that the user callback can decide if it wants to show the stack frame in order to avoid showing stack frames from code outside of the user's project. In my project, I want to avoid showing stack frames from inside the C++ standard library, and this feature would allow me to do that.
By having a callback it allows the user the most flexibility. If you think this feature will be acceptable then I can submit a PR.
Hi, I'd like to send a PR for an enhancement to the
backward::Printer
printer. It will optionally accept a user callback that, if specified, will be called on each stack frame to decide whether to print it. That is, in thePrinter::print_trace
function, if there is a filename, it will call the user callback with the file path name and the callback will return eithertrue
(display the stack frame) orfalse
(skip displaying it).One application of this is that the user callback can decide if it wants to show the stack frame in order to avoid showing stack frames from code outside of the user's project. In my project, I want to avoid showing stack frames from inside the C++ standard library, and this feature would allow me to do that.
By having a callback it allows the user the most flexibility. If you think this feature will be acceptable then I can submit a PR.