This is the mail archive of the gdb@sourceware.cygnus.com 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]

How can if find out if program is running in a user-defined function ??



  I wanted to write a simple gdb init file that would
set breakpoints at position I would like to analyse but who would 
also just run the program and directly exit if nothing special happens.
(This is to be able to use it inside a makefile where 
a lot of consecutive calls to the same compiler are made and
an error arises right in the middle but only from within the makefile !)

  To do this I first wrote something like

  set $error = 0
  b  first_error_func
  comm 1
  set $error = 1
  end  
  b  second_error_func
  comm 2
  set $error = 1
  end
   run list of args
   if ($error == 0)
     quit
   end


   This works if one of my breakpoint are touched, but not if I recieve a
signal !!

  The I tought about using the hook-stop function
  define hook-stop
    set $error = 1
  end
but this on is also called when the program stops normally !
So  it does not help me !!

  Then I thought, I must find out if I am still running or if the program
has exited.

  but I can't find a way to do this !!
   
   if I try 
    if ($pc <>0)
      
  I will get a "No registers" and the source file will not be parsed further !

   Does anyone know if there is a way to know if the program is running ??

  Maybe there is some debugger variable for this ?

  Any help would be greatly appreciated !



Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99

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