Re: [PATCH] If running in GNU gdb, disable grabs



Excerpts from Martin Nordholts's message of Sat Aug 22 17:38:36 +0100 2009:
> I have attached two patches to this mail. The first one adds the 
> possibility to disable grabs with the GTK_DEBUG environment variable, 
> the other patch disable grabs if we appear to run in GNU gdb. The 
> approach is inspired by the Qt toolkit which uses the same approach.

That's a useful idea. I've been asked in the past to automatically
disable forking of tests when cairo-test-suite is run under the
debugger, and this works quite well.

For reference, I decided to use the path of the parent's executable as
opposed to a search on the commandline:
    sprintf (buf, "/proc/%d/exe", getppid ());
    if (readlink (buf, buf, sizeof (buf)) != -1 &&
	strncmp (basename (buf), "gdb", 3) == 0)
	return TRUE;

Thanks!
-ickle


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