mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-17 21:03:55 +08:00
gdb
* dwarf2loc.c (read_pieced_value): Exit loop when result is full. <DWARF_VALUE_OPTIMIZED_OUT>: New case. * dwarf2expr.h (enum dwarf_value_location) <DWARF_VALUE_OPTIMIZED_OUT>: New constant. * dwarf2expr.c (dwarf_expr_stack_empty_p): New function. (add_piece): Handle empty piece. (execute_stack_op) <DW_OP_piece>: Handle DWARF_VALUE_OPTIMIZED_OUT. gdb/testsuite * gdb.dwarf2/pieces.exp (pieces_test_f6): New proc. Call it. * gdb.dwarf2/pieces.c (struct C): New. (f6): New function. * gdb.dwarf2/pieces.S: Replace.
This commit is contained in:
@ -143,6 +143,14 @@ dwarf_expr_fetch_in_stack_memory (struct dwarf_expr_context *ctx, int n)
|
||||
|
||||
}
|
||||
|
||||
/* Return true if the expression stack is empty. */
|
||||
|
||||
static int
|
||||
dwarf_expr_stack_empty_p (struct dwarf_expr_context *ctx)
|
||||
{
|
||||
return ctx->stack_len == 0;
|
||||
}
|
||||
|
||||
/* Add a new piece to CTX's piece list. */
|
||||
static void
|
||||
add_piece (struct dwarf_expr_context *ctx, ULONGEST size)
|
||||
@ -167,6 +175,15 @@ add_piece (struct dwarf_expr_context *ctx, ULONGEST size)
|
||||
p->v.literal.data = ctx->data;
|
||||
p->v.literal.length = ctx->len;
|
||||
}
|
||||
else if (dwarf_expr_stack_empty_p (ctx))
|
||||
{
|
||||
p->location = DWARF_VALUE_OPTIMIZED_OUT;
|
||||
/* Also reset the context's location, for our callers. This is
|
||||
a somewhat strange approach, but this lets us avoid setting
|
||||
the location to DWARF_VALUE_MEMORY in all the individual
|
||||
cases in the evaluator. */
|
||||
ctx->location = DWARF_VALUE_OPTIMIZED_OUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
p->v.expr.value = dwarf_expr_fetch (ctx, 0);
|
||||
@ -859,7 +876,8 @@ execute_stack_op (struct dwarf_expr_context *ctx,
|
||||
|
||||
/* Pop off the address/regnum, and reset the location
|
||||
type. */
|
||||
if (ctx->location != DWARF_VALUE_LITERAL)
|
||||
if (ctx->location != DWARF_VALUE_LITERAL
|
||||
&& ctx->location != DWARF_VALUE_OPTIMIZED_OUT)
|
||||
dwarf_expr_pop (ctx);
|
||||
ctx->location = DWARF_VALUE_MEMORY;
|
||||
}
|
||||
|
Reference in New Issue
Block a user