This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cygwin1.dll startup and GDB


All,
	Yeahhhh, The snapshots worked when I compiled under egcs1.1.2!!

Now I was able to examine more closely why I can't use gdb with the
snapshots after March 30th. (Or at least the snapshots which ran :)) I
feel kind of stupid because I was debugging with the downloaded binaries
for the dll and completely forget that the debugging information was
stripped!!  Hence, the wierd 'stack errors' I reported earlier. 

Here is what I see...
	
	1) Any program compiled normally will run fine from bash.  I created a
Hello.exe program.
        2) When you try to use gdb and run the program, a SIGSEGV during
the dll startup.
           Lines marked with ==>* are the ones of interest.

Fortunately, this time I was able to see exactly where the problem
was.   This is in shared.cc in the 
open_shared function.  This was a new function added March 31 according
to the ChangeLog.

This is easily recreated on my system.... If more info is needed, please
let me know.  

John Fortin
fortinj@ibm.net

( next line to be executed is line 52 )

52            char *mapname = name ? shared_name (name, 0) : NULL;
(gdb) p mapname
$1 = 0x25a09a8 ""
(gdb) n
55                                         TRUE, mapname);
(gdb) p mapname
$2 = 0x0
(gdb) p name
$3 = 0x0
(gdb) where
#0  open_shared (name=0x0, shared_h=@0x61068bfc, size=124, addr=0x0)  
at /d/src/winsup/shared.cc:55
#1  0x610102e4 in fhandler_console::fhandler_console (this=0x25a09a8,  
name=0x6101c866 "/dev/conin") at d/src/winsup/fhandler_console.cc:38
#2  0x6101cbdf in hinfo::build_fhandler (this=0x61068c2c, fd=0,
dev=2,    name=0x6101c866 "/dev/conin", unit=0) at
/d/src/winsup/hinfo.cc:244
#3  0x6101cab8 in hinfo::build_fhandler (this=0x61068c2c, fd=0,   
name=0x6101c866 "/dev/conin", handle=0x24) at /d/src/winsup/hinfo.cc:227
#4  0x6101c95a in hinfo::init_std_file_from_handle (this=0x61068c2c,
fd=0,    handle=0x24, myaccess=2147483648, name=0x6101c608 "{stdin}")   
at /d/src/winsup/hinfo.cc:184
#5  0x6101c6c5 in hinfo_init () at /d/src/winsup/hinfo.cc:88
#6  0x61004344 in dll_crt0_1 () at /d/src/winsup/dcrt0.cc:690
#7  0x610045d7 in dll_crt0 (uptr=0x403000) at /d/src/winsup/dcrt0.cc:770
#8  0x401176 in cygwin_crt0 (f=0x401050 <main>) at
/d/src/winsup/libccrt0.cc:82
#9  0x40103a in mainCRTStartup () at
/d/src/newlib/libc/sys/cygwin/crt0.c:48
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0xbffa0eb2 in _libuser32_a_iname ()
(gdb) l 55
50        if (!shared_h)
51          {
==>*52            char *mapname = name ? shared_name (name, 0) : NULL;
==>*53
==>*54            shared_h = OpenFileMappingA (FILE_MAP_READ |
FILE_MAP_WRITE,
==>*55                                         TRUE, mapname);
56
57            if (!shared_h &&
58                !(shared_h = CreateFileMappingA ((HANDLE) 0xffffffff,
59                                                 &sec_all,
(gdb)


Note that the SIGSEGV is in line 54/55.  The mapname variable is NULL
from line 52.