I have a test case (I've attached the C source) which exhibits bad behavior in gdb on x86-64: (gdb) b 30 Breakpoint 1 at 0x400463: file typeddwarf.c, line 30. (gdb) r Starting program: /tmp/t Breakpoint 1, f1 (a=, b=, c=, d=, e=, f=6, g=7, h=8, i=9) at typeddwarf.c:30 30 } (gdb) p s $1 = However, 's' is not really unavailable: (gdb) info addr s Symbol "s" is a complex DWARF expression: 0: DW_OP_GNU_regval_type [$xmm2] 3: DW_OP_GNU_convert 5: DW_OP_GNU_convert<0> 7: DW_OP_stack_value . (gdb) p (long) $xmm2.v2_double[0] $3 = 3 The issue here is that DWARF uses the same register numbers for the XMM and YMM registers, and in this case the high parts of the YMM registers are unavailable. This causes the special code in i386_pseudo_register_read for YMM to return REG_UNAVAILABLE. This patch fixes the problem by letting an arch register a new pseudo_register_read_value method, which is responsible for constructing a struct value for the register. This gives us a chance to mark just some bits unavailable. With the modified gdb, the test works: (gdb) b 30 Breakpoint 1 at 0x400463: file typeddwarf.c, line 30. (gdb) r Starting program: /tmp/t Breakpoint 1, f1 (a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=9) at typeddwarf.c:30 30 } (gdb) p s $1 = 3 I would appreciate feedback on this patch. I considered several other approaches: * Put the XCR0 bits into the regcache. This would let us dynamically decide whether to return the XMM or YMM register. This seemed to mean treating XCR0 as a real register (which AFAICT it is not, right now), which meant also gdbserver changes. * Rather than a way to return values, have a different API, say one where gdb requests the first N bytes of a register. This may still be cleaner, I am not sure. Optionally this could be the only way, meaning a patch touching most existing callers. I don't think this patch yet hits all the spots I would need to change. E.g., "print $ymm2" shows all fields as , but that is incorrect. I'll turn the test case into part of the patch when I finalize this change. Tom