A question about gdb script

Pedro Alves pedro@codesourcery.com
Thu Nov 26 08:51:00 GMT 2009


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

-- 
Pedro Alves



More information about the Gdb mailing list