diff options
author | Tom de Vries <tdevries@suse.de> | 2024-06-20 15:54:16 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-06-20 15:54:16 +0200 |
commit | 1aa3b72f07269a0a678ba2de2481d84c74f1c117 (patch) | |
tree | 00cc10551281afcc6eeabdf7fc7b29f23d57e366 /texinfo | |
parent | 9c6d76c0d75cff21905b8c18c2b4933af9cded93 (diff) | |
download | gdb-1aa3b72f07269a0a678ba2de2481d84c74f1c117.zip gdb-1aa3b72f07269a0a678ba2de2481d84c74f1c117.tar.gz gdb-1aa3b72f07269a0a678ba2de2481d84c74f1c117.tar.bz2 |
[gdb/python] Fix gdb.python/py-disasm.exp on arm-linux
After fixing test-case gdb.python/py-disasm.exp to recognize the arm nop:
...
nop {0}
...
we run into:
...
disassemble test^M
Dump of assembler code for function test:^M
0x004004d8 <+0>: push {r11} @ (str r11, [sp, #-4]!)^M
0x004004dc <+4>: add r11, sp, #0^M
0x004004e0 <+8>: nop {0}^M
=> 0x004004e4 <+12>: 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: global_disassembler=ShowInfoRepr: disassemble test
...
This is caused by this code in gdbpy_disassembler::read_memory_func:
...
gdbpy_ref<> result_obj (PyObject_CallMethod ((PyObject *) obj,
"read_memory",
"KL", len, offset));
...
where len has type "unsigned int", while "K" means "unsigned long long" [1].
Fix this by using "I" instead, meaning "unsigned int".
Also, offset has type LONGEST, which is typedef'ed to int64_t, while "L" means
"long long".
Fix this by using type gdb_py_longest for offset, in combination with format
character "GDB_PY_LL_ARG". Likewise in disasmpy_info_read_memory.
Tested on arm-linux.
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
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
(cherry picked from commit 4cd214dce4579f86a85a96c882e0fc8c4d94601c)
Diffstat (limited to 'texinfo')
0 files changed, 0 insertions, 0 deletions