From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Stan Shebs <stan@codesourcery.com>
Subject: Re: [PATCH] Handle OP_THIS in tracepoints
Date: Thu, 24 Dec 2009 18:19:00 -0000 [thread overview]
Message-ID: <200912241819.00373.pedro@codesourcery.com> (raw)
In-Reply-To: <200912241808.02200.pedro@codesourcery.com>
On Thursday 24 December 2009 16:34:54, Pedro Alves wrote:
> This is busted, and was later fixed in our internal
> tree. :-) The selected frame, and the current language
> don't have anything to do with the context in which
> the tracepoint runs. E.g.:
>
> (gdb) trace 'Foo::Bar()'
> (gdb) actions
> (gdb) collect foo_field
>
> Here, the `this' for foo_field needs to be
> looked up in the context of Foo::Bar, not of whatever
> context/frame the user had selected when she issued
> the 'actions' command.
On Thursday 24 December 2009 18:08:01, Pedro Alves wrote:
> On Thursday 24 December 2009 17:57:39, Stan Shebs wrote:
> > it should be no
> > problem to prepare the patch! :-)
>
> Will do.
Here it is.
2009-12-24 Pedro Alves <pedro@codesourcery.com>
gdb/
* ax-gdb.c (gen_expr) <OP_THIS>: Lookup `this' in the context of
the tracepoint, not of the selected frame and language.
--
Pedro Alves
---
gdb/ax-gdb.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
Index: src/gdb/ax-gdb.c
===================================================================
--- src.orig/gdb/ax-gdb.c 2009-12-24 17:08:57.000000000 +0000
+++ src/gdb/ax-gdb.c 2009-12-24 18:12:32.000000000 +0000
@@ -1762,30 +1762,19 @@ gen_expr (struct expression *exp, union
case OP_THIS:
{
- char *name;
- struct frame_info *frame;
+ char *this_name;
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);
-
+ func = block_linkage_function (block_for_pc (ax->scope));
+ this_name = language_def (SYMBOL_LANGUAGE (func))->la_name_of_this;
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);
+ sym = lookup_block_symbol (b, this_name, NULL, VAR_DOMAIN);
if (!sym)
- error (_("no `%s' found"), name);
+ error (_("no `%s' found"), this_name);
gen_var_ref (exp->gdbarch, ax, value, sym);
(*pc) += 2;
next prev parent reply other threads:[~2009-12-24 18:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-24 1:33 Stan Shebs
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 [this message]
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=200912241819.00373.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=stan@codesourcery.com \
/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