diff options
author | Joel Brobecker <brobecker@gnat.com> | 2009-03-25 22:08:29 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2009-03-25 22:08:29 +0000 |
commit | a6f1cd96674fbf60d2fb1936570bad596887ded5 (patch) | |
tree | 821a2f1f2b2477e4a4a36ba31c2f5742206b3071 | |
parent | dbfb4bc7c90c545bbc4d3bbcddd645ed42fdf2ae (diff) | |
download | gdb-a6f1cd96674fbf60d2fb1936570bad596887ded5.zip gdb-a6f1cd96674fbf60d2fb1936570bad596887ded5.tar.gz gdb-a6f1cd96674fbf60d2fb1936570bad596887ded5.tar.bz2 |
* breakpoint.c (breakpoint_thread_match): Split a large condition
into several smaller conditions. No behavior change.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/breakpoint.c | 39 |
2 files changed, 30 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 304611b..938ced7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2009-03-25 Joel Brobecker <brobecker@adacore.com> + + * breakpoint.c (breakpoint_thread_match): Split a large condition + into several smaller conditions. No behavior change. + 2009-03-25 Pedro Alves <pedro@codesourcery.com> * infrun.c (infrun_thread_thread_exit): New. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 7e50342..7ffdf77 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1893,28 +1893,39 @@ int breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) { const struct bp_location *bpt; - int thread; - - thread = pid_to_thread_id (ptid); - + /* The thread ID associated to PTID, computed lazily. */ + int thread = -1; + ALL_BP_LOCATIONS (bpt) { if (bpt->loc_type != bp_loc_software_breakpoint && bpt->loc_type != bp_loc_hardware_breakpoint) continue; - if ((breakpoint_enabled (bpt->owner) - || bpt->owner->enable_state == bp_permanent) - && bpt->address == pc - && (bpt->owner->thread == -1 || bpt->owner->thread == thread)) + if (!breakpoint_enabled (bpt->owner) + && bpt->owner->enable_state != bp_permanent) + continue; + + if (bpt->address != pc) + continue; + + if (bpt->owner->thread != -1) { - if (overlay_debugging - && section_is_overlay (bpt->section) - && !section_is_mapped (bpt->section)) - continue; /* unmapped overlay -- can't be a match */ - else - return 1; + /* This is a thread-specific breakpoint. Check that ptid + matches that thread. If thread hasn't been computed yet, + it is now time to do so. */ + if (thread == -1) + thread = pid_to_thread_id (ptid); + if (bpt->owner->thread != thread) + continue; } + + if (overlay_debugging + && section_is_overlay (bpt->section) + && !section_is_mapped (bpt->section)) + continue; /* unmapped overlay -- can't be a match */ + + return 1; } return 0; |