From: Cherry Zhang Date: Thu, 9 Jun 2016 02:22:35 +0000 (-0400) Subject: runtime: set $sp before $pc in gdb python script X-Git-Tag: go1.7beta2~28 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cbc26869b7835e45359dad7dfb70e85c02c820cd;p=gostls13.git runtime: set $sp before $pc in gdb python script When setting $pc, gdb does a backtrace using the current value of $sp, and it may complain if $sp does not match that $pc (although the assignment went through successfully). This happens with ARM SSA backend: when setting $pc it prints > Cannot access memory at address 0x0 As well as occasionally on MIPS64: > warning: GDB can't find the start of the function at 0xc82003fe07. > ... Setting $sp before setting $pc makes it happy. Change-Id: Idd96dbef3e9b698829da553c6d71d5b4c6d492db Reviewed-on: https://go-review.googlesource.com/23940 Reviewed-by: Ian Lance Taylor Reviewed-by: Austin Clements --- diff --git a/src/runtime/runtime-gdb.py b/src/runtime/runtime-gdb.py index e57fa00e1a..5c9b2a08e8 100644 --- a/src/runtime/runtime-gdb.py +++ b/src/runtime/runtime-gdb.py @@ -448,15 +448,15 @@ class GoroutineCmd(gdb.Command): except gdb.error: pc = int(str(pc).split(None, 1)[0], 16) save_frame = gdb.selected_frame() - gdb.parse_and_eval('$save_pc = $pc') gdb.parse_and_eval('$save_sp = $sp') - gdb.parse_and_eval('$pc = {0}'.format(str(pc))) + gdb.parse_and_eval('$save_pc = $pc') gdb.parse_and_eval('$sp = {0}'.format(str(sp))) + gdb.parse_and_eval('$pc = {0}'.format(str(pc))) try: gdb.execute(cmd) finally: - gdb.parse_and_eval('$pc = $save_pc') gdb.parse_and_eval('$sp = $save_sp') + gdb.parse_and_eval('$pc = $save_pc') save_frame.select()