diff options
-rwxr-xr-x | scripts/symbolize.py | 10 | ||||
-rw-r--r-- | ta/arch/arm/ta_entry_a32.S | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/scripts/symbolize.py b/scripts/symbolize.py index a00962ec..91d06815 100755 --- a/scripts/symbolize.py +++ b/scripts/symbolize.py @@ -385,7 +385,15 @@ class Symbolizer(object): post = match.end('addr') self._out.write(line[:pre]) self._out.write(addr) - res = self.resolve(addr) + # The call stack contains return addresses (LR/ELR values). + # Heuristic: subtract 2 to obtain the call site of the function + # or the location of the exception. This value works for A64, + # A32 as well as Thumb. + pc = 0 + lr = int(addr, 16) + if lr: + pc = lr - 2 + res = self.resolve('0x{:x}'.format(pc)) res = self.pretty_print_path(res) self._out.write(' ' + res) self._out.write(line[post:]) diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S index f9325455..e3ef0e33 100644 --- a/ta/arch/arm/ta_entry_a32.S +++ b/ta/arch/arm/ta_entry_a32.S @@ -25,10 +25,5 @@ FUNC __ta_entry, : UNWIND( .fnstart) UNWIND( .cantunwind) bl __ta_entry_c - /* - * The nop makes the stack unwinding more clear (without it, - * symbolize.py may show a file/line outside the function). - */ - nop UNWIND( .fnend) END_FUNC __ta_entry |