From d1cab9876d72d867b2de82688f5f5a2a4b655edb Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Sep 2020 11:08:56 -0600 Subject: Don't use gdb_py_long_from_ulongest Remove the gdb_py_long_from_ulongest defines and change the Python layer to prefer gdb_py_object_from_ulongest. While writing this I noticed that the error handling in archpy_disassemble was incorrect -- it could call PyDict_SetItemString with a NULL value. This patch also fixes this bug. gdb/ChangeLog 2020-09-15 Tom Tromey * python/python-internal.h (gdb_py_long_from_ulongest): Remove defines. * python/py-value.c (valpy_long): Use gdb_py_object_from_ulongest. * python/py-symtab.c (salpy_get_pc): Use gdb_py_object_from_ulongest. (salpy_get_last): Likewise. * python/py-record-btrace.c (recpy_bt_insn_pc): Use gdb_py_object_from_ulongest. * python/py-lazy-string.c (stpy_get_address): Use gdb_py_object_from_ulongest. * python/py-frame.c (frapy_pc): Use gdb_py_object_from_ulongest. * python/py-arch.c (archpy_disassemble): Use gdb_py_object_from_ulongest and gdb_py_object_from_longest. Fix error handling. --- gdb/python/py-symtab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/python/py-symtab.c') diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index 6229bc5..b0e7618 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -264,7 +264,7 @@ salpy_get_pc (PyObject *self, void *closure) SALPY_REQUIRE_VALID (self, sal); - return gdb_py_long_from_ulongest (sal->pc); + return gdb_py_object_from_ulongest (sal->pc).release (); } /* Implementation of the get method for the 'last' attribute of @@ -278,7 +278,7 @@ salpy_get_last (PyObject *self, void *closure) SALPY_REQUIRE_VALID (self, sal); if (sal->end > 0) - return gdb_py_long_from_ulongest (sal->end - 1); + return gdb_py_object_from_ulongest (sal->end - 1).release (); else Py_RETURN_NONE; } -- cgit v1.1