From 8cdf0e150657da2086efc67c83e04619139081b2 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Tue, 16 Mar 2010 08:42:20 +0000 Subject: Simplify MI breakpoint setting. * breakpoint.c (break_command_really): Make nonstatic and rename to... (create_breakpoint): ...this. Rename prior function by this name to... (create_breakpoint_sal): ...this. (create_breakpoints): Rename to... (create_breakpoints_sal): ...this. (set_breakpoint): Remove. * breakpoint.h: Adjust to above changes. * mi/mi-cmd-break.c (mi_cmd_break_insert): Simplify. --- gdb/mi/mi-cmd-break.c | 53 +++++++++++++-------------------------------------- 1 file changed, 13 insertions(+), 40 deletions(-) (limited to 'gdb/mi') diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 1164414..3ed652c 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -67,18 +67,20 @@ mi_cmd_break_insert (char *command, char **argv, int argc) { char *address = NULL; enum bp_type type = REG_BP; + int hardware = 0; int temp_p = 0; int thread = -1; int ignore_count = 0; char *condition = NULL; int pending = 0; int enabled = 1; + struct cleanup *back_to; struct gdb_exception e; struct gdb_events *old_hooks; enum opt { - HARDWARE_OPT, TEMP_OPT /*, REGEXP_OPT */ , CONDITION_OPT, + HARDWARE_OPT, TEMP_OPT, CONDITION_OPT, IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT }; static struct mi_opt opts[] = @@ -108,13 +110,8 @@ mi_cmd_break_insert (char *command, char **argv, int argc) temp_p = 1; break; case HARDWARE_OPT: - type = HW_BP; + hardware = 1; break; -#if 0 - case REGEXP_OPT: - type = REGEXP_BP; - break; -#endif case CONDITION_OPT: condition = optarg; break; @@ -147,40 +144,16 @@ mi_cmd_break_insert (char *command, char **argv, int argc) mi_breakpoint_observers_installed = 1; } + back_to = make_cleanup_restore_integer (&mi_can_breakpoint_notify); mi_can_breakpoint_notify = 1; - /* Make sure we restore hooks even if exception is thrown. */ - TRY_CATCH (e, RETURN_MASK_ALL) - { - switch (type) - { - case REG_BP: - set_breakpoint (get_current_arch (), address, condition, - 0 /*hardwareflag */ , temp_p, - thread, ignore_count, - pending, enabled); - break; - case HW_BP: - set_breakpoint (get_current_arch (), address, condition, - 1 /*hardwareflag */ , temp_p, - thread, ignore_count, - pending, enabled); - break; -#if 0 - case REGEXP_BP: - if (temp_p) - error (_("mi_cmd_break_insert: Unsupported tempoary regexp breakpoint")); - else - rbreak_command_wrapper (address, FROM_TTY); - break; -#endif - default: - internal_error (__FILE__, __LINE__, - _("mi_cmd_break_insert: Bad switch.")); - } - } - mi_can_breakpoint_notify = 0; - if (e.reason < 0) - throw_exception (e); + create_breakpoint (get_current_arch (), address, condition, thread, + 0 /* condition and thread are valid. */, + temp_p, hardware, 0 /* traceflag */, + ignore_count, + pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE, + NULL, 0, enabled); + do_cleanups (back_to); + } enum wp_type -- cgit v1.1