From ddd49eeec46ac948def99330a62f1ce023a0d356 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 24 Jun 2011 19:47:37 +0000 Subject: * varobj.c (update_dynamic_varobj_children): Make 'name' const. * symtab.h (lookup_struct, lookup_union, lookup_enum): Update. * python/python.c (gdbpy_parameter): Make 'arg' const. (execute_gdb_command): Likewise. (gdbpy_decode_line): Likewise. Copy it. (gdbpy_parse_and_eval): Make 'expr_string' const. Copy it. (gdbpy_write): Make 'arg' const. * python/py-type.c (typy_lookup_typename): Make 'type_name' const. (gdbpy_lookup_type): Likewise. * python/py-prettyprint.c (print_children): Make 'name' const. * python/py-param.c (parmpy_init): Make 'name' const. Copy it. * python/py-inferior.c (infpy_write_memory): Make 'buf_len' a Py_ssize_t. * python/py-function.c (fnpy_init): Make 'name' const. * python/py-cmd.c (cmdpy_init): Make 'name' const. Copy it. (gdbpy_string_to_argv): Make 'input' const. * python/py-breakpoint.c (bppy_init): Make 'spec' const. Copy it. * gdbtypes.h (lookup_typename): Update. * gdbtypes.c (lookup_typename): Make 'name' const. (lookup_struct): Likewise. (lookup_union): Likewise. (lookup_enum): Likewise. --- gdb/python/py-breakpoint.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gdb/python/py-breakpoint.c') diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 9c33848..e73dc24 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -599,7 +599,7 @@ static int bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) { static char *keywords[] = { "spec", "type", "wp_class", "internal", NULL }; - char *spec; + const char *spec; int type = bp_breakpoint; int access_type = hw_write; PyObject *internal = NULL; @@ -623,12 +623,15 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) TRY_CATCH (except, RETURN_MASK_ALL) { + char *copy = xstrdup (spec); + struct cleanup *cleanup = make_cleanup (xfree, copy); + switch (type) { case bp_breakpoint: { create_breakpoint (python_gdbarch, - spec, NULL, -1, + copy, NULL, -1, 0, 0, bp_breakpoint, 0, @@ -639,11 +642,11 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) case bp_watchpoint: { if (access_type == hw_write) - watch_command_wrapper (spec, 0, internal_bp); + watch_command_wrapper (copy, 0, internal_bp); else if (access_type == hw_access) - awatch_command_wrapper (spec, 0, internal_bp); + awatch_command_wrapper (copy, 0, internal_bp); else if (access_type == hw_read) - rwatch_command_wrapper (spec, 0, internal_bp); + rwatch_command_wrapper (copy, 0, internal_bp); else error(_("Cannot understand watchpoint access type.")); break; @@ -651,6 +654,8 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) default: error(_("Do not understand breakpoint type to set.")); } + + do_cleanups (cleanup); } if (except.reason < 0) { -- cgit v1.1