aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-06-27 12:47:26 +0200
committerTom de Vries <tdevries@suse.de>2022-06-27 12:47:26 +0200
commit2135495484109f888167287cca249be9d84ed535 (patch)
treedb901801f555dc0124dce751151b7c728518724f /binutils/dwarf.c
parent772f8196d621a8009035ff4cb8aab2d7343269a9 (diff)
downloadgdb-2135495484109f888167287cca249be9d84ed535.zip
gdb-2135495484109f888167287cca249be9d84ed535.tar.gz
gdb-2135495484109f888167287cca249be9d84ed535.tar.bz2
[gdb/testsuite] Handle older python in gdb.python/py-send-packet.py
With python 3.4, I run into: ... Traceback (most recent call last):^M File "<string>", line 1, in <module>^M File "outputs/gdb.python/py-send-packet/py-send-packet.py", line 128, in \ run_set_global_var_test^M res = conn.send_packet(b"X%x,4:\x02\x02\x02\x02" % addr)^M TypeError: Could not convert Python object: b'X%x,4:\x02\x02\x02\x02'.^M Error while executing Python code.^M ... while with python 3.6 this works fine. The type of addr is <class 'gdb.Value'>, so the first thing to try is whether changing it into a string works: ... addr_str = "%x" % addr res = conn.send_packet(b"X%s,4:\x02\x02\x02\x02" % addr_str) ... which gets us the more detailed: ... TypeError: unsupported operand type(s) for %: 'bytes' and 'str' ... Fix this by avoiding the '%' operator in the byte literal, and use instead: ... def xpacket_header (addr): return ("X%x,4:" % addr).encode('ascii') ... res = conn.send_packet(xpacket_header(addr) + b"\x02\x02\x02\x02") ... Tested on x86_64-linux, with python 3.4 and 3.6, and a backported version was tested on the gdb-12-branch in combination with python 2.7.
Diffstat (limited to 'binutils/dwarf.c')
0 files changed, 0 insertions, 0 deletions