From: Michael Snyder <msnyder@vmware.com>
To: gdb-patches@sourceware.org
Cc: drow@false.org, teawater@gmail.com
Subject: [RFA] improved handling of shared lib calls (reverse 2/2)
Date: Sat, 04 Jul 2009 00:35:00 -0000 [thread overview]
Message-ID: <4A4EA339.90109@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
This change depends on the previous one (epilogue unwinder for i386,
http://sourceware.org/ml/gdb-patches/2009-07/msg00099.html).
With the frame unwinder working properly, we can remove the
special case code in the test for "check for subroutine call"
in handle_inferior_event.
Of course that reveals some hidden problems with shared library
calls, so this patch also addresses those.
Michael
[-- Attachment #2: solib.txt --]
[-- Type: text/plain, Size: 2737 bytes --]
2009-07-03 Michael Snyder <msnyder@vmware.com>
* infrun.c (handle_inferior_event): Remove an execution_direction
check in the "check for subroutine calls" test, and add some
additional handling for reverse-stepping through shared libraries.
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.400
diff -u -p -r1.400 infrun.c
--- infrun.c 2 Jul 2009 17:21:06 -0000 1.400
+++ infrun.c 4 Jul 2009 00:27:53 -0000
@@ -3776,9 +3776,8 @@ infrun: not switching back to stepped th
previous frame must have valid frame IDs. */
if (!frame_id_eq (get_stack_frame_id (frame),
ecs->event_thread->step_stack_frame_id)
- && (frame_id_eq (frame_unwind_caller_id (frame),
- ecs->event_thread->step_stack_frame_id)
- || execution_direction == EXEC_REVERSE))
+ && frame_id_eq (frame_unwind_caller_id (frame),
+ ecs->event_thread->step_stack_frame_id))
{
CORE_ADDR real_stop_pc;
@@ -3806,6 +3805,7 @@ infrun: not switching back to stepped th
/* Reverse stepping through solib trampolines. */
if (execution_direction == EXEC_REVERSE
+ && ecs->event_thread->step_over_calls != STEP_OVER_NONE
&& (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc)
|| (ecs->stop_func_start == 0
&& in_solib_dynsym_resolve_code (stop_pc))))
@@ -3923,6 +3923,38 @@ infrun: not switching back to stepped th
return;
}
+ /* Reverse stepping through solib trampolines. */
+
+ if (execution_direction == EXEC_REVERSE
+ && ecs->event_thread->step_over_calls != STEP_OVER_NONE)
+ {
+ if (gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc)
+ || (ecs->stop_func_start == 0
+ && in_solib_dynsym_resolve_code (stop_pc)))
+ {
+ /* Any solib trampoline code can be handled in reverse
+ by simply continuing to single-step. We have already
+ executed the solib function (backwards), and a few
+ steps will take us back through the trampoline to the
+ caller. */
+ keep_going (ecs);
+ return;
+ }
+ else if (in_solib_dynsym_resolve_code (stop_pc))
+ {
+ /* Stepped backward into the solib dynsym resolver.
+ Set a breakpoint at its start and continue, then
+ one more step will take us out. */
+ struct symtab_and_line sr_sal;
+ init_sal (&sr_sal);
+ sr_sal.pc = ecs->stop_func_start;
+ insert_step_resume_breakpoint_at_sal (gdbarch,
+ sr_sal, null_frame_id);
+ keep_going (ecs);
+ return;
+ }
+ }
+
/* 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,
next reply other threads:[~2009-07-04 0:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-04 0:35 Michael Snyder [this message]
2009-07-05 10:54 ` Hui Zhu
2009-07-12 18:10 ` Michael Snyder
2009-07-15 7:35 ` Michael Snyder
2009-07-15 12:53 ` Hui Zhu
2009-07-16 11:37 ` Hui Zhu
2009-07-19 8:21 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A4EA339.90109@vmware.com \
--to=msnyder@vmware.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox