diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2011-02-15 21:23:34 +0000 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2011-02-15 21:23:34 +0000 |
commit | af02033e0a25c5c104b158094a80a96ba487bb32 (patch) | |
tree | 17074f10c3a555d054a7cbbc7f7620eaeb552260 | |
parent | 60f98dde0ae5b9d8a59732a67c6ea0b272cc1615 (diff) | |
download | gdb-af02033e0a25c5c104b158094a80a96ba487bb32.zip gdb-af02033e0a25c5c104b158094a80a96ba487bb32.tar.gz gdb-af02033e0a25c5c104b158094a80a96ba487bb32.tar.bz2 |
2011-02-15 Paul Pluzhnikov <ppluzhnikov@google.com>
* breakpoint.c ((create_overlay_event_breakpoint): Const-propagate
parameter value.
(create_longjmp_master_breakpoint): Loop over longjmp names.
(create_std_terminate_master_breakpoint): Const-propagate parameter
value.
(update_breakpoints_after_exec): Adjust.
(breakpoint_re_set): Adjust.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/breakpoint.c | 73 |
2 files changed, 52 insertions, 31 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6d4c923..dfa0bf6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2011-02-15 Paul Pluzhnikov <ppluzhnikov@google.com> + + * breakpoint.c ((create_overlay_event_breakpoint): Const-propagate + parameter value. + (create_longjmp_master_breakpoint): Loop over longjmp names. + (create_std_terminate_master_breakpoint): Const-propagate parameter + value. + (update_breakpoints_after_exec): Adjust. + (breakpoint_re_set): Adjust. + 2011-02-15 Michael Snyder <msnyder@vmware.com> * command.h (enum command_class): New class 'no_set_class', for diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 39d9b02..029ce6b 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2218,9 +2218,10 @@ create_internal_breakpoint (struct gdbarch *gdbarch, } static void -create_overlay_event_breakpoint (char *func_name) +create_overlay_event_breakpoint (void) { struct objfile *objfile; + const char *const func_name = "_ovly_debug_event"; ALL_OBJFILES (objfile) { @@ -2251,48 +2252,64 @@ create_overlay_event_breakpoint (char *func_name) } static void -create_longjmp_master_breakpoint (char *func_name) +create_longjmp_master_breakpoint (void) { struct program_space *pspace; - struct objfile *objfile; struct cleanup *old_chain; old_chain = save_current_program_space (); ALL_PSPACES (pspace) - ALL_OBJFILES (objfile) + { + struct objfile *objfile; + + set_current_program_space (pspace); + + ALL_OBJFILES (objfile) { - struct breakpoint *b; - struct minimal_symbol *m; + const char *const longjmp_names[] + = { "longjmp", "_longjmp", "siglongjmp", "_siglongjmp" }; + const int num_longjmp_names + = sizeof (longjmp_names) / sizeof (longjmp_names[0]); + int i; + struct gdbarch *gdbarch; - if (!gdbarch_get_longjmp_target_p (get_objfile_arch (objfile))) + gdbarch = get_objfile_arch (objfile); + if (!gdbarch_get_longjmp_target_p (gdbarch)) continue; - set_current_program_space (pspace); + for (i = 0; i < num_longjmp_names; i++) + { + struct breakpoint *b; + struct minimal_symbol *m; + const char *func_name; - m = lookup_minimal_symbol_text (func_name, objfile); - if (m == NULL) - continue; + func_name = longjmp_names[i]; + m = lookup_minimal_symbol_text (func_name, objfile); + if (m == NULL) + continue; - b = create_internal_breakpoint (get_objfile_arch (objfile), - SYMBOL_VALUE_ADDRESS (m), - bp_longjmp_master); - b->addr_string = xstrdup (func_name); - b->enable_state = bp_disabled; + b = create_internal_breakpoint (gdbarch, + SYMBOL_VALUE_ADDRESS (m), + bp_longjmp_master); + b->addr_string = xstrdup (func_name); + b->enable_state = bp_disabled; + } } + } update_global_location_list (1); do_cleanups (old_chain); } -/* Create a master std::terminate breakpoint. The actual function - looked for is named FUNC_NAME. */ +/* Create a master std::terminate breakpoint. */ static void -create_std_terminate_master_breakpoint (const char *func_name) +create_std_terminate_master_breakpoint (void) { struct program_space *pspace; struct objfile *objfile; struct cleanup *old_chain; + const char *const func_name = "std::terminate()"; old_chain = save_current_program_space (); @@ -2462,12 +2479,9 @@ update_breakpoints_after_exec (void) } } /* FIXME what about longjmp breakpoints? Re-create them here? */ - create_overlay_event_breakpoint ("_ovly_debug_event"); - create_longjmp_master_breakpoint ("longjmp"); - create_longjmp_master_breakpoint ("_longjmp"); - create_longjmp_master_breakpoint ("siglongjmp"); - create_longjmp_master_breakpoint ("_siglongjmp"); - create_std_terminate_master_breakpoint ("std::terminate()"); + create_overlay_event_breakpoint (); + create_longjmp_master_breakpoint (); + create_std_terminate_master_breakpoint (); create_exception_master_breakpoint (); } @@ -10719,12 +10733,9 @@ breakpoint_re_set (void) do_cleanups (old_chain); - create_overlay_event_breakpoint ("_ovly_debug_event"); - create_longjmp_master_breakpoint ("longjmp"); - create_longjmp_master_breakpoint ("_longjmp"); - create_longjmp_master_breakpoint ("siglongjmp"); - create_longjmp_master_breakpoint ("_siglongjmp"); - create_std_terminate_master_breakpoint ("std::terminate()"); + create_overlay_event_breakpoint (); + create_longjmp_master_breakpoint (); + create_std_terminate_master_breakpoint (); create_exception_master_breakpoint (); } |