* [PATCH][gdb/python] Fix cpychecker error in recpy_bt_goto
@ 2018-10-04 18:08 Tom de Vries
2018-10-04 22:12 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2018-10-04 18:08 UTC (permalink / raw)
To: gdb-patches
Hi,
When using cpychecker, we run into this error:
...
gdb/python/py-record-btrace.c: \
In function âPyObject* recpy_bt_goto(PyObject*, PyObject*)â:
gdb/python/py-record-btrace.c:783:25: error: Mismatching type in call to \
PyArg_ParseTuple with format code "O" [-Werror]
if (!PyArg_ParseTuple (args, "O", &obj))
argument 3 ("&obj") had type
"const struct recpy_element_object * *"
but was expecting
"struct PyObject * *"
for format code "O"
...
Fix this by using a new variable of the expected type instead.
Build and reg-tested on x86_64-linux.
OK for trunk?
Thanks,
- Tom
[gdb/python] Fix cpychecker error in recpy_bt_goto
2018-10-04 Tom de Vries <tdevries@suse.de>
* python/py-record-btrace.c (recpy_bt_goto): Fix type mismatch in
PyArg_ParseTuple call.
---
gdb/python/py-record-btrace.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index 057475e112..006b56c9ab 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -776,15 +776,17 @@ recpy_bt_goto (PyObject *self, PyObject *args)
const recpy_record_object * const record = (recpy_record_object *) self;
thread_info *const tinfo = record->thread;
const recpy_element_object *obj;
+ PyObject *parse_obj;
if (tinfo == NULL || btrace_is_empty (tinfo))
return PyErr_Format (gdbpy_gdb_error, _("Empty branch trace."));
- if (!PyArg_ParseTuple (args, "O", &obj))
+ if (!PyArg_ParseTuple (args, "O", &parse_obj))
return NULL;
- if (Py_TYPE (obj) != &recpy_insn_type)
+ if (Py_TYPE (parse_obj) != &recpy_insn_type)
return PyErr_Format (PyExc_TypeError, _("Argument must be instruction."));
+ obj = (const recpy_element_object *)parse_obj;
TRY
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][gdb/python] Fix cpychecker error in recpy_bt_goto
2018-10-04 18:08 [PATCH][gdb/python] Fix cpychecker error in recpy_bt_goto Tom de Vries
@ 2018-10-04 22:12 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2018-10-04 22:12 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> When using cpychecker, we run into this error:
Thanks for trying this out!
Tom> 2018-10-04 Tom de Vries <tdevries@suse.de>
Tom> * python/py-record-btrace.c (recpy_bt_goto): Fix type mismatch in
Tom> PyArg_ParseTuple call.
Tom> + obj = (const recpy_element_object *)parse_obj;
There should be a space after the close paren.
Ok with that change.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-04 22:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 18:08 [PATCH][gdb/python] Fix cpychecker error in recpy_bt_goto Tom de Vries
2018-10-04 22:12 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).