Hi, It looks to me that ppc-sysv-tdep.c:do_ppc_sysv_return_value doesn't consider the case that returning a small struct (size <= 8) whose size is not 4 or 8. Supposing we have a struct defined as below, struct C {char c1; char c2; char c3;}; struct C c; c.c1 = 'a'; c.c2 = 'b'; c.c3 = 'c'; The raw memory content of c is 0x616263XX (big-endian) or 0xXX636261 (little-endian). When returning c, according to Power Arch ABI: "Aggregates or unions whose size is less than or equal to eight bytes shall be returned in r3 and r4, as if they were first stored in memory area and then the low-addressed word were loaded in r3 and the high-addressed word were loaded into r4.", the content of r3 should be 0x616263 (big-endian) or 0x636261 (little-endian). When gdb reads r3's content via regcache_cooked_read into a buf, the content of buf looks like this, buf: [0] [1] [2] [3] big-endian : 00 61 62 63 little-endian : 61 62 63 00 later, when we copy the contents of buf to readbuf, we should skip 00. Current code in gdb doesn't consider this, but it works in little-endian. This patch is going to fix this issue. Regression tested on a powerpc variant board. Many fails in gdb.base/structs.exp are fixed. Is this patch OK? -- Yao (齐尧)