diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-11-25 23:31:40 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-11-25 23:31:40 +0000 |
commit | 24557e30a905d2e99e17c70c7b80634a22a8da90 (patch) | |
tree | 7ae2272980ff327ac5d3eb23487e78ba9032739c | |
parent | 3db8d52cadadc9275efdefd702e7be88b38b120a (diff) | |
download | gdb-24557e30a905d2e99e17c70c7b80634a22a8da90.zip gdb-24557e30a905d2e99e17c70c7b80634a22a8da90.tar.gz gdb-24557e30a905d2e99e17c70c7b80634a22a8da90.tar.bz2 |
2003-11-25 Andrew Cagney <cagney@redhat.com>
* thread-db.c (enable_thread_event): New function. Ensure that BP
is a code address.
(enable_thread_event_reporting): Use enable_thread_event.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/thread-db.c | 40 |
2 files changed, 32 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4356b14..402c5ca 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-11-25 Andrew Cagney <cagney@redhat.com> + + * thread-db.c (enable_thread_event): New function. Ensure that BP + is a code address. + (enable_thread_event_reporting): Use enable_thread_event. + 2003-11-25 Michael Snyder <msnyder@redhat.com> * mips-tdep.c (mips_o64_extract_return_value): Correct for diff --git a/gdb/thread-db.c b/gdb/thread-db.c index efd0d33..d1fb452 100644 --- a/gdb/thread-db.c +++ b/gdb/thread-db.c @@ -465,6 +465,26 @@ thread_db_load (void) return 1; } +static int +enable_thread_event (td_thragent_t *thread_agent, int event, CORE_ADDR *bp) +{ + td_notify_t notify; + int err; + + /* Get the breakpoint address for thread EVENT. */ + err = td_ta_event_addr_p (thread_agent, event, ¬ify); + if (err != TD_OK) + return 0; + + /* Set up the breakpoint. */ + (*bp) = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + (CORE_ADDR) notify.u.bptaddr, + ¤t_target); + create_thread_event_breakpoint ((*bp)); + + return 1; +} + static void enable_thread_event_reporting (void) { @@ -498,32 +518,24 @@ enable_thread_event_reporting (void) /* Delete previous thread event breakpoints, if any. */ remove_thread_event_breakpoints (); + td_create_bp_addr = 0; + td_death_bp_addr = 0; - /* Get address for thread creation breakpoint. */ - err = td_ta_event_addr_p (thread_agent, TD_CREATE, ¬ify); - if (err != TD_OK) + /* Set up the thread creation event. */ + if (!enable_thread_event (thread_agent, TD_CREATE, &td_create_bp_addr)) { warning ("Unable to get location for thread creation breakpoint: %s", thread_db_err_str (err)); return; } - /* Set up the breakpoint. */ - td_create_bp_addr = (CORE_ADDR) notify.u.bptaddr; - create_thread_event_breakpoint (td_create_bp_addr); - - /* Get address for thread death breakpoint. */ - err = td_ta_event_addr_p (thread_agent, TD_DEATH, ¬ify); - if (err != TD_OK) + /* Set up the thread death event. */ + if (!enable_thread_event (thread_agent, TD_DEATH, &td_death_bp_addr)) { warning ("Unable to get location for thread death breakpoint: %s", thread_db_err_str (err)); return; } - - /* Set up the breakpoint. */ - td_death_bp_addr = (CORE_ADDR) notify.u.bptaddr; - create_thread_event_breakpoint (td_death_bp_addr); } static void |