public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Hui Zhu <hui_zhu@mentor.com>, "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"
Date: Tue, 12 Jun 2012 13:15:00 -0000	[thread overview]
Message-ID: <4FD740E9.7080909@codesourcery.com> (raw)
In-Reply-To: <CANFwon3sU=uUF5hZU2DWdY+z753JKee8rCtJjQae7Kd15dKD=w@mail.gmail.com>

On 06/12/2012 07:41 PM, Hui Zhu wrote:
>> > Agent expression evaluation makes sense in the context of "current
>> > scope" or "current frame".  We can't switch to a frame at any arbitrary
>> > address, because the frame maybe does not exist.
>> >
> What your worry about is line "expr = parse_expression (exp);" cannot
> work, right?
> It can be change to function "parse_exp_1" to handle this issue.
> 
> BTW if agent generate need current scope or current frame, how this
> code generate when breakpoint or tracepoint use it? :)

My reply was on the context of "maint agent"/"maint agent-expr" which
you asked about.  My full reply should be "In 'maint agent'/'maint
agent-expr', agent expression evaluation makes in ....".

I am not worried about parse_expression, but

  struct frame_info *fi = get_current_frame ();	/* need current scope */
......
  agent = gen_eval_for_expr (get_frame_pc (fi), expr);

gives me the feeling that we need a correct frame here.

When using variable in condition or actions in breakpoint or tracepoint,
the variable should be *visible* under a certain frame (not current
frame that we are setting breakpoint/tracepoint, as I observed).

> It have too much limit.  For example, it will not work when we want
> collect an local var inside of a function.

It is odd.  I can collect a local variable ii in function foo.

(gdb) target remote :1234
(gdb) b end
Breakpoint 1 at 0x80483c9: file 1.c, line 10.
(gdb) trace foo:label
Tracepoint 2 at 0x80483c1: file 1.c, line 5.
(gdb) actions
Enter actions for tracepoint 2, one per line.
End with a line saying just "end".
>collect ii
>end
(gdb) tstart
(gdb) c
Continuing.

Breakpoint 1, end () at 1.c:10
10	void end () {}
(gdb) tstop
(gdb) tfind
Found trace frame 0, tracepoint 2
#0  foo () at 1.c:6
6	  return ii;
(gdb) tdump
Data collected at tracepoint 2, trace frame 0:
ii = 0

---- 1.c ----
int foo (void)
{
  int ii = 0;

label:
  return ii;
}


void end () {}

int main (void)
{
  int i = foo ();

  end ();
  return 0;
}
-- 
Yao (齐尧)


  reply	other threads:[~2012-06-12 13:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12  0:15 Hui Zhu
2012-06-12  2:03 ` Yao Qi
2012-06-12 11:42   ` Hui Zhu
2012-06-12 13:15     ` Yao Qi [this message]
2012-06-12 23:36 ` Stan Shebs
2012-06-20 10:08   ` Hui Zhu

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=4FD740E9.7080909@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb@sourceware.org \
    --cc=hui_zhu@mentor.com \
    --cc=teawater@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).