/* Encoding of addresses. */
unsigned char encoding;
+ /* True if a 'z' augmentation existed. */
+ unsigned char saw_z_augmentation;
+
struct dwarf2_cie *next;
};
cache->reg[regnum] = fs->regs.reg[reg];
}
- /* Stored the location of the return addess. */
- if (fs->retaddr_column < fs->regs.num_regs)
+ /* Store the location of the return addess. If the return address
+ column (adjusted) is not the same as gdb's PC_REGNUM, then this
+ implies a copy from the ra column register. */
+ if (fs->retaddr_column < fs->regs.num_regs
+ && fs->regs.reg[fs->retaddr_column].how != REG_UNSAVED)
cache->reg[PC_REGNUM] = fs->regs.reg[fs->retaddr_column];
+ else
+ {
+ reg = DWARF2_REG_TO_REGNUM (fs->retaddr_column);
+ if (reg != PC_REGNUM)
+ {
+ cache->reg[PC_REGNUM].loc.reg = reg;
+ cache->reg[PC_REGNUM].how = REG_SAVED_REG;
+ }
+ }
do_cleanups (old_chain);
cie->return_address_register = read_1_byte (unit->abfd, buf);
buf += 1;
- if (*augmentation == 'z')
+ cie->saw_z_augmentation = (*augmentation == 'z');
+ if (cie->saw_z_augmentation)
{
ULONGEST length;
read_encoded_value (unit, fde->cie->encoding & 0x0f, buf, &bytes_read);
buf += bytes_read;
+ /* A 'z' augmentation in the CIE implies the presence of an
+ augmentation field in the FDE as well. The only thing known
+ to be in here at present is the LSDA entry for EH. So we
+ can skip the whole thing. */
+ if (fde->cie->saw_z_augmentation)
+ {
+ ULONGEST length;
+
+ length = read_unsigned_leb128 (unit->abfd, buf, &bytes_read);
+ buf += bytes_read + length;
+ }
+
fde->instructions = buf;
fde->end = end;