From 47c0c975422ae5af7176a3e8b6550cb2faff06d1 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Sun, 24 May 2009 17:37:34 +0000 Subject: [PATCH] * linux-low.c (get_stop_pc): Print pc if debug_threads. (check_removed_breakpoint, linux_wait_for_lwp): Ditto. (linux_resume_one_lwp): Ditto. --- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/linux-low.c | 31 ++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index a18deff3a72..f5f272f289c 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2009-05-24 Doug Evans + + * linux-low.c (get_stop_pc): Print pc if debug_threads. + (check_removed_breakpoint, linux_wait_for_lwp): Ditto. + (linux_resume_one_lwp): Ditto. + 2009-05-23 Doug Evans * linux-low.c (linux_resume_one_lwp): Change type of first arg diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 7ed3308c5d2..f721737d2c3 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -354,10 +354,13 @@ get_stop_pc (void) { CORE_ADDR stop_pc = (*the_low_target.get_pc) (); - if (get_thread_lwp (current_inferior)->stepping) - return stop_pc; - else - return stop_pc - the_low_target.decr_pc_after_break; + if (! get_thread_lwp (current_inferior)->stepping) + stop_pc -= the_low_target.decr_pc_after_break; + + if (debug_threads) + fprintf (stderr, "stop pc is 0x%lx\n", (long) stop_pc); + + return stop_pc; } static void * @@ -814,7 +817,11 @@ check_removed_breakpoint (struct lwp_info *event_child) decrement. We go immediately from this function to resuming, and can not safely call get_stop_pc () again. */ if (the_low_target.set_pc != NULL) - (*the_low_target.set_pc) (stop_pc); + { + if (debug_threads) + fprintf (stderr, "Set pc to 0x%lx\n", (long) stop_pc); + (*the_low_target.set_pc) (stop_pc); + } /* We consumed the pending SIGTRAP. */ event_child->pending_is_breakpoint = 0; @@ -942,14 +949,16 @@ retry: } if (debug_threads - && WIFSTOPPED (*wstatp)) + && WIFSTOPPED (*wstatp) + && the_low_target.get_pc != NULL) { struct thread_info *saved_inferior = current_inferior; + CORE_ADDR pc; + current_inferior = (struct thread_info *) find_inferior_id (&all_threads, child->head.id); - /* For testing only; i386_stop_pc prints out a diagnostic. */ - if (the_low_target.get_pc != NULL) - get_stop_pc (); + pc = (*the_low_target.get_pc) (); + fprintf (stderr, "linux_wait_for_lwp: pc is 0x%lx\n", (long) pc); current_inferior = saved_inferior; } @@ -1706,8 +1715,8 @@ linux_resume_one_lwp (struct lwp_info *lwp, if (debug_threads && the_low_target.get_pc != NULL) { - fprintf (stderr, " "); - (*the_low_target.get_pc) (); + CORE_ADDR pc = (*the_low_target.get_pc) (); + fprintf (stderr, " resuming from pc 0x%lx\n", (long) pc); } /* If we have pending signals, consume one unless we are trying to reinsert -- 2.30.2