aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2012-04-26 16:56:18 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2012-04-26 16:56:18 +0000
commit14132e8924cd988218b4b2c4c6aaea45af951c59 (patch)
tree83541aa536610e46dc843e15c5109206772542bf /gdb/infrun.c
parent518f0db5cfd751f298921b07349fbdf7142969ac (diff)
downloadgdb-14132e8924cd988218b4b2c4c6aaea45af951c59.zip
gdb-14132e8924cd988218b4b2c4c6aaea45af951c59.tar.gz
gdb-14132e8924cd988218b4b2c4c6aaea45af951c59.tar.bz2
gdb/
* infrun.c (handle_inferior_event): Move the check for return trampolines ahead of the check for function trampolines. * mips-tdep.h (MIPS_S2_REGNUM, MIPS_GP_REGNUM): New macros. * mips-tdep.c (mips_str_mips16_call_stub): New variable. (mips_str_mips16_ret_stub): Likewise. (mips_str_call_fp_stub): Likewise. (mips_str_call_stub): Likewise. (mips_str_fn_stub): Likewise. (mips_str_pic): Likewise. (mips_in_frame_stub): New function. (mips_unwind_pc): Return the return address rather than the PC if the PC of an intermediate frame is inside a call thunk. (mips_is_stub_suffix): New function. (mips_is_stub_mode): Likewise. (mips_get_mips16_fn_stub_pc): Likewise. (mips_skip_mips16_trampoline_code): Update to handle all the currently generated stub types. Don't recurse into __fn_stub thunks. Remove heuristics to handle stubs beyond etext/_etext. Use cooked register accesses. (mips_in_return_stub): Reintroduce function. (mips_skip_trampoline_code): Traverse trampolines recursively. (mips_gdbarch_init): Handle MIPS16 return trampolines. gdb/testsuite/ * gdb.arch/mips16-thunks-inmain.c: New file. * gdb.arch/mips16-thunks-main.c: New file. * gdb.arch/mips16-thunks-sin.c: New file. * gdb.arch/mips16-thunks-sinfrob.c: New file. * gdb.arch/mips16-thunks-sinfrob16.c: New file. * gdb.arch/mips16-thunks-sinmain.c: New file. * gdb.arch/mips16-thunks-sinmips16.c: New file. * gdb.arch/mips16-thunks.exp: New file.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c81
1 files changed, 42 insertions, 39 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a7d6c3c..854ab01 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4814,6 +4814,48 @@ process_event_stop_test:
return;
}
+ /* If we're in the return path from a shared library trampoline,
+ we want to proceed through the trampoline when stepping. */
+ /* macro/2012-04-25: This needs to come before the subroutine
+ call check below as on some targets return trampolines look
+ like subroutine calls (MIPS16 return thunks). */
+ if (gdbarch_in_solib_return_trampoline (gdbarch,
+ stop_pc, ecs->stop_func_name)
+ && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
+ {
+ /* Determine where this trampoline returns. */
+ CORE_ADDR real_stop_pc;
+
+ real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
+
+ if (debug_infrun)
+ fprintf_unfiltered (gdb_stdlog,
+ "infrun: stepped into solib return tramp\n");
+
+ /* Only proceed through if we know where it's going. */
+ if (real_stop_pc)
+ {
+ /* And put the step-breakpoint there and go until there. */
+ struct symtab_and_line sr_sal;
+
+ init_sal (&sr_sal); /* initialize to zeroes */
+ sr_sal.pc = real_stop_pc;
+ sr_sal.section = find_pc_overlay (sr_sal.pc);
+ sr_sal.pspace = get_frame_program_space (frame);
+
+ /* Do not specify what the fp should be when we stop since
+ on some machines the prologue is where the new fp value
+ is established. */
+ insert_step_resume_breakpoint_at_sal (gdbarch,
+ sr_sal, null_frame_id);
+
+ /* Restart without fiddling with the step ranges or
+ other state. */
+ keep_going (ecs);
+ return;
+ }
+ }
+
/* Check for subroutine calls. The check for the current frame
equalling the step ID is not necessary - the check of the
previous frame's ID is sufficient - but it is a common case and
@@ -5024,45 +5066,6 @@ process_event_stop_test:
}
}
- /* If we're in the return path from a shared library trampoline,
- we want to proceed through the trampoline when stepping. */
- if (gdbarch_in_solib_return_trampoline (gdbarch,
- stop_pc, ecs->stop_func_name)
- && ecs->event_thread->control.step_over_calls != STEP_OVER_NONE)
- {
- /* Determine where this trampoline returns. */
- CORE_ADDR real_stop_pc;
-
- real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
-
- if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
- "infrun: stepped into solib return tramp\n");
-
- /* Only proceed through if we know where it's going. */
- if (real_stop_pc)
- {
- /* And put the step-breakpoint there and go until there. */
- struct symtab_and_line sr_sal;
-
- init_sal (&sr_sal); /* initialize to zeroes */
- sr_sal.pc = real_stop_pc;
- sr_sal.section = find_pc_overlay (sr_sal.pc);
- sr_sal.pspace = get_frame_program_space (frame);
-
- /* Do not specify what the fp should be when we stop since
- on some machines the prologue is where the new fp value
- is established. */
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
-
- /* Restart without fiddling with the step ranges or
- other state. */
- keep_going (ecs);
- return;
- }
- }
-
stop_pc_sal = find_pc_line (stop_pc, 0);
/* NOTE: tausq/2004-05-24: This if block used to be done before all