diff options
author | Tom de Vries <tdevries@suse.de> | 2024-06-10 17:53:30 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-06-10 17:53:30 +0200 |
commit | 58a628530ee68fe705b443947643037319e7d44e (patch) | |
tree | 1adeb669a90c61c0ec70dbfa3def3a9816eb7537 /gdb | |
parent | 4cd214dce4579f86a85a96c882e0fc8c4d94601c (diff) | |
download | gdb-58a628530ee68fe705b443947643037319e7d44e.zip gdb-58a628530ee68fe705b443947643037319e7d44e.tar.gz gdb-58a628530ee68fe705b443947643037319e7d44e.tar.bz2 |
[gdb/python] Fix GDB_PY_{LL,LLU}_ARG on platform without long long
If in gdb/python/python-internal.h, we pretend to have a platform that doesn't
support long long:
...
-#ifdef HAVE_LONG_LONG
+#if 0
...
I get on arm-linux:
...
(gdb) placement_candidate()
disassemble test^M
Dump of assembler code for function test:^M
0x004004d8 <+0>: push {r11} @ (str r11, [sp, #-4]!)^M
0x004004dc <+4>: Python Exception <class 'ValueError'>: \
Buffer returned from read_memory is sized 0 instead of the expected 4^M
^M
unknown disassembler error (error = -1)^M
(gdb) FAIL: $exp: memory source api: second disassembler pass
...
The problem is that gdb_py_longest is typedef-ed to long, but the
corresponding format character GDB_PY_LL_ARG is defined to "L", meaning
"long long" [1].
Fix this by using "l", meaning long instead. Likewise for GDB_PY_LLU_ARG.
Tested on arm-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR python/31845
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31845
[1] https://docs.python.org/3/c-api/arg.html
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/python/python-internal.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 3c45056..d07f239 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -125,8 +125,8 @@ typedef unsigned PY_LONG_LONG gdb_py_ulongest; #else /* HAVE_LONG_LONG */ -#define GDB_PY_LL_ARG "L" -#define GDB_PY_LLU_ARG "K" +#define GDB_PY_LL_ARG "l" +#define GDB_PY_LLU_ARG "k" typedef long gdb_py_longest; typedef unsigned long gdb_py_ulongest; #define gdb_py_long_as_ulongest PyLong_AsUnsignedLong |