]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix dynamic type resolution for LOC_CONST and LOC_CONST_BYTES symbols
authorTom Tromey <tom@tromey.com>
Mon, 27 Nov 2023 23:44:22 +0000 (16:44 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 8 Dec 2023 14:08:26 +0000 (07:08 -0700)
commit703adbb1f97db52ed63b2a6a074195b1cee0f132
tree9f763d4ac86fa8f7bcf7c21769329108efd650e1
parentaaba0d3a1aae0fcf779a7f727064365612ad5837
Fix dynamic type resolution for LOC_CONST and LOC_CONST_BYTES symbols

PR rust/31005 points out that dynamic type resolution of a LOC_CONST
or LOC_CONST_BYTES symbol will fail, leading to output like:

    from_index=<error reading variable: Cannot access memory at address 0x0>

This patch fixes the problem by using the constant value or bytes when
performing type resolution.

Thanks to tpzker@thepuzzlemaker.info for a first version of this
patch.

I also tested this on a big-endian PPC system (cfarm203).

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31005
gdb/findvar.c
gdb/testsuite/gdb.dwarf2/rust-enum.exp [new file with mode: 0644]