* 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.
This commit is contained in:
Pedro Alves
2010-04-03 23:14:18 +00:00
parent 1eed4def45
commit fc7238bbba
4 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,15 @@
2010-04-03 Pedro Alves <pedro@codesourcery.com>
* 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 <pedro@codesourcery.com> 2010-04-01 Pedro Alves <pedro@codesourcery.com>
* linux-low.c (get_stop_pc): Don't adjust the PC if stopped with * linux-low.c (get_stop_pc): Don't adjust the PC if stopped with

View File

@ -171,6 +171,7 @@ add_thread (ptid_t thread_id, void *target_data)
memset (new_thread, 0, sizeof (*new_thread)); memset (new_thread, 0, sizeof (*new_thread));
new_thread->entry.id = thread_id; new_thread->entry.id = thread_id;
new_thread->last_status.kind = TARGET_WAITKIND_IGNORE;
add_inferior_to_list (&all_threads, & new_thread->entry); add_inferior_to_list (&all_threads, & new_thread->entry);

View File

@ -1125,14 +1125,11 @@ static int
cancel_breakpoint (struct lwp_info *lwp) cancel_breakpoint (struct lwp_info *lwp)
{ {
struct thread_info *saved_inferior; struct thread_info *saved_inferior;
struct regcache *regcache;
/* There's nothing to do if we don't support breakpoints. */ /* There's nothing to do if we don't support breakpoints. */
if (!supports_breakpoints ()) if (!supports_breakpoints ())
return 0; return 0;
regcache = get_thread_regcache (get_lwp_thread (lwp), 1);
/* breakpoint_at reads from current inferior. */ /* breakpoint_at reads from current inferior. */
saved_inferior = current_inferior; saved_inferior = current_inferior;
current_inferior = get_lwp_thread (lwp); current_inferior = get_lwp_thread (lwp);
@ -1142,13 +1139,13 @@ cancel_breakpoint (struct lwp_info *lwp)
if (debug_threads) if (debug_threads)
fprintf (stderr, fprintf (stderr,
"CB: Push back breakpoint for %s\n", "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. */ /* Back up the PC if necessary. */
if (the_low_target.decr_pc_after_break) if (the_low_target.decr_pc_after_break)
{ {
struct regcache *regcache 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); (*the_low_target.set_pc) (regcache, lwp->stop_pc);
} }
@ -1161,7 +1158,7 @@ cancel_breakpoint (struct lwp_info *lwp)
fprintf (stderr, fprintf (stderr,
"CB: No breakpoint found at %s for [%s]\n", "CB: No breakpoint found at %s for [%s]\n",
paddress (lwp->stop_pc), paddress (lwp->stop_pc),
target_pid_to_str (lwp->head.id)); target_pid_to_str (ptid_of (lwp)));
} }
current_inferior = saved_inferior; current_inferior = saved_inferior;
@ -1584,8 +1581,7 @@ linux_wait_1 (ptid_t ptid,
struct target_waitstatus *ourstatus, int target_options) struct target_waitstatus *ourstatus, int target_options)
{ {
int w; int w;
struct thread_info *thread = NULL; struct lwp_info *event_child;
struct lwp_info *event_child = NULL;
int options; int options;
int pid; int pid;
int step_over_finished; int step_over_finished;
@ -1611,6 +1607,8 @@ retry:
&& !ptid_equal (cont_thread, null_ptid) && !ptid_equal (cont_thread, null_ptid)
&& !ptid_equal (cont_thread, minus_one_ptid)) && !ptid_equal (cont_thread, minus_one_ptid))
{ {
struct thread_info *thread;
thread = (struct thread_info *) find_inferior_id (&all_threads, thread = (struct thread_info *) find_inferior_id (&all_threads,
cont_thread); cont_thread);
@ -2615,7 +2613,7 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg)
/* For stop requests, we're done. */ /* For stop requests, we're done. */
lwp->resume = NULL; lwp->resume = NULL;
get_lwp_thread (lwp)->last_status.kind = TARGET_WAITKIND_IGNORE; thread->last_status.kind = TARGET_WAITKIND_IGNORE;
return 0; return 0;
} }
@ -2635,7 +2633,6 @@ linux_resume_one_thread (struct inferior_list_entry *entry, void *arg)
step = (lwp->resume->kind == resume_step); step = (lwp->resume->kind == resume_step);
linux_resume_one_lwp (lwp, step, lwp->resume->sig, NULL); linux_resume_one_lwp (lwp, step, lwp->resume->sig, NULL);
get_lwp_thread (lwp)->last_status.kind = TARGET_WAITKIND_IGNORE;
} }
else 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; lwp->resume = NULL;
return 0; return 0;
} }

View File

@ -325,7 +325,7 @@ x86_breakpoint_at (CORE_ADDR pc)
{ {
unsigned char c; unsigned char c;
read_inferior_memory (pc, &c, 1); (*the_target->read_memory) (pc, &c, 1);
if (c == 0xCC) if (c == 0xCC)
return 1; return 1;