From: Stan Shebs <stan@codesourcery.com>
To: gdb-patches <gdb-patches@sourceware.org>
Subject: [PATCH] Handle OP_THIS in tracepoints
Date: Thu, 24 Dec 2009 01:33:00 -0000 [thread overview]
Message-ID: <4B32C4ED.6050904@codesourcery.com> (raw)
This one comes up pretty quickly when doing tracepoints in C++; members
in expressions use OP_THIS, which amounts to shorthand for a reference
to the implicit argument "this". Handling is uncomplicated, mimics
expression evaluation.
Stan
2009-12-23 Stan Shebs <stan@codesourcery.com>
* ax-gdb.c (gen_expr): Handle OP_THIS.
Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.54
diff -p -r1.54 ax-gdb.c
*** ax-gdb.c 24 Dec 2009 00:40:49 -0000 1.54
--- ax-gdb.c 24 Dec 2009 01:21:21 -0000
***************
*** 35,40 ****
--- 35,41 ----
#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,
*************** gen_expr (struct expression *exp, union
*** 1759,1764 ****
--- 1760,1797 ----
}
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."));
next reply other threads:[~2009-12-24 1:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-24 1:33 Stan Shebs [this message]
2009-12-24 16:35 ` Pedro Alves
2009-12-24 17:58 ` Stan Shebs
2009-12-24 18:08 ` Pedro Alves
2009-12-24 18:19 ` Pedro Alves
2009-12-28 16:50 ` Pedro Alves
2009-12-24 18:24 ` Stan Shebs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B32C4ED.6050904@codesourcery.com \
--to=stan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox