Re: Stalls in idle loop



On Thu, Aug 10, 2000 at 02:45:23PM -0400, Nick Matsakis wrote:
> Is there any way to use GDB (or some other utility) to stop a program at a
> particular time and print a stack trace?  I can't set a break point
> because I don't know where the function is during that time.

If you can't set a break point for some reason, you can call this
function where you want gdb to break:

void
stop_in_debugger(void)
{
  void (* saved_handler) (int);

  saved_handler = signal (SIGINT, SIG_IGN);
  raise (SIGINT);
  signal (SIGINT, saved_handler);
}

I originally found this routine while browsing through the Nautilus
source code, and it comes in handy from time to time.

-JT

-- 
GNU/Linux: Free your mind and your OS will follow.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]