aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2009-12-24 01:42:03 +0000
committerStan Shebs <shebs@codesourcery.com>2009-12-24 01:42:03 +0000
commit6c228b9caeee7c3fe760c7946fa6a4ba5cde9192 (patch)
treea041c8cb0ee40d48121f64c77aa23d9b43bb3053 /gdb
parent0936ad1d22457136c65383681c475e5a0e30db14 (diff)
downloadgdb-6c228b9caeee7c3fe760c7946fa6a4ba5cde9192.zip
gdb-6c228b9caeee7c3fe760c7946fa6a4ba5cde9192.tar.gz
gdb-6c228b9caeee7c3fe760c7946fa6a4ba5cde9192.tar.bz2
2009-12-23 Stan Shebs <stan@codesourcery.com>
* ax-gdb.c (gen_expr): Handle OP_THIS.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog2
-rw-r--r--gdb/ax-gdb.c33
2 files changed, 35 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f32d287..e1115bc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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...
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 4d3f3ac..a1c3d6e 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -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."));