This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
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
If you don't mind, I will post a patch to change each fprintf_filtered
in record.c to fprintf_unfiltered.
Thanks,
Hui