Commit 7d9d8943 by Andrew Macleod Committed by Jason Merrill

dwarf2.h (enum dwarf_call_frame_info): Add DW_CFA_def_cfa_expression.

        * dwarf2.h (enum dwarf_call_frame_info): Add
        DW_CFA_def_cfa_expression.
        * dwarf2out.c (union dw_cfi_oprnd_struct): Add a pointer to a
        dw_loc_descr_struct entry.
        (struct cfa_loc): New structure to track a CFA location.
        (lookup_cfa): Take a cfa_loc parameter instead of a reg and an offset.
        (lookup_cfa_1): Take a cfa_loc parameter instead of a reg and an
        offset, plus handle DW_CFA_def_cfa_expression.
        (def_cfa_1): Use to be dwarf2out_def_cfa, only now it uses a
        cfa_loc record.
        (dwarf2out_def_cfa): Entry point maintained for compatability.
        (dwarf_cfi_name): Add DW_CFA_def_cfa_expression.
        (cfa_reg, cfa_offset): Replace with cfa_loc record 'cfa'.
        (cfa_store_reg, cfa_store_offset): Replace with cfa_loc 'cfa_store'.
        (initial_return_save, dwarf2out_stack_adjust): Use cfa.reg, not
        cfa_reg.
        (dwarf2out_frame_debug_expr): Use new cfa_loc records. Recognize rtl
        sequences for the new DW_CFA_def_cfa_expression record.
        (dwarf2out_frame_debug): Use new variables/fields.A
        (output_cfi): Handle DW_CFA_def_cfa_expression.
        (output_cfa_loc): New function to generate a CFI record for
        DW_CFA_def_cfa_expression.
        (get_cfa_from_loc_descr): New function to get a cfa_loc record from
        a dw_loc_descr sequeunce.
        (build_loc_descr): Build a dw_loc_descr from a cfa_loc record.
        (dwarf_stack_op_name, new_loc_descr, add_loc_descr, size_of_loc_descr,
        size_of_locs, output_loc_operands, output_loc_sequence): Move into
        unwind info section.
        * frame.h (frame_state): Add base_offset and indirect fields.
        * frame-dwarf2.c (decode_stack_op): New function to interpret a
        dw_loc_descr operation.
        (execute_cfa_insn): Add support for DW_CFA_def_cfa_expression.
        (struct frame_state): Add base offset and indirect fields.
        * libgcc2.c (next_stack_level): Support indirect loading for CFA.

From-SVN: r34717
parent 4540727a
2000-06-26 Andrew Macleod <amacleod@cygnus.com>
Jason Merrill <jason@redhat.com>
* dwarf2.h (enum dwarf_call_frame_info): Add
DW_CFA_def_cfa_expression.
* dwarf2out.c (union dw_cfi_oprnd_struct): Add a pointer to a
dw_loc_descr_struct entry.
(struct cfa_loc): New structure to track a CFA location.
(lookup_cfa): Take a cfa_loc parameter instead of a reg and an offset.
(lookup_cfa_1): Take a cfa_loc parameter instead of a reg and an
offset, plus handle DW_CFA_def_cfa_expression.
(def_cfa_1): Use to be dwarf2out_def_cfa, only now it uses a
cfa_loc record.
(dwarf2out_def_cfa): Entry point maintained for compatability.
(dwarf_cfi_name): Add DW_CFA_def_cfa_expression.
(cfa_reg, cfa_offset): Replace with cfa_loc record 'cfa'.
(cfa_store_reg, cfa_store_offset): Replace with cfa_loc 'cfa_store'.
(initial_return_save, dwarf2out_stack_adjust): Use cfa.reg, not
cfa_reg.
(dwarf2out_frame_debug_expr): Use new cfa_loc records. Recognize rtl
sequences for the new DW_CFA_def_cfa_expression record.
(dwarf2out_frame_debug): Use new variables/fields.A
(output_cfi): Handle DW_CFA_def_cfa_expression.
(output_cfa_loc): New function to generate a CFI record for
DW_CFA_def_cfa_expression.
(get_cfa_from_loc_descr): New function to get a cfa_loc record from
a dw_loc_descr sequeunce.
(build_loc_descr): Build a dw_loc_descr from a cfa_loc record.
(dwarf_stack_op_name, new_loc_descr, add_loc_descr, size_of_loc_descr,
size_of_locs, output_loc_operands, output_loc_sequence): Move into
unwind info section.
* frame.h (frame_state): Add base_offset and indirect fields.
* frame-dwarf2.c (decode_stack_op): New function to interpret a
dw_loc_descr operation.
(execute_cfa_insn): Add support for DW_CFA_def_cfa_expression.
(struct frame_state): Add base offset and indirect fields.
* libgcc2.c (next_stack_level): Support indirect loading for CFA.
2000-06-26 Joseph S. Myers <jsm28@cam.ac.uk> 2000-06-26 Joseph S. Myers <jsm28@cam.ac.uk>
* c-decl.c (grokdeclarator): Don't warn about `long long' in C99. * c-decl.c (grokdeclarator): Don't warn about `long long' in C99.
...@@ -76,7 +114,7 @@ ...@@ -76,7 +114,7 @@
2000-06-24 Marc Espie <espie@cvs.openbsd.org> 2000-06-24 Marc Espie <espie@cvs.openbsd.org>
* collect2.c (resolve_lib_name): Move '/' check to more rational place. * collect2.c (resolve_lib_name): Move '/' check out of loop.
2000-06-24 Dirk Duellmann <Dirk.Duellmann@cern.ch> 2000-06-24 Dirk Duellmann <Dirk.Duellmann@cern.ch>
......
...@@ -497,6 +497,8 @@ enum dwarf_call_frame_info ...@@ -497,6 +497,8 @@ enum dwarf_call_frame_info
DW_CFA_def_cfa = 0x0c, DW_CFA_def_cfa = 0x0c,
DW_CFA_def_cfa_register = 0x0d, DW_CFA_def_cfa_register = 0x0d,
DW_CFA_def_cfa_offset = 0x0e, DW_CFA_def_cfa_offset = 0x0e,
DW_CFA_def_cfa_expression = 0x0f,
DW_CFA_expression = 0x10,
/* SGI/MIPS specific */ /* SGI/MIPS specific */
DW_CFA_MIPS_advance_loc8 = 0x1d, DW_CFA_MIPS_advance_loc8 = 0x1d,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -466,6 +466,108 @@ extract_cie_info (fde *f, struct cie_info *c) ...@@ -466,6 +466,108 @@ extract_cie_info (fde *f, struct cie_info *c)
return p; return p;
} }
/* Decode a DW_OP stack operation. */
static void *
decode_stack_op (unsigned char *buf, struct frame_state *state)
{
enum dwarf_location_atom op;
int offset;
op = *buf++;
switch (op)
{
case DW_OP_reg0:
case DW_OP_reg1:
case DW_OP_reg2:
case DW_OP_reg3:
case DW_OP_reg4:
case DW_OP_reg5:
case DW_OP_reg6:
case DW_OP_reg7:
case DW_OP_reg8:
case DW_OP_reg9:
case DW_OP_reg10:
case DW_OP_reg11:
case DW_OP_reg12:
case DW_OP_reg13:
case DW_OP_reg14:
case DW_OP_reg15:
case DW_OP_reg16:
case DW_OP_reg17:
case DW_OP_reg18:
case DW_OP_reg19:
case DW_OP_reg20:
case DW_OP_reg21:
case DW_OP_reg22:
case DW_OP_reg23:
case DW_OP_reg24:
case DW_OP_reg25:
case DW_OP_reg26:
case DW_OP_reg27:
case DW_OP_reg28:
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
state->cfa_reg = op - DW_OP_reg0;
break;
case DW_OP_regx:
buf = decode_sleb128 (buf, &offset);
state->cfa_reg = offset;
case DW_OP_breg0:
case DW_OP_breg1:
case DW_OP_breg2:
case DW_OP_breg3:
case DW_OP_breg4:
case DW_OP_breg5:
case DW_OP_breg6:
case DW_OP_breg7:
case DW_OP_breg8:
case DW_OP_breg9:
case DW_OP_breg10:
case DW_OP_breg11:
case DW_OP_breg12:
case DW_OP_breg13:
case DW_OP_breg14:
case DW_OP_breg15:
case DW_OP_breg16:
case DW_OP_breg17:
case DW_OP_breg18:
case DW_OP_breg19:
case DW_OP_breg20:
case DW_OP_breg21:
case DW_OP_breg22:
case DW_OP_breg23:
case DW_OP_breg24:
case DW_OP_breg25:
case DW_OP_breg26:
case DW_OP_breg27:
case DW_OP_breg28:
case DW_OP_breg29:
case DW_OP_breg30:
case DW_OP_breg31:
state->cfa_reg = op - DW_OP_breg0;
buf = decode_sleb128 (buf, &offset);
state->base_offset = offset;
break;
case DW_OP_bregx:
buf = decode_sleb128 (buf, &offset);
state->cfa_reg = offset;
buf = decode_sleb128 (buf, &offset);
state->base_offset = offset;
break;
case DW_OP_deref:
state->indirect = 1;
break;
case DW_OP_plus_uconst:
buf = decode_uleb128 (buf, &offset);
state->cfa_offset = offset;
break;
default:
abort ();
}
return buf;
}
/* Decode one instruction's worth of DWARF 2 call frame information. /* Decode one instruction's worth of DWARF 2 call frame information.
Used by __frame_state_for. Takes pointers P to the instruction to Used by __frame_state_for. Takes pointers P to the instruction to
decode, STATE to the current register unwind information, INFO to the decode, STATE to the current register unwind information, INFO to the
...@@ -567,6 +669,20 @@ execute_cfa_insn (void *p, struct frame_state_internal *state, ...@@ -567,6 +669,20 @@ execute_cfa_insn (void *p, struct frame_state_internal *state,
p = decode_uleb128 (p, &offset); p = decode_uleb128 (p, &offset);
state->s.cfa_offset = offset; state->s.cfa_offset = offset;
break; break;
case DW_CFA_def_cfa_expression:
{
void *end;
state->s.cfa_reg = 0;
state->s.cfa_offset = 0;
state->s.base_offset = 0;
state->s.indirect = 0;
p = decode_uleb128 (p, &offset);
end = p + offset;
while (p < end)
p = decode_stack_op (p, &(state->s));
break;
}
case DW_CFA_remember_state: case DW_CFA_remember_state:
{ {
......
/* Header file for unwinding stack frames for exception handling. */ /* Header file for unwinding stack frames for exception handling. */
/* Compile this one with gcc. */ /* Compile this one with gcc. */
/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>. Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -30,11 +30,13 @@ typedef struct frame_state ...@@ -30,11 +30,13 @@ typedef struct frame_state
void *cfa; void *cfa;
void *eh_ptr; void *eh_ptr;
long cfa_offset; long cfa_offset;
long base_offset;
long args_size; long args_size;
long reg_or_offset[DWARF_FRAME_REGISTERS+1]; long reg_or_offset[DWARF_FRAME_REGISTERS+1];
unsigned short cfa_reg; unsigned short cfa_reg;
unsigned short retaddr_column; unsigned short retaddr_column;
char saved[DWARF_FRAME_REGISTERS+1]; char saved[DWARF_FRAME_REGISTERS+1];
char indirect;
} frame_state; } frame_state;
/* Values for 'saved' above. */ /* Values for 'saved' above. */
......
...@@ -3711,6 +3711,9 @@ next_stack_level (void *pc, frame_state *udata, frame_state *caller_udata) ...@@ -3711,6 +3711,9 @@ next_stack_level (void *pc, frame_state *udata, frame_state *caller_udata)
caller_udata->cfa = get_reg (caller_udata->cfa_reg, udata, 0); caller_udata->cfa = get_reg (caller_udata->cfa_reg, udata, 0);
else else
caller_udata->cfa = udata->cfa; caller_udata->cfa = udata->cfa;
if (caller_udata->indirect)
caller_udata->cfa = *(word_type *)((unsigned char *)caller_udata->cfa
+ caller_udata->base_offset);
caller_udata->cfa += caller_udata->cfa_offset; caller_udata->cfa += caller_udata->cfa_offset;
return caller_udata; return caller_udata;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment