Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Harold L Hunt II" To: "cygx" Cc: "cygwin" Subject: Crash on startup - debugging info Date: Sun, 19 Jan 2003 02:47:31 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Okay, there are at least two problems happening in XWin.exe. The first problem is totally unrelated to the new multiwindow mode. The problem is, if you startup XWin.exe in gdb, a call to fchown causes a SIGSEGV on every single execution. That sucks. You can avoid that problem by setting a break in _XSERVTransSocketUNIXCreateListener, then stepping until right before the call to fchown, then ``set updateOwner=0'', which causes the call to be skipped. After that you can continue. In non-multiwindow mode the server will run fine after the continue. The second problem is that in multiwindow mode the call to pthread_mutex_init causes a SIGSEGV. That sucks too. I have peeked at the code for pthread_mutex, but I can't figure out much. I might eventually have to setup a cygwin1.dll build environment so I can debug this, but I would really like to avoid that if possible. I actually started building a debug version of cygwin1.dll tonight, but I got to the part where it needs libiberty and I wussed out. I am kinda stuck. Any help would be appreciated. Even saying, ``yeah, we know that gdb doesn't work well when you call fchown'' would be help enough for me. Oh yeah, I also tried this with the 20030117 cygwin1.dll snapshot. Same results. Thanks in advance, Harold //////////////////////////////////////////////////////////////////////// Running with -multiwindow or without -multiwindow, setting a breakpoint in _XSERVTransSocketUNIXCreateListener //////////////////////////////////////////////////////////////////////// Starting program: /usr/X11R6/bin/XWin.exe -multiwindow Program received signal SIGSEGV, Segmentation fault. 0x77e6d0c0 in _libkernel32_a_iname () (gdb) where #0 0x77e6d0c0 in _libkernel32_a_iname () #1 0x00000001 in ?? () #2 0x6103f35f in _libkernel32_a_iname () #3 0x6103f38b in _libkernel32_a_iname () #4 0x6107b7df in _libkernel32_a_iname () #5 0x6107baba in _libkernel32_a_iname () #6 0x0044b96a in trans_mkdir (path=0x448cb7 "/tmp/.X11-unix", mode=1023) at ../../../lib/xtrans/Xtransutil.c:495 #7 0x00448e37 in _XSERVTransSocketUNIXCreateListener (ciptr=0x100f26b8, port=0x22fd30 "0") at ../../../lib/xtrans/Xtranssock.c:932 #8 0x0044a5b1 in _XSERVTransCreateListener (ciptr=0x100f26b8, port=0x22fd30 "0") at ../../../lib/xtrans/Xtrans.c:734 #9 0x0044ac98 in _XSERVTransMakeAllCOTSServerListeners (port=0x22fd30 "0", partial=0x22fd58, count_ret=0x83f440, ciptrs_ret=0x7e4550) at ../../../lib/xtrans/Xtrans.c:1029 #10 0x0043ed5c in CreateWellKnownSockets () at connection.c:342 #11 0x0040155c in main (argc=2, argv=0x100f1c00, envp=0x100f0330) at main.c:327 #12 0x61007638 in _libkernel32_a_iname () #13 0x6100791d in _libkernel32_a_iname () #14 0x007e1862 in cygwin_crt0 () #15 0x0040103c in mainCRTStartup () #16 0x77e814c7 in _libkernel32_a_iname () (gdb) break _XSERVTransSocketUNIXCreateListener Breakpoint 2 at 0x448e08: file ../../../lib/xtrans/Xtranssock.c, line 924. (gdb) stop (gdb) run -multiwindow The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/X11R6/bin/XWin.exe -multiwindow Breakpoint 2, _XSERVTransSocketUNIXCreateListener (ciptr=0x100f26b8, port=0x22fd30 "0") at ../../../lib/xtrans/Xtranssock.c:924 924 oldUmask = umask (0); (gdb) s 928 mode = 01777; (gdb) 932 if (trans_mkdir(UNIX_DIR, mode) == -1) { (gdb) trans_mkdir (path=0x448cb7 "/tmp/.X11-unix", mode=1023) at ../../../lib/xtrans/Xtransutil.c:439 439 if (mkdir(path, mode) == 0) { (gdb) 445 if (errno == EEXIST) { (gdb) 446 if (lstat(path, &buf) != 0) { (gdb) 451 if (S_ISDIR(buf.st_mode)) { (gdb) 452 int updateOwner = 0; (gdb) 453 int updateMode = 0; (gdb) 454 int updatedOwner = 0; (gdb) 455 int updatedMode = 0; (gdb) 457 if (buf.st_uid != 0) (gdb) 458 updateOwner = 1; (gdb) 464 if ((~mode) & 0077 & buf.st_mode) (gdb) 466 if ((mode & 01000) && (gdb) 475 if (updateMode || updateOwner) { (gdb) 476 int fd = -1; (gdb) 478 if ((fd = open(path, O_RDONLY)) != -1) { (gdb) 479 if (fstat(fd, &fbuf) == -1) { (gdb) 488 if (!S_ISDIR(fbuf.st_mode) || (gdb) 495 if (updateOwner && fchown(fd, 0, 0) == 0) (gdb) Program received signal SIGSEGV, Segmentation fault. 0x77e6d0c0 in _libkernel32_a_iname () (gdb) //////////////////////////////////////////////////////////////////////// Running with -multiwindow, but running set updateOwner=0 right before the call to fchown, then continuing until the breakpoint in InitQueue is hit: //////////////////////////////////////////////////////////////////////// 495 if (updateOwner && fchown(fd, 0, 0) == 0) (gdb) set updateOwner=0 (gdb) continue Continuing. Breakpoint 1, InitQueue (pQueue=0x100fb95c) at winmultiwindowwm.c:304 304 if (pQueue == NULL) (gdb) s 311 pQueue->pHead = NULL; (gdb) 312 pQueue->pTail = NULL; (gdb) 315 s_nQueueSize = 0; (gdb) 321 ErrorF ("InitQueue - Calling pthread_mutex_init\n"); (gdb) n 324 pthread_mutex_init (&pQueue->pmMutex, NULL); (gdb) s Program received signal SIGSEGV, Segmentation fault. 0x77e75a3d in _libkernel32_a_iname () -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/