|
Jakub Jelinek |
fcbcff |
--- valgrind/coregrind/m_debuginfo/readdwarf.c.jj 2009-07-13 14:09:14.478329957 +0200
|
|
Jakub Jelinek |
fcbcff |
+++ valgrind/coregrind/m_debuginfo/readdwarf.c 2009-07-13 15:18:35.596080042 +0200
|
|
Jakub Jelinek |
fcbcff |
@@ -1923,6 +1923,11 @@ static void ppRegRule ( XArray* exprs, R
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
+/* Size of the stack of register unwind rules. This is only
|
|
Jakub Jelinek |
fcbcff |
+ exceedingly rarely used, so a stack of size 1 should actually work
|
|
Jakub Jelinek |
fcbcff |
+ with almost all compiler-generated CFA. */
|
|
Jakub Jelinek |
fcbcff |
+#define N_RR_STACK 4
|
|
Jakub Jelinek |
fcbcff |
+
|
|
Jakub Jelinek |
fcbcff |
typedef
|
|
Jakub Jelinek |
fcbcff |
struct {
|
|
Jakub Jelinek |
fcbcff |
/* Read-only fields (set by the CIE) */
|
|
Jakub Jelinek |
fcbcff |
@@ -1939,8 +1944,12 @@ typedef
|
|
Jakub Jelinek |
fcbcff |
Int cfa_reg;
|
|
Jakub Jelinek |
fcbcff |
Int cfa_off; /* in bytes */
|
|
Jakub Jelinek |
fcbcff |
Int cfa_expr_ix; /* index into cfa_exprs */
|
|
Jakub Jelinek |
fcbcff |
- /* register unwind rules */
|
|
Jakub Jelinek |
fcbcff |
- RegRule reg[N_CFI_REGS];
|
|
Jakub Jelinek |
fcbcff |
+ /* A stack of register unwind rules. We need a stack of them,
|
|
Jakub Jelinek |
fcbcff |
+ rather than just one set of rules, in order to handle
|
|
Jakub Jelinek |
fcbcff |
+ DW_CFA_{remember,restore}_state. */
|
|
Jakub Jelinek |
fcbcff |
+ RegRule reg[N_RR_STACK][N_CFI_REGS];
|
|
Jakub Jelinek |
fcbcff |
+ Int reg_sp; /* 0 <= reg_sp < N_RR_STACK; points at the
|
|
Jakub Jelinek |
fcbcff |
+ currently-in-use rule set. */
|
|
Jakub Jelinek |
fcbcff |
/* array of CfiExpr, shared by reg[] and cfa_expr_ix */
|
|
Jakub Jelinek |
fcbcff |
XArray* exprs;
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
@@ -1948,7 +1957,7 @@ typedef
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
static void ppUnwindContext ( UnwindContext* ctx )
|
|
Jakub Jelinek |
fcbcff |
{
|
|
Jakub Jelinek |
fcbcff |
- Int i;
|
|
Jakub Jelinek |
fcbcff |
+ Int j, i;
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("0x%llx: ", (ULong)ctx->loc);
|
|
Jakub Jelinek |
fcbcff |
if (ctx->cfa_is_regoff) {
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("%d(r%d) ", ctx->cfa_off, ctx->cfa_reg);
|
|
Jakub Jelinek |
fcbcff |
@@ -1958,14 +1967,19 @@ static void ppUnwindContext ( UnwindCont
|
|
Jakub Jelinek |
fcbcff |
ML_(ppCfiExpr)( ctx->exprs, ctx->cfa_expr_ix );
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("} ");
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
- for (i = 0; i < N_CFI_REGS; i++)
|
|
Jakub Jelinek |
fcbcff |
- ppRegRule(ctx->exprs, &ctx->reg[i]);
|
|
Jakub Jelinek |
fcbcff |
+ for (j = 0; j <= ctx->reg_sp; j++) {
|
|
Jakub Jelinek |
fcbcff |
+ VG_(printf)("%s[%d]={ ", j > 0 ? " " : "", j);
|
|
Jakub Jelinek |
fcbcff |
+ for (i = 0; i < N_CFI_REGS; i++)
|
|
Jakub Jelinek |
fcbcff |
+ ppRegRule(ctx->exprs, &ctx->reg[j][i]);
|
|
Jakub Jelinek |
fcbcff |
+ VG_(printf)("}");
|
|
Jakub Jelinek |
fcbcff |
+ }
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("\n");
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
static void initUnwindContext ( /*OUT*/UnwindContext* ctx )
|
|
Jakub Jelinek |
fcbcff |
{
|
|
Jakub Jelinek |
fcbcff |
- Int i;
|
|
Jakub Jelinek |
fcbcff |
+ Int j, i;
|
|
Jakub Jelinek |
fcbcff |
+ VG_(memset)(ctx, 0, sizeof(*ctx));
|
|
Jakub Jelinek |
fcbcff |
ctx->code_a_f = 0;
|
|
Jakub Jelinek |
fcbcff |
ctx->data_a_f = 0;
|
|
Jakub Jelinek |
fcbcff |
ctx->initloc = 0;
|
|
Jakub Jelinek |
fcbcff |
@@ -1976,9 +1990,12 @@ static void initUnwindContext ( /*OUT*/U
|
|
Jakub Jelinek |
fcbcff |
ctx->cfa_off = 0;
|
|
Jakub Jelinek |
fcbcff |
ctx->cfa_expr_ix = 0;
|
|
Jakub Jelinek |
fcbcff |
ctx->exprs = NULL;
|
|
Jakub Jelinek |
fcbcff |
- for (i = 0; i < N_CFI_REGS; i++) {
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[i].tag = RR_Undef;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[i].arg = 0;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg_sp = 0;
|
|
Jakub Jelinek |
fcbcff |
+ for (j = 0; j < N_RR_STACK; j++) {
|
|
Jakub Jelinek |
fcbcff |
+ for (i = 0; i < N_CFI_REGS; i++) {
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[j][i].tag = RR_Undef;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[j][i].arg = 0;
|
|
Jakub Jelinek |
fcbcff |
+ }
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
@@ -2104,8 +2121,15 @@ static Bool summarise_context( /*OUT*/Di
|
|
Jakub Jelinek |
fcbcff |
why = 2; goto failed; /* otherwise give up */ \
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
- SUMMARISE_HOW(si->ra_how, si->ra_off, ctx->reg[ctx->ra_reg] );
|
|
Jakub Jelinek |
fcbcff |
- SUMMARISE_HOW(si->fp_how, si->fp_off, ctx->reg[FP_REG] );
|
|
Jakub Jelinek |
fcbcff |
+ /* Guard against obviously stupid settings of the reg-rule stack
|
|
Jakub Jelinek |
fcbcff |
+ pointer. */
|
|
Jakub Jelinek |
fcbcff |
+ if (ctx->reg_sp < 0) { why = 8; goto failed; }
|
|
Jakub Jelinek |
fcbcff |
+ if (ctx->reg_sp >= N_RR_STACK) { why = 9; goto failed; }
|
|
Jakub Jelinek |
fcbcff |
+
|
|
Jakub Jelinek |
fcbcff |
+ SUMMARISE_HOW(si->ra_how, si->ra_off,
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][ctx->ra_reg] );
|
|
Jakub Jelinek |
fcbcff |
+ SUMMARISE_HOW(si->fp_how, si->fp_off,
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][FP_REG] );
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
# undef SUMMARISE_HOW
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
@@ -2116,7 +2140,7 @@ static Bool summarise_context( /*OUT*/Di
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
/* also, gcc says "Undef" for %{e,r}bp when it is unchanged. So
|
|
Jakub Jelinek |
fcbcff |
.. */
|
|
Jakub Jelinek |
fcbcff |
- if (ctx->reg[FP_REG].tag == RR_Undef)
|
|
Jakub Jelinek |
fcbcff |
+ if (ctx->reg[ctx->reg_sp][FP_REG].tag == RR_Undef)
|
|
Jakub Jelinek |
fcbcff |
si->fp_how = CFIR_SAME;
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
/* knock out some obviously stupid cases */
|
|
Jakub Jelinek |
fcbcff |
@@ -2215,10 +2239,10 @@ static void ppUnwindContext_summary ( Un
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("RA=");
|
|
Jakub Jelinek |
fcbcff |
- ppRegRule( ctx->exprs, &ctx->reg[ctx->ra_reg] );
|
|
Jakub Jelinek |
fcbcff |
+ ppRegRule( ctx->exprs, &ctx->reg[ctx->reg_sp][ctx->ra_reg] );
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("FP=");
|
|
Jakub Jelinek |
fcbcff |
- ppRegRule( ctx->exprs, &ctx->reg[FP_REG] );
|
|
Jakub Jelinek |
fcbcff |
+ ppRegRule( ctx->exprs, &ctx->reg[ctx->reg_sp][FP_REG] );
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)("\n");
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
@@ -2664,6 +2688,9 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
Addr printing_bias = ((Addr)ctx->initloc) - ((Addr)di->text_bias);
|
|
Jakub Jelinek |
fcbcff |
i++;
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
+ if (ctx->reg_sp < 0 || ctx->reg_sp >= N_RR_STACK)
|
|
Jakub Jelinek |
fcbcff |
+ return 0; /* bogus reg-rule stack pointer */
|
|
Jakub Jelinek |
fcbcff |
+
|
|
Jakub Jelinek |
fcbcff |
if (hi2 == DW_CFA_advance_loc) {
|
|
Jakub Jelinek |
fcbcff |
delta = (UInt)lo6;
|
|
Jakub Jelinek |
fcbcff |
ctx->loc += delta;
|
|
Jakub Jelinek |
fcbcff |
@@ -2680,12 +2707,13 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
reg = (Int)lo6;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" DW_CFA_offset: r%d at cfa%s%d\n",
|
|
Jakub Jelinek |
fcbcff |
- (Int)reg, ctx->reg[reg].arg < 0 ? "" : "+",
|
|
Jakub Jelinek |
fcbcff |
- (Int)ctx->reg[reg].arg );
|
|
Jakub Jelinek |
fcbcff |
+ (Int)reg,
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg < 0 ? "" : "+",
|
|
Jakub Jelinek |
fcbcff |
+ (Int)ctx->reg[ctx->reg_sp][reg].arg );
|
|
Jakub Jelinek |
fcbcff |
return i;
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
@@ -2695,7 +2723,7 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
if (restore_ctx == NULL)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg] = restore_ctx->reg[reg];
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg] = restore_ctx->reg[ctx->reg_sp][reg];
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" DW_CFA_restore: r%d\n", (Int)reg);
|
|
Jakub Jelinek |
fcbcff |
return i;
|
|
Jakub Jelinek |
fcbcff |
@@ -2781,8 +2809,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
if (reg2 < 0 || reg2 >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_Reg;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = reg2;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_Reg;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = reg2;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" DW_CFA_register: r%d in r%d\n",
|
|
Jakub Jelinek |
fcbcff |
(Int)reg, (Int)reg2);
|
|
Jakub Jelinek |
fcbcff |
@@ -2795,8 +2823,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
i += nleb;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" rci:DW_CFA_offset_extended\n");
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
@@ -2808,12 +2836,13 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
i += nleb;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" DW_CFA_offset_extended_sf: r%d at cfa%s%d\n",
|
|
Jakub Jelinek |
fcbcff |
- reg, ctx->reg[reg].arg < 0 ? "" : "+",
|
|
Jakub Jelinek |
fcbcff |
- (Int)ctx->reg[reg].arg);
|
|
Jakub Jelinek |
fcbcff |
+ reg,
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg < 0 ? "" : "+",
|
|
Jakub Jelinek |
fcbcff |
+ (Int)ctx->reg[ctx->reg_sp][reg].arg);
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
case DW_CFA_GNU_negative_offset_extended:
|
|
Jakub Jelinek |
fcbcff |
@@ -2823,8 +2852,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
i += nleb;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = (-off) * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_CFAOff;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = (-off) * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" rci:DW_CFA_GNU_negative_offset_extended\n");
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
@@ -2836,7 +2865,7 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
if (restore_ctx == NULL)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg] = restore_ctx->reg[reg];
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg] = restore_ctx->reg[ctx->reg_sp][reg];
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" rci:DW_CFA_restore_extended\n");
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
@@ -2848,8 +2877,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
i += nleb;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_CFAValOff;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_CFAValOff;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" rci:DW_CFA_val_offset\n");
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
@@ -2861,8 +2890,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
i += nleb;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_CFAValOff;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_CFAValOff;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = off * ctx->data_a_f;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" rci:DW_CFA_val_offset_sf\n");
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
@@ -2907,8 +2936,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
i += nleb;
|
|
Jakub Jelinek |
fcbcff |
if (reg < 0 || reg >= N_CFI_REGS)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_Undef;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = 0;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_Undef;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = 0;
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
VG_(printf)(" rci:DW_CFA_undefined\n");
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
@@ -2952,8 +2981,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
/* Add an extra dereference */
|
|
Jakub Jelinek |
fcbcff |
j = ML_(CfiExpr_Deref)( ctx->exprs, j );
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_ValExpr;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = j;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_ValExpr;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = j;
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
case DW_CFA_val_expression:
|
|
Jakub Jelinek |
fcbcff |
@@ -2981,8 +3010,8 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
}
|
|
Jakub Jelinek |
fcbcff |
if (j == -1)
|
|
Jakub Jelinek |
fcbcff |
return 0; /* fail */
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].tag = RR_ValExpr;
|
|
Jakub Jelinek |
fcbcff |
- ctx->reg[reg].arg = j;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].tag = RR_ValExpr;
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg[ctx->reg_sp][reg].arg = j;
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
case DW_CFA_def_cfa_expression:
|
|
Jakub Jelinek |
fcbcff |
@@ -3008,7 +3037,39 @@ static Int run_CF_instruction ( /*MOD*/U
|
|
Jakub Jelinek |
fcbcff |
/* Ignored. This appears to be sparc-specific; quite why it
|
|
Jakub Jelinek |
fcbcff |
turns up in SuSE-supplied x86 .so's beats me. */
|
|
Jakub Jelinek |
fcbcff |
if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
- VG_(printf)("DW_CFA_GNU_window_save\n");
|
|
Jakub Jelinek |
fcbcff |
+ VG_(printf)(" DW_CFA_GNU_window_save\n");
|
|
Jakub Jelinek |
fcbcff |
+ break;
|
|
Jakub Jelinek |
fcbcff |
+
|
|
Jakub Jelinek |
fcbcff |
+ case DW_CFA_remember_state:
|
|
Jakub Jelinek |
fcbcff |
+ if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
+ VG_(printf)(" DW_CFA_remember_state\n");
|
|
Jakub Jelinek |
fcbcff |
+ /* we just checked this at entry, so: */
|
|
Jakub Jelinek |
fcbcff |
+ vg_assert(ctx->reg_sp >= 0 && ctx->reg_sp < N_RR_STACK);
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg_sp++;
|
|
Jakub Jelinek |
fcbcff |
+ if (ctx->reg_sp == N_RR_STACK) {
|
|
Jakub Jelinek |
fcbcff |
+ /* stack overflow. We're hosed. */
|
|
Jakub Jelinek |
fcbcff |
+ VG_(message)(Vg_DebugMsg, "DWARF2 CFI reader: N_RR_STACK is "
|
|
Jakub Jelinek |
fcbcff |
+ "too low; increase and recompile.");
|
|
Jakub Jelinek |
fcbcff |
+ i = 0; /* indicate failure */
|
|
Jakub Jelinek |
fcbcff |
+ } else {
|
|
Jakub Jelinek |
fcbcff |
+ VG_(memcpy)(/*dst*/&ctx->reg[ctx->reg_sp],
|
|
Jakub Jelinek |
fcbcff |
+ /*src*/&ctx->reg[ctx->reg_sp - 1],
|
|
Jakub Jelinek |
fcbcff |
+ sizeof(ctx->reg[ctx->reg_sp]) );
|
|
Jakub Jelinek |
fcbcff |
+ }
|
|
Jakub Jelinek |
fcbcff |
+ break;
|
|
Jakub Jelinek |
fcbcff |
+
|
|
Jakub Jelinek |
fcbcff |
+ case DW_CFA_restore_state:
|
|
Jakub Jelinek |
fcbcff |
+ if (di->ddump_frames)
|
|
Jakub Jelinek |
fcbcff |
+ VG_(printf)(" DW_CFA_restore_state\n");
|
|
Jakub Jelinek |
fcbcff |
+ /* we just checked this at entry, so: */
|
|
Jakub Jelinek |
fcbcff |
+ vg_assert(ctx->reg_sp >= 0 && ctx->reg_sp < N_RR_STACK);
|
|
Jakub Jelinek |
fcbcff |
+ if (ctx->reg_sp == 0) {
|
|
Jakub Jelinek |
fcbcff |
+ /* stack overflow. Give up. */
|
|
Jakub Jelinek |
fcbcff |
+ i = 0; /* indicate failure */
|
|
Jakub Jelinek |
fcbcff |
+ } else {
|
|
Jakub Jelinek |
fcbcff |
+ /* simply fall back to previous entry */
|
|
Jakub Jelinek |
fcbcff |
+ ctx->reg_sp--;
|
|
Jakub Jelinek |
fcbcff |
+ }
|
|
Jakub Jelinek |
fcbcff |
break;
|
|
Jakub Jelinek |
fcbcff |
|
|
Jakub Jelinek |
fcbcff |
default:
|