Re: [patch] Add an evaluation function hook to Python breakpoints.

Tom Tromey
2010-12-14T16:35:58Z

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

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.

Tom