Index: rs6000-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v retrieving revision 1.233 diff -u -p -r1.233 rs6000-tdep.c --- rs6000-tdep.c 25 Nov 2004 02:48:27 -0000 1.233 +++ rs6000-tdep.c 9 Dec 2004 15:40:46 -0000 @@ -823,6 +823,30 @@ store_param_on_stack_p (unsigned long op return 0; } +/* Assuming that INSN is a "bl" instruction located at PC, return + nonzero if the destination of the branch is a "blrl" instruction. + + This sequence is sometimes found in certain function prologues. + It allows the function to load the LR register with a value that + they can use to access PIC data using PC-relative offsets. */ + +static int +bl_to_blrl_insn_p (CORE_ADDR pc, int insn) +{ + const int opcode = 18; + const CORE_ADDR dest = branch_dest (opcode, insn, pc, -1); + int dest_insn; + + if (dest == -1) + return 0; /* Should never happen, but just return zero to be safe. */ + + dest_insn = read_memory_integer (dest, 4); + if ((dest_insn & 0xfc00ffff) == 0x4c000021) /* blrl */ + return 1; + + return 0; +} + static CORE_ADDR skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata) { @@ -1047,19 +1071,9 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l to save fprs??? */ fdata->frameless = 0; - /* Don't skip over the subroutine call if it is not within - the first three instructions of the prologue and either - we have no line table information or the line info tells - us that the subroutine call is not part of the line - associated with the prologue. */ - if ((pc - orig_pc) > 8) - { - struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0); - struct symtab_and_line this_sal = find_pc_line (pc, 0); - if ((prologue_sal.line == 0) || (prologue_sal.line != this_sal.line)) - break; - } + if (bl_to_blrl_insn_p (pc, op)) + continue; op = read_memory_integer (pc + 4, 4);