This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Add visible flag to breakpoints.
- From: Tom Tromey <tromey at redhat dot com>
- To: pmuldoon at redhat dot com
- Cc: Pedro Alves <pedro at codesourcery dot com>, gdb-patches at sourceware dot org, dan at codesourcery dot com
- Date: Fri, 08 Oct 2010 12:39:57 -0600
- Subject: Re: [patch] Add visible flag to breakpoints.
- References: <m38w2j72jd.fsf@redhat.com> <20100930144132.GA15652@caradoc.them.org> <m3hbh7qk6w.fsf@redhat.com> <201009301741.32379.pedro@codesourcery.com> <m3lj68svad.fsf@redhat.com>
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> +/* Top and bottom of the breakpoint chain. We store bottom so we do
Phil> + not have to constantly iterate through the chain when we add a new
Phil> + breakpoint. */
Phil> +struct breakpoint_object *top;
Phil> +struct breakpoint_object *bottom;
These should be static.
Phil> + if (Breakpoint == NULL)
Pedro pointed out the problem here. I suspect you want ((Breakpoint)->bp)
instead.
There are 2 instances of this.
Phil> +/* Python function to get the visibility of the breakpoint. */
Phil> +static PyObject *
Phil> +bppy_get_visibility (PyObject *self, void *closure)
Blank line between the comment & function.
We're trying to enforce this now.
Phil> + if (internal)
Phil> + {
Phil> + if (! PyBool_Check (internal))
Phil> + {
Phil> + PyErr_SetString (PyExc_TypeError,
Phil> + _("The value of `internal' keyword must be a boolean."));
Use PyObject_IsTrue, don't type-check for a boolean.
Phil> + int i = 0;
Phil> + ALL_PY_BREAKPOINTS (b)
Phil> + {
Phil> + Py_INCREF (b);
Phil> + PyTuple_SetItem (result, i, (PyObject *) b);
Phil> + ++i;
I know this is copied code, as it were, but I think this needs an error
check on PyTuple_SetItem.
Phil> + PyErr_SetString (PyExc_RuntimeError,
Phil> + _("Error while creating breakpoint from GDB."));
Phil> + return;
Phil> + }
I don't think it is ok to do this here. I think it will just confuse
some future call into Python.
I am not sure what is the best thing to do here. We can't throw a gdb
exception, because we are in an observer.
Maybe setting the python error, as above, then immediately calling
gdbpy_print_stack. This is sort of weird, but at least it properly
handles the user's settings.
Tom