Hui Zhu | 12 Jun 2012 02:15
Favicon

What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"

Hi guys,

The "maintenance agent" and "maintenance agent-eval" are for translate an expression into remote agent bytecode.
Both of them got address info from frame.  But when we use tracepoint or breakpoint with agent code, this
address is from tracepoint or breakpoint.

What about add new commands "maintenance agent-breakpoint id expression" and "maintenance
agent-eval-breakpoint id expression"?  Then we can get the agent code for breakpoint or tracepoint directly.

Thanks,
Hui

Yao Qi | 12 Jun 2012 04:02
Gravatar

Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"

On 06/12/2012 08:15 AM, Hui Zhu wrote:
> Hi guys,
> 
> The "maintenance agent" and "maintenance agent-eval" are for translate
> an expression into remote agent bytecode.
> Both of them got address info from frame.  But when we use tracepoint or
> breakpoint with agent code, this address is from tracepoint or breakpoint.

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.

Any examples that "maint agent" doesn't meet your needs in
breakpoint/tracepoint?  It works in the following simple case,

(gdb) b main if (unsigned int) main > 1
(gdb) maintenance agent-eval (unsigned int) main > 1
  0  const64 134513662
  9  zero_ext 32
 11  const8 1
 13  zero_ext 32
 15  swap
 16  less_unsigned
 17  end

--

-- 
Yao (齐尧)

Hui Zhu | 12 Jun 2012 13:41
Picon
Gravatar

Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"

On Tue, Jun 12, 2012 at 10:02 AM, Yao Qi <yao <at> codesourcery.com> wrote:
> On 06/12/2012 08:15 AM, Hui Zhu wrote:
>> Hi guys,
>>
>> The "maintenance agent" and "maintenance agent-eval" are for translate
>> an expression into remote agent bytecode.
>> Both of them got address info from frame.  But when we use tracepoint or
>> breakpoint with agent code, this address is from tracepoint or breakpoint.
>
> 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? :)

> Any examples that "maint agent" doesn't meet your needs in
> breakpoint/tracepoint?  It works in the following simple case,
>
> (gdb) b main if (unsigned int) main > 1
> (gdb) maintenance agent-eval (unsigned int) main > 1
>  0  const64 134513662
>  9  zero_ext 32
>  11  const8 1
>  13  zero_ext 32
(Continue reading)

Yao Qi | 12 Jun 2012 15:15
Gravatar

Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"

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.
(Continue reading)

Stan Shebs | 13 Jun 2012 01:36
Picon
Favicon

Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"

On 6/11/12 5:15 PM, Hui Zhu wrote:
> Hi guys,
>
> The "maintenance agent" and "maintenance agent-eval" are for translate 
> an expression into remote agent bytecode.
> Both of them got address info from frame.  But when we use tracepoint 
> or breakpoint with agent code, this address is from tracepoint or 
> breakpoint.
>
> What about add new commands "maintenance agent-breakpoint id 
> expression" and "maintenance agent-eval-breakpoint id expression"?  
> Then we can get the agent code for breakpoint or tracepoint directly.

I could see something like that being useful - instead of breakpoint id 
I would suggest having it take a linespec, so you don't have to create a 
tracepoint just to see what the bytecodes would be.  Also, an optional 
hyphen-argument like "-at <linespec>" would save defining new 
maintenance subcommands.

One caveat though - not all collect actions translate into agent 
expressions, so the user could be misled into thinking that the target 
was running bytecode instead of doing direct collection.  (This 
distinction confused me at least once a while back - the bug was in 
non-agent collect action.)

Stan
stan <at> codesourcery.com

Hui Zhu | 20 Jun 2012 12:08
Picon
Gravatar

Re: What about add new commands "maintenance agent-breakpoint id expression" and "maintenance agent-eval-breakpoint id expression"

On Wed, Jun 13, 2012 at 7:36 AM, Stan Shebs <stanshebs <at> earthlink.net> wrote:
> On 6/11/12 5:15 PM, Hui Zhu wrote:
>>
>> Hi guys,
>>
>> The "maintenance agent" and "maintenance agent-eval" are for translate an
>> expression into remote agent bytecode.
>> Both of them got address info from frame.  But when we use tracepoint or
>> breakpoint with agent code, this address is from tracepoint or breakpoint.
>>
>> What about add new commands "maintenance agent-breakpoint id expression"
>> and "maintenance agent-eval-breakpoint id expression"?  Then we can get the
>> agent code for breakpoint or tracepoint directly.
>
>
> I could see something like that being useful - instead of breakpoint id I
> would suggest having it take a linespec, so you don't have to create a
> tracepoint just to see what the bytecodes would be.  Also, an optional
> hyphen-argument like "-at <linespec>" would save defining new maintenance
> subcommands.
>
> One caveat though - not all collect actions translate into agent
> expressions, so the user could be misled into thinking that the target was
> running bytecode instead of doing direct collection.  (This distinction
> confused me at least once a while back - the bug was in non-agent collect
> action.)
>
> Stan
> stan <at> codesourcery.com
>
(Continue reading)


Gmane