--- a/breakpoint.c +++ b/breakpoint.c @@ -305,7 +305,7 @@ struct breakpoint_ops bkpt_breakpoint_op static struct breakpoint_ops bkpt_probe_breakpoint_ops; /* Dynamic printf class type. */ -static struct breakpoint_ops dprintf_breakpoint_ops; +struct breakpoint_ops dprintf_breakpoint_ops; /* The style in which to perform a dynamic printf. This is a user option because different output options have different tradeoffs; --- a/breakpoint.h +++ b/breakpoint.h @@ -1212,6 +1212,7 @@ extern void tbreak_command (char *, int) extern struct breakpoint_ops base_breakpoint_ops; extern struct breakpoint_ops bkpt_breakpoint_ops; extern struct breakpoint_ops tracepoint_breakpoint_ops; +extern struct breakpoint_ops dprintf_breakpoint_ops; extern void initialize_breakpoint_ops (void); --- a/mi/mi-cmd-break.c +++ b/mi/mi-cmd-break.c @@ -99,15 +99,17 @@ mi_cmd_break_insert (char *command, char int pending = 0; int enabled = 1; int tracepoint = 0; + int dprintf = 0; struct cleanup *back_to; enum bptype type_wanted; struct breakpoint_ops *ops; + char *extra_string = NULL; enum opt { HARDWARE_OPT, TEMP_OPT, CONDITION_OPT, IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT, - TRACEPOINT_OPT, + TRACEPOINT_OPT, DPRINTF_OPT, }; static const struct mi_opt opts[] = { @@ -119,6 +121,7 @@ mi_cmd_break_insert (char *command, char {"f", PENDING_OPT, 0}, {"d", DISABLE_OPT, 0}, {"a", TRACEPOINT_OPT, 0}, + {"s", DPRINTF_OPT, 1}, { 0, 0, 0 } }; @@ -159,9 +162,15 @@ mi_cmd_break_insert (char *command, char case TRACEPOINT_OPT: tracepoint = 1; break; + case DPRINTF_OPT: + extra_string = oarg; + dprintf = 1; + break; } } + if (hardware && dprintf) + error (_("-break-insert: -h and -s cannot be used together")); if (oind >= argc) error (_("-break-insert: Missing ")); if (oind < argc - 1) @@ -171,20 +180,31 @@ mi_cmd_break_insert (char *command, char /* Now we have what we need, let's insert the breakpoint! */ back_to = setup_breakpoint_reporting (); - /* Note that to request a fast tracepoint, the client uses the - "hardware" flag, although there's nothing of hardware related to - fast tracepoints -- one can implement slow tracepoints with - hardware breakpoints, but fast tracepoints are always software. - "fast" is a misnomer, actually, "jump" would be more appropriate. - A simulator or an emulator could conceivably implement fast - regular non-jump based tracepoints. */ - type_wanted = (tracepoint - ? (hardware ? bp_fast_tracepoint : bp_tracepoint) - : (hardware ? bp_hardware_breakpoint : bp_breakpoint)); - ops = tracepoint ? &tracepoint_breakpoint_ops : &bkpt_breakpoint_ops; + if (tracepoint) + { + /* Note that to request a fast tracepoint, the client uses the + "hardware" flag, although there's nothing of hardware related to + fast tracepoints -- one can implement slow tracepoints with + hardware breakpoints, but fast tracepoints are always software. + "fast" is a misnomer, actually, "jump" would be more appropriate. + A simulator or an emulator could conceivably implement fast + regular non-jump based tracepoints. */ + type_wanted = hardware ? bp_fast_tracepoint : bp_tracepoint; + ops = &tracepoint_breakpoint_ops; + } + else if (dprintf) + { + type_wanted = bp_dprintf; + ops = &dprintf_breakpoint_ops; + } + else + { + type_wanted = hardware ? bp_hardware_breakpoint : bp_breakpoint; + ops = &bkpt_breakpoint_ops; + } create_breakpoint (get_current_arch (), address, condition, thread, - NULL, + extra_string, 0 /* condition and thread are valid. */, temp_p, type_wanted, ignore_count,