This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A question about gdb script


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]