User:Dhuseby: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
== [https://bugzilla.mozilla.org/show_bug.cgi?id=895162 Bug 895162 Notes] ==
The stack walking code on our ARM targets is non-trivial.  Our current approach is to use the exception handling data.  The only problem is that the exception handling data wasn't intended for use in stack unwinding from every possible program counter (PC) location.  In particular, the stack unwinding breaks when the PC is in a function prologue/epilogue.  This is because no exceptions can be thrown in a function prologue/epilogue so the stack unwinding information for those PC locations is invalid.
I looked into using DWARF debugging information to help in the prologue/epilogue special case.  DWARF debugging information can contain Line Number Program data.  According to the DWARF standard, the Line Number Program data contains several flags related to prologue/epilogue and given address locations.  Unfortunately, the flags are prologue_end and epilogue_being.  Those flags are intenteded for debuggers to determine entry and exit point line numbers of functions for entry/exit breakpoints.  Given a random PC, there is no easy way to detect if it is inside of a function prologue/epilogue.
That leads me back to the DWARF Call Frame Information.  This is the data added to an executable with the -fasynchronous-unwind-tables flag is set in GCC.  Currently we can't use this information because it is HUGE and we run out of memory on the B2G devices.
The only obvious way forward is to have GCC generate and output all of the DWARF data, including the Call Frame Information, and then we write a new tool that strips out the DWARF information from the elf, condenses it down to just the data we need (prologue/epilogue test for a given PC) and then writes it back to the elf.  Then the profiler would have the necessary data to fully unwind stacks correctly, 100% of the time.
'''Recommendation'''
# Design and code a prototype post-compile debug processing tool that strips DWARF data out of the elf, processes it down to the minimal set of data needed for PC prologue/epilogue tests and writes it back to the elf.
# Modify profile signal handler to use the new PC prologue/epilogue test data to detect cases where the exception handling stack unwinding won't work and transform the PC to an address where the exception handling stack unwinding will work.
{{VerifiedUser}}
{{VerifiedUser}}

Latest revision as of 00:28, 17 April 2014