2009-12-23 Stan Shebs <stan@codesourcery.com>

* ax-gdb.c (gen_expr): Handle OP_THIS.
This commit is contained in:
Stan Shebs 2009-12-24 01:42:03 +00:00
parent 0936ad1d22
commit 6c228b9cae
2 changed files with 35 additions and 0 deletions

View File

@ -1,5 +1,7 @@
2009-12-23 Stan Shebs <stan@codesourcery.com>
* ax-gdb.c (gen_expr): Handle OP_THIS.
* ax-gdb.h (gen_trace_for_var): Declare.
* ax-gdb.c (gen_trace_for_var): New function.
* dwarf2loc.c (dwarf_expr_frame_base_1): New function, split from...

View File

@ -35,6 +35,7 @@
#include "regcache.h"
#include "user-regs.h"
#include "language.h"
#include "dictionary.h"
/* To make sense of this file, you should read doc/agentexpr.texi.
Then look at the types and enums in ax-gdb.h. For the code itself,
@ -1759,6 +1760,38 @@ gen_expr (struct expression *exp, union exp_element **pc,
}
break;
case OP_THIS:
{
char *name;
struct frame_info *frame;
struct symbol *func, *sym;
struct block *b;
name = current_language->la_name_of_this;
if (!name)
error (_("no `this' in current language"));
frame = get_selected_frame (_("no frame selected"));
func = get_frame_function (frame);
if (!func)
error (_("no `%s' in nameless context"), name);
b = SYMBOL_BLOCK_VALUE (func);
if (dict_empty (BLOCK_DICT (b)))
error (_("no args, no `%s' in block"), name);
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
symbol instead of the LOC_ARG one (if both exist). */
sym = lookup_block_symbol (b, name, NULL, VAR_DOMAIN);
if (!sym)
error (_("no `%s' found"), name);
gen_var_ref (exp->gdbarch, ax, value, sym);
(*pc) += 2;
}
break;
case OP_TYPE:
error (_("Attempt to use a type name as an expression."));