Files
binutils-gdb/gdb/testsuite/gdb.cp
Keith Seitz be10a32638 should_validate_memtags: Do not dereference references
should_validate_memtags uses value_as_address to evalute
whether an address for a value is tagged. The comments for
that function simply say, "Extract a value as a C pointer."

While that sounds innoncuous, that function calls coerce_array,
which will dereference any references.  This is not what is
desired here.

This can be demonstrated on an MTE-enabled host, such as aarch64-
based Ampere (example taken from tests introduced in this patch):

(gdb) p b.get_foo ()
Could not validate memory tag: Value can't be converted to integer.
$2 = (const foo &) @0xffffffffed88: {m_a = 42}

While the command completes, gdb didn't actually attempt to
evaluate any memory tags.

Fix this by using unpack_pointer instead.

Tested on x86_64 Fedora 40 and aarch64 RHEL 9.6.
2025-08-08 11:01:54 -07:00
..
2025-04-08 10:54:39 -06:00
2025-04-08 10:54:39 -06:00
2025-04-08 10:54:39 -06:00
2025-04-08 10:54:39 -06:00
2025-05-06 14:48:57 -06:00