backward-cpp icon indicating copy to clipboard operation
backward-cpp copied to clipboard

Cache the .debug_aranges section and merge overlapping ranges

Open pedronavf opened this issue 7 years ago • 2 comments

By caching .debug_aranges we speed up CU DIE lookups, as libdwarf requires us to allocate a copy of the ranges between trace frames. Because all contents in .debug_aranges are read we can also merge overlapping ranges and discard those with invalid information (a zero in start, length or die offset)

pedronavf avatar May 26 '18 00:05 pedronavf

The more memory we allocate, the more likely something bad can happen if you are expecting a stacktrace on some cpu exception...

bombela avatar Jun 28 '18 18:06 bombela

Agreed. I need to refresh the pull request because we kept evolving the code, but I've been quite busy to keep out fork cleaned up and ready to commit. We only enable this for debug builds as, in those, we know that our crashes are in parts of the code where we can use malloc with no problems.

I wanted to bring this up, enabling features on demand, but I wasn't sure if you wanted to keep backward free of those options or not. Right now we have #ifdefs to enable this caching or not, to scan DIEs recursively if searching in .debug_aranges fails, and some others. Would you be open to get those in? I can submit a pull request for you to check it out.

pedronavf avatar Jun 28 '18 19:06 pedronavf