From 70ddfe4b74c70244b3236aef2c68392a674ac105 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Mon, 14 May 2012 15:38:31 +0000 Subject: 2012-05-14 Stan Shebs Add dynamic printf. * breakpoint.h (enum bptype): New type bp_dprintf. (struct breakpoint): New field extra_string. (struct breakpoint_ops): Add arg to create_breakpoints_sal. (create_breakpoint): Add extra_string arg. * breakpoint.c (dprintf_breakpoint_ops): New. (is_breakpoint): Add bp_dprintf. (bpstat_what): Add dprintf case. (bptype_string): Ditto. (print_one_breakpoint_location): Ditto. (init_bp_location): Ditto. (bkpt_print_mention): Ditto. (dprintf_style_enums): New array. (dprintf_style): New global. (dprintf_function): New global. (dprintf_channel): New global. (update_dprintf_command_list): New function. (update_dprintf_commands): New function. (init_breakpoint_sal): Add extra_string argument, handle it. (create_breakpoint_sal): Add extra_string argument. (create_breakpoints_sal): Add extra_string argument, update callers. (find_condition_and_thread): Add extra argument. (create_breakpoint): Add extra_string argument, record it. (dprintf_command): New function. (break_command_1): Add arg to create_breakpoint call. (handle_gnu_v3_exceptions): Ditto. (trace_command): Ditto. (ftrace_command): Ditto. (strace_command): Ditto. (bkpt_print_mention): Add dprintf case. (create_breakpoint_sal_default): Add extra_string argument. (_initialize_breakpoint): Add new commands. * mi/mi-cmd-break.c (mi_cmd_break_insert): Add arg to call. * python/py-breakpoint.c (bppy_init): Ditto. * python/py-finishbreakpoint.c (bpfinishpy_init): Ditto. * gdb.texinfo (Dynamic Printf): New subsection. * gdb.base/dprintf.c: New file. * gdb.base/dprintf.exp: New file. --- gdb/breakpoint.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gdb/breakpoint.h') diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index d23561ab787..c81c0802120 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -154,6 +154,13 @@ enum bptype bp_fast_tracepoint, bp_static_tracepoint, + /* A dynamic printf stops at the given location, does a formatted + print, then automatically continues. (Although this is sort of + like a macro packaging up standard breakpoint functionality, + GDB doesn't have a way to construct types of breakpoint from + elements of behavior.) */ + bp_dprintf, + /* Event for JIT compiled code generation or deletion. */ bp_jit_event, @@ -552,6 +559,7 @@ struct breakpoint_ops void (*create_breakpoints_sal) (struct gdbarch *, struct linespec_result *, struct linespec_sals *, char *, + char *, enum bptype, enum bpdisp, int, int, int, const struct breakpoint_ops *, int, int, int, unsigned); @@ -674,8 +682,9 @@ struct breakpoint /* String form of the breakpoint condition (malloc'd), or NULL if there is no condition. */ char *cond_string; - /* String form of exp to use for displaying to the user - (malloc'd), or NULL if none. */ + + /* String form of extra parameters, or NULL if there are none. */ + char *extra_string; /* Holds the address of the related watchpoint_scope breakpoint when using watchpoints on local variables (might the concept of @@ -1210,6 +1219,7 @@ enum breakpoint_create_flags extern int create_breakpoint (struct gdbarch *gdbarch, char *arg, char *cond_string, int thread, + char *extra_string, int parse_condition_and_thread, int tempflag, enum bptype wanted_type, int ignore_count, -- cgit v1.2.1