[ARM] minor opt in thumb_stack_frame_destroyed_p
authorYao Qi <yao.qi@linaro.org>
Fri, 15 Apr 2016 14:30:01 +0000 (15:30 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 15 Apr 2016 14:30:01 +0000 (15:30 +0100)
thumb_stack_frame_destroyed_p scans the instructions from PC to the
end of the function, but if PC is far from the end of pc, we don't
have to scan, because PC should be in epilogue if it is still
far from the end of the function.  The criterion I use here is 16
bytes, which is more than 4 instructions.

Regression tested on aarch64-linux with mutli-arch debug.

gdb:

2016-04-15  Yao Qi  <yao.qi@linaro.org>

* arm-tdep.c (thumb_stack_frame_destroyed_p): Return zero if
PC is far from the end of function.

gdb/ChangeLog
gdb/arm-tdep.c

index 09937a917c8f894006046e8bf90e15898c21d9fd..e85023e06271fc3cc32a72873b1611c358071ce4 100644 (file)
@@ -1,3 +1,8 @@
+2016-04-15  Yao Qi  <yao.qi@linaro.org>
+
+       * arm-tdep.c (thumb_stack_frame_destroyed_p): Return zero if
+       PC is far from the end of function.
+
 2016-04-14  Pedro Alves  <palves@redhat.com>
 
        * cli/cli-cmds.c (alias_usage_error): New function.
index 0412f71d24a948222a167e7dc13e678903c0057b..36b0bcda34108f612bff10949bbccd602ec6ccdd 100644 (file)
@@ -3135,6 +3135,14 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   if (!find_pc_partial_function (pc, NULL, &func_start, &func_end))
     return 0;
 
+  if (func_end - pc > 4 * 4)
+    {
+      /* There shouldn't be more than four instructions in epilogue.
+        If PC is still 16 bytes away from FUNC_END, it isn't in
+        epilogue.  */
+      return 0;
+    }
+
   /* The epilogue is a sequence of instructions along the following lines:
 
     - add stack frame size to SP or FP
This page took 0.038036 seconds and 4 git commands to generate.