From 88040acda86230fe9cc4ebfef29321940976db05 Mon Sep 17 00:00:00 2001 From: wolfsuit Date: Wed, 9 Mar 2005 19:40:50 +0000 Subject: Add a hack to work around some issues with remote debugging with Xcode. Xcode requires that stdin & stdout be closed or you won't be able to interrupt the running program. So I added a check for XCNOSTDIN environment variable in the startup, and I force them closed if it is set. With that, remote debugging works pretty well. --- ChangeLog | 6 ++++++ macosx/README | 6 +++++- macosx/tkMacOSXInit.c | 11 ++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee63644..ba768bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-03-09 Jim Ingham + + * macosx/tkMacOSXInit.c (TkpInit): Check to see if the environment + variable XCNOSTDIN is set, and if so, close stdin & stdout. This + is necessary to make remote debugging under Xcode work properly. + 2005-03-08 Jeff Hobbs * win/tkWinWm.c (WinSetIcon): fix GCLP_ICONSM -> GCLP_HICONSM. diff --git a/macosx/README b/macosx/README index ba58466..39687e0 100644 --- a/macosx/README +++ b/macosx/README @@ -1,7 +1,7 @@ TclTkAqua README ---------------- -RCS: @(#) $Id: README,v 1.10 2004/11/11 01:24:32 das Exp $ +RCS: @(#) $Id: README,v 1.11 2005/03/09 19:40:52 wolfsuit Exp $ This is the README file for the Mac OS X native versions of Tcl & Tk. @@ -131,6 +131,10 @@ name. So, for instance this code will spin the spinner: } This was added in Tk 8.4.2 +- If you want to use Remote Debugging with Xcode 1.5 or 2.0, then you need to set +the environment variable XCNOSTDIN to 1 in the Executable editor for Wish Shell. That +will cause us to force closing stdin & stdout. Otherwise, given how Xcode launches +Wish remotely, they will be left open and then Wish & gdb will fight for stdin... 3. Building TclTkAqua --------------------- diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index b7acd4f..3c20b5f 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.7 2005/01/25 06:54:18 das Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.8 2005/03/09 19:40:52 wolfsuit Exp $ */ #include "tkInt.h" @@ -167,6 +167,15 @@ TkpInit(interp) * then use the Tk based console interpreter. */ + /* REMOVE ME: Close stdin & stdout for remote debugging otherwise we + * will fight with gdb for stdin & stdout + */ + + if (getenv ("XCNOSTDIN") != NULL) { + close (0); + close (1); + } + if (!isatty(0)) { struct stat st; if (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)) { -- cgit v0.12