Index: sparc-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/sparc-tdep.c,v retrieving revision 1.156 diff -u -p -r1.156 sparc-tdep.c --- sparc-tdep.c 21 Nov 2004 20:11:09 -0000 1.156 +++ sparc-tdep.c 23 Nov 2004 05:01:15 -0000 @@ -640,6 +640,17 @@ sparc_frame_cache (struct frame_info *ne return cache; } +/* Return True if the instruction corresponding to PC is a "unimp" + instruction. */ + +static int +is_unimp_insn (CORE_ADDR pc) +{ + const unsigned long insn = sparc_fetch_instruction (pc); + + return ((insn & 0xc1c00000) == 0); +} + struct sparc_frame_cache * sparc32_frame_cache (struct frame_info *next_frame, void **this_cache) { @@ -665,6 +676,21 @@ sparc32_frame_cache (struct frame_info * cache->struct_return_p = 1; } } + else + { + /* There is no debugging information for this function to + help us determine whether this function returns a struct + or not. So we rely on another heuristic which is to check + the instruction at the return address and see if this is + a "unimp" instruction. If it is, then it is struct-return + function. */ + CORE_ADDR pc; + int regnum = cache->frameless_p ? SPARC_O7_REGNUM : SPARC_I7_REGNUM; + + pc = frame_unwind_register_unsigned (next_frame, regnum) + 8; + if (is_unimp_insn (pc)) + cache->struct_return_p = 1; + } return cache; }