aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-06-19 19:18:23 +0200
committerTom de Vries <tdevries@suse.de>2024-06-19 19:18:23 +0200
commitb820cd55a3da42132123a874b69c9be3777c0ca0 (patch)
tree5daf040a0591d7f9a9af930a57d28c46e28a32a2 /gdb/python
parentb49c3a37b197f3cc38e8d70db74f9dd58c31cc32 (diff)
downloadgdb-b820cd55a3da42132123a874b69c9be3777c0ca0.zip
gdb-b820cd55a3da42132123a874b69c9be3777c0ca0.tar.gz
gdb-b820cd55a3da42132123a874b69c9be3777c0ca0.tar.bz2
[gdb/build] Redo poisoning of PyObject_CallMethod
In commit 764af878259 ("[gdb/python] Add typesafe wrapper around PyObject_CallMethod") I added poisoning of PyObject_CallMethod: ... /* Poison PyObject_CallMethod. The typesafe wrapper gdbpy_call_method should be used instead. */ template<typename... Args> PyObject * PyObject_CallMethod (Args...); ... The idea was that subsequent code would be forced to use gdbpy_call_method instead of PyObject_CallMethod. However, that caused build issues with gcc 14 and python 3.13: ... /usr/bin/ld: python/py-disasm.o: in function `gdb::ref_ptr<_object, gdbpy_ref_policy<_object> > gdbpy_call_method<unsigned int, long long>(_object*, char const*, unsigned int, long long)': /data/vries/gdb/src/gdb/python/python-internal.h:207:(.text+0x384f): undefined reference to `_object* PyObject_CallMethod<_object*, char*, char*, unsigned int, long long>(_object*, char*, char*, unsigned int, long long)' /usr/bin/ld: python/py-tui.o: in function `gdb::ref_ptr<_object, gdbpy_ref_policy<_object> > gdbpy_call_method<int>(_object*, char const*, int)': /data/vries/gdb/src/gdb/python/python-internal.h:207:(.text+0x1235): undefined reference to `_object* PyObject_CallMethod<_object*, char*, char*, int>(_object*, char*, char*, int)' /usr/bin/ld: python/py-tui.o: in function `gdb::ref_ptr<_object, gdbpy_ref_policy<_object> > gdbpy_call_method<int, int, int>(_object*, char const*, int, int, int)': /data/vries/gdb/src/gdb/python/python-internal.h:207:(.text+0x12b0): undefined reference to `_object* PyObject_CallMethod<_object*, char*, char*, int, int, int>(_object*, char*, char*, int, int, int)' collect2: error: ld returned 1 exit status ... Fix this by poisoning without using templates. Tested on x86_64-linux.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/python-internal.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index fec0010..f25cd3b 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -231,9 +231,11 @@ gdbpy_call_method (const gdbpy_ref<> &o, const char *method, Args... args)
/* Poison PyObject_CallMethod. The typesafe wrapper gdbpy_call_method should be
used instead. */
#undef PyObject_CallMethod
-template<typename... Args>
-PyObject *
-PyObject_CallMethod (Args...);
+#ifdef __GNUC__
+# pragma GCC poison PyObject_CallMethod
+#else
+# define PyObject_CallMethod POISONED_PyObject_CallMethod
+#endif
/* The 'name' parameter of PyErr_NewException was missing the 'const'
qualifier in Python <= 3.4. Hence, we wrap it in a function to