This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: A question about gdb script
> -----Original Message-----
> From: gdb-owner@sourceware.org
> [mailto:gdb-owner@sourceware.org] On Behalf Of Hui Zhu
> Sent: November-26-09 9:30 AM
> To: Pedro Alves; Daniel Jacobowitz; Michael Snyder
> Cc: gdb@sourceware.org
> Subject: Re: A question about gdb script
>
> On Thu, Nov 26, 2009 at 00:06, Pedro Alves
> <pedro@codesourcery.com> wrote:
> > On Wednesday 25 November 2009 15:11:51, Daniel Jacobowitz wrote:
> >> > 2. ?Sometime, I want just record a function, I want:
> >> > b functon_name
> >> > commands
> >> > silent
> >> > record
> >> > finish
> >> > #Maybe we can record save in this line, this is first question.
> >> > record stop
> >> > end
> >> > But when I really do it. ?I found that gdb stop running
> after finish.
> >> >
> >> > Could you help me with them?
> >>
> >> This is a known limitation of breakpoint commands. ?It's very
> >> difficult.
> >
> > Try using the hook-stop instead. ?Something like this:
> >
> > ?set $stop_recording_on_next_stop=0
> >
> > ?b functon_name
> > ?commands
> > ?silent
> > ?record
> > ?set $stop_recording_on_next_stop=1
> > ?finish
> > ?end
> >
> > ?define hook-stop
> > ? if $stop_recording_on_next_stop
> > ? ? set $stop_recording_on_next_stop=0
> > ? ? record save
> > ? ? record stop
> > ? ? end
> > ? end
> >
>
> Cool. I change hook-stop to:
> define hook-stop
> if $stop_recording_on_next_stop
> set $stop_recording_on_next_stop=0
> record save
> record stop
> c
> end
> end
>
> It looks not bad, but got a lot of:
> ---Type <return> to continue, or q <return> to quit---q
I think the command
set pagination off
will prevent this.
> If you don't mind, I will post a patch to change each fprintf_filtered
> in record.c to fprintf_unfiltered.
>
> Thanks,
> Hui
>