This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add visible flag to breakpoints.


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]