diff options
author | Tom Tromey <tromey@redhat.com> | 2010-05-21 21:01:46 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-05-21 21:01:46 +0000 |
commit | cb82636715e384dc5e75f3c1a4fd436626ba8dcd (patch) | |
tree | e75f984689d6689f268f025f198b5cc1817780ff /gdb/dwarf2expr.c | |
parent | 74de6778b16fe5429d512d7250747f4d9e1ed374 (diff) | |
download | binutils-gdb-cb82636715e384dc5e75f3c1a4fd436626ba8dcd.tar.gz |
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.
Diffstat (limited to 'gdb/dwarf2expr.c')
-rw-r--r-- | gdb/dwarf2expr.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 13d318e280a..bf5f7c9e3f9 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -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; } |