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 an evaluation function hook to Python breakpoints.


Tom Tromey <tromey@redhat.com> writes:

>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>
> Phil> +	  PyObject *gdbpy_bp_eval = PyString_FromString ("evaluate");
>
> This is leaked.  However...
>
> Phil> +	  if (PyObject_HasAttr (py_bp, gdbpy_bp_eval))
> Phil> +	    {
> Phil> +	      PyObject *result = PyObject_CallMethodObjArgs (py_bp,
> Phil> +							     gdbpy_bp_eval,
> Phil> +							     NULL);
>
> You can just use PyObject_HasAttrString and PyObject_CallMethod instead.

Ok, thanks.

> Phil> +gdb_py_test_silent_cmd  "python eval_bp1 = bp_eval(\"$bp_location2\")" "Set breakpoint" 0
> Phil> +gdb_py_test_silent_cmd  "python also_eval_bp1 = bp_also_eval(\"$bp_location2\")" "Set breakpoint" 0
>
> I think there should also be a test for the case where there is an
> ordinary user breakpoint at the same location as the Python breakpoints.
> In this case, the user breakpoint should stop, but all the Python
> methods should be invoked first.

All the breakpoints at a location will be evaluated, but does the order
matter? I can add the test to prove the point, but the Python breakpoints will
have the evaluation function called regardless if the user breakpoint
was first. 

FWIW in bpstop_stop_status a bpstat chain is built from the location
where the inferior stopped.  Then later, we iterate through that chain and
eventually call bpstat_check_breakpoint_conditions.  Then finally in
that condition call we evaluate the Python function.  This loop does not
exit until the all the bpstats in the chain have been iterated.

Cheers

Phil



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