From fc7238bbbae178f1c552e943d68e08f99d642274 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sat, 3 Apr 2010 23:14:18 +0000 Subject: [PATCH] * inferiors.c (add_thread): Set last_status kind to TARGET_WAITKIND_IGNORE. * linux-low.c (cancel_breakpoint): Remove unnecessary regcache fetch. Use ptid_of. Avoid unnecessary get_lwp_thread calls. (linux_wait_1): Move `thread' local definition to block that uses it. Don't NULL initialize `event_child'. (linux_resume_one_thread): Avoid unnecessary get_lwp_thread calls. Alway set the thread's last_status to TARGET_WAITKIND_IGNORE. * linux-x86-low.c (x86_breakpoint_at): Read raw memory. --- gdb/gdbserver/ChangeLog | 12 ++++++++++++ gdb/gdbserver/inferiors.c | 1 + gdb/gdbserver/linux-low.c | 18 ++++++++---------- gdb/gdbserver/linux-x86-low.c | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 59289d754f..1102e12611 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,15 @@ +2010-04-03 Pedro Alves + + * inferiors.c (add_thread): Set last_status kind to + TARGET_WAITKIND_IGNORE. + * linux-low.c (cancel_breakpoint): Remove unnecessary regcache + fetch. Use ptid_of. Avoid unnecessary get_lwp_thread calls. + (linux_wait_1): Move `thread' local definition to block that uses + it. Don't NULL initialize `event_child'. + (linux_resume_one_thread): Avoid unnecessary get_lwp_thread calls. + Alway set the thread's last_status to TARGET_WAITKIND_IGNORE. + * linux-x86-low.c (x86_breakpoint_at): Read raw memory. + 2010-04-01 Pedro Alves * linux-low.c (get_stop_pc): Don't adjust the PC if stopped with diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index 37df792834..8e3f1de6bb 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -171,6 +171,7 @@ add_thread (ptid_t thread_id, void *target_data) memset (new_thread, 0, sizeof (*new_thread)); new_thread->entry.id = thread_id; + new_thread->last_status.kind = TARGET_WAITKIND_IGNORE; add_inferior_to_list (&all_threads, & new_thread->entry); diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 59187ee68f..38af9d0beb 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1125,14 +1125,11 @@ static int cancel_breakpoint (struct lwp_info *lwp) { struct thread_info *saved_inferior; - struct regcache *regcache; /* There's nothing to do if we don't support breakpoints. */ if (!supports_breakpoints ()) return 0; - regcache = get_thread_regcache (get_lwp_thread (lwp), 1); - /* breakpoint_at reads from current inferior. */ saved_inferior = current_inferior; current_inferior = get_lwp_thread (lwp); @@ -1142,13 +1139,13 @@ cancel_breakpoint (struct lwp_info *lwp) if (debug_threads) fprintf (stderr, "CB: Push back breakpoint for %s\n", - target_pid_to_str (lwp->head.id)); + target_pid_to_str (ptid_of (lwp))); /* Back up the PC if necessary. */ if (the_low_target.decr_pc_after_break) { struct regcache *regcache - = get_thread_regcache (get_lwp_thread (lwp), 1); + = get_thread_regcache (current_inferior, 1); (*the_low_target.set_pc) (regcache, lwp->stop_pc); } @@ -1161,7 +1158,7 @@ cancel_breakpoint (struct lwp_info *lwp) fprintf (stderr, "CB: No breakpoint found at %s for [%s]\n", paddress (lwp->stop_pc), - target_pid_to_str (lwp->head.id)); + target_pid_to_str (ptid_of (lwp))); } current_inferior = saved_inferior; @@ -1584,8 +1581,7 @@ linux_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, int target_options) { int w; - struct thread_info *thread = NULL; - struct lwp_info *event_child = NULL; + struct lwp_info *event_child; int options; int pid; int step_over_finished; @@ -1611,6 +1607,8 @@ retry: && !ptid_equal (cont_thread, null_ptid) && !ptid_equal (cont_thread, minus_one_ptid)) { + struct thread_info *thread; + thread = (struct thread_info *) find_inferior_id (&all_threads, cont_thread); @@ -2615,7 +2613,7 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg) /* For stop requests, we're done. */ lwp->resume = NULL; - get_lwp_thread (lwp)->last_status.kind = TARGET_WAITKIND_IGNORE; + thread->last_status.kind = TARGET_WAITKIND_IGNORE; return 0; } @@ -2635,7 +2633,6 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg) step = (lwp->resume->kind == resume_step); linux_resume_one_lwp (lwp, step, lwp->resume->sig, NULL); - get_lwp_thread (lwp)->last_status.kind = TARGET_WAITKIND_IGNORE; } else { @@ -2663,6 +2660,7 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg) } } + thread->last_status.kind = TARGET_WAITKIND_IGNORE; lwp->resume = NULL; return 0; } diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 1f9e1b1cac..37fe60f24a 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -325,7 +325,7 @@ x86_breakpoint_at (CORE_ADDR pc) { unsigned char c; - read_inferior_memory (pc, &c, 1); + (*the_target->read_memory) (pc, &c, 1); if (c == 0xCC) return 1; -- 2.34.1