From 58a628530ee68fe705b443947643037319e7d44e Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 10 Jun 2024 17:53:30 +0200 Subject: [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 : \ 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 PR python/31845 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31845 [1] https://docs.python.org/3/c-api/arg.html --- gdb/python/python-internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb') 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 -- cgit v1.1