public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* how to create and hardware watchpoint from a commands list.
@ 2015-02-04 10:14 Julien Chavanton
  2015-02-08  5:26 ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Chavanton @ 2015-02-04 10:14 UTC (permalink / raw)
  To: gdb

Hi Folks, I would like to create and hardware watchpoint from a commands list.

retrieve the addres of a variable and create a watch.

watch *(int *) &call->stream->session->ext.settings.mode

Manualy this is working fine, but I do not know the right syntax in GDB.

I tried "watch -location call->stream->session->ext.settings.mode"

And sereval other things, is there a way to pipe the output of one
command to another one ?

watch *(int *) | printf "0x%x\n", &call->stream->session->ext.settings.mode


----------------------------------------------------------


define myhook
  echo myhook \n
  next
  next
  next
  print call->stream->session->ext.settings.mode
  print &call->stream->session->ext.settings.mode
  printf "watch *(int *)0x%x\n", &call->stream->session->ext.settings.mode
end

break set_settings
commands
 myhook
end

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to create and hardware watchpoint from a commands list.
  2015-02-04 10:14 how to create and hardware watchpoint from a commands list Julien Chavanton
@ 2015-02-08  5:26 ` Doug Evans
  2015-02-08 14:49   ` Julien Chavanton
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2015-02-08  5:26 UTC (permalink / raw)
  To: Julien Chavanton; +Cc: gdb

On Wed, Feb 4, 2015 at 2:14 AM, Julien Chavanton <jchavanton@gmail.com> wrote:
> Hi Folks, I would like to create and hardware watchpoint from a commands list.
>
> retrieve the addres of a variable and create a watch.
>
> watch *(int *) &call->stream->session->ext.settings.mode
>
> Manualy this is working fine, but I do not know the right syntax in GDB.

What do you mean by this working manually but then not knowing the right syntax?

>
> I tried "watch -location call->stream->session->ext.settings.mode"
>
> And sereval other things, is there a way to pipe the output of one
> command to another one ?

You tried several things, but you need to be more specific about
what problems you had.  Complete unedited session logs are useful.

There are various ways to "pipe" (for lack of a better term) the
output of previous commands into subsequent commands.
value history, convenience variables and/or eval or python come to mind.
But do you need to?
What about "watch -location ..." didn't work?

>
> watch *(int *) | printf "0x%x\n", &call->stream->session->ext.settings.mode
>
>
> ----------------------------------------------------------
>
>
> define myhook
>   echo myhook \n
>   next
>   next
>   next
>   print call->stream->session->ext.settings.mode
>   print &call->stream->session->ext.settings.mode
>   printf "watch *(int *)0x%x\n", &call->stream->session->ext.settings.mode
> end
>
> break set_settings
> commands
>  myhook
> end

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to create and hardware watchpoint from a commands list.
  2015-02-08  5:26 ` Doug Evans
@ 2015-02-08 14:49   ` Julien Chavanton
  2015-02-08 21:47     ` Doug Evans
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Chavanton @ 2015-02-08 14:49 UTC (permalink / raw)
  To: Doug Evans, gdb

Hi Doug, thank you for trying to help, I spent a few hours on this so
I am interested to solve this puzzle for next time.

----------------------------
By doing it manually I mean,

step-1) I type :

printf "0x%x\n", &call->stream->session->ext.settings.mode

and then :

step-2) I type :
watch *(int *){result from step 1}

-------------------------------
This did not work for me :

watch -location call->stream->session->ext.settings.mode
-------------------------------

I can rerun the session and provide exact output or I could just try
an alternative "piping" the output of step-1 to step-2 from the GDB
"command line interpreter" not sure how it is called, this as to be
executed from a breakpoint command list ?


On Sun, Feb 8, 2015 at 5:26 AM, Doug Evans <xdje42@gmail.com> wrote:
> On Wed, Feb 4, 2015 at 2:14 AM, Julien Chavanton <jchavanton@gmail.com> wrote:
>> Hi Folks, I would like to create and hardware watchpoint from a commands list.
>>
>> retrieve the addres of a variable and create a watch.
>>
>> watch *(int *) &call->stream->session->ext.settings.mode
>>
>> Manualy this is working fine, but I do not know the right syntax in GDB.
>
> What do you mean by this working manually but then not knowing the right syntax?
>
>>
>> I tried "watch -location call->stream->session->ext.settings.mode"
>>
>> And sereval other things, is there a way to pipe the output of one
>> command to another one ?
>
> You tried several things, but you need to be more specific about
> what problems you had.  Complete unedited session logs are useful.
>
> There are various ways to "pipe" (for lack of a better term) the
> output of previous commands into subsequent commands.
> value history, convenience variables and/or eval or python come to mind.
> But do you need to?
> What about "watch -location ..." didn't work?
>
>>
>> watch *(int *) | printf "0x%x\n", &call->stream->session->ext.settings.mode
>>
>>
>> ----------------------------------------------------------
>>
>>
>> define myhook
>>   echo myhook \n
>>   next
>>   next
>>   next
>>   print call->stream->session->ext.settings.mode
>>   print &call->stream->session->ext.settings.mode
>>   printf "watch *(int *)0x%x\n", &call->stream->session->ext.settings.mode
>> end
>>
>> break set_settings
>> commands
>>  myhook
>> end

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to create and hardware watchpoint from a commands list.
  2015-02-08 14:49   ` Julien Chavanton
@ 2015-02-08 21:47     ` Doug Evans
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Evans @ 2015-02-08 21:47 UTC (permalink / raw)
  To: Julien Chavanton; +Cc: gdb

On Sun, Feb 8, 2015 at 6:49 AM, Julien Chavanton <jchavanton@gmail.com> wrote:
> Hi Doug, thank you for trying to help, I spent a few hours on this so
> I am interested to solve this puzzle for next time.
>
> ----------------------------
> By doing it manually I mean,
>
> step-1) I type :
>
> printf "0x%x\n", &call->stream->session->ext.settings.mode
>
> and then :
>
> step-2) I type :
> watch *(int *){result from step 1}
>
> -------------------------------
> This did not work for me :
>
> watch -location call->stream->session->ext.settings.mode
> -------------------------------

Without more details it's hard to help.
Can you provide a cut-n-paste of the gdb session that shows the problem?


>
> I can rerun the session and provide exact output or I could just try
> an alternative "piping" the output of step-1 to step-2 from the GDB
> "command line interpreter" not sure how it is called, this as to be
> executed from a breakpoint command list ?
>
>
> On Sun, Feb 8, 2015 at 5:26 AM, Doug Evans <xdje42@gmail.com> wrote:
>> On Wed, Feb 4, 2015 at 2:14 AM, Julien Chavanton <jchavanton@gmail.com> wrote:
>>> Hi Folks, I would like to create and hardware watchpoint from a commands list.
>>>
>>> retrieve the addres of a variable and create a watch.
>>>
>>> watch *(int *) &call->stream->session->ext.settings.mode
>>>
>>> Manualy this is working fine, but I do not know the right syntax in GDB.
>>
>> What do you mean by this working manually but then not knowing the right syntax?
>>
>>>
>>> I tried "watch -location call->stream->session->ext.settings.mode"
>>>
>>> And sereval other things, is there a way to pipe the output of one
>>> command to another one ?
>>
>> You tried several things, but you need to be more specific about
>> what problems you had.  Complete unedited session logs are useful.
>>
>> There are various ways to "pipe" (for lack of a better term) the
>> output of previous commands into subsequent commands.
>> value history, convenience variables and/or eval or python come to mind.
>> But do you need to?
>> What about "watch -location ..." didn't work?
>>
>>>
>>> watch *(int *) | printf "0x%x\n", &call->stream->session->ext.settings.mode
>>>
>>>
>>> ----------------------------------------------------------
>>>
>>>
>>> define myhook
>>>   echo myhook \n
>>>   next
>>>   next
>>>   next
>>>   print call->stream->session->ext.settings.mode
>>>   print &call->stream->session->ext.settings.mode
>>>   printf "watch *(int *)0x%x\n", &call->stream->session->ext.settings.mode
>>> end
>>>
>>> break set_settings
>>> commands
>>>  myhook
>>> end

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-08 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04 10:14 how to create and hardware watchpoint from a commands list Julien Chavanton
2015-02-08  5:26 ` Doug Evans
2015-02-08 14:49   ` Julien Chavanton
2015-02-08 21:47     ` Doug Evans

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).