This is the mail archive of the 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

	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 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

( 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/
#1  0x610102e4 in fhandler_console::fhandler_console (this=0x25a09a8,  
name=0x6101c866 "/dev/conin") at d/src/winsup/
#2  0x6101cbdf in hinfo::build_fhandler (this=0x61068c2c, fd=0,
dev=2,    name=0x6101c866 "/dev/conin", unit=0) at
#3  0x6101cab8 in hinfo::build_fhandler (this=0x61068c2c, fd=0,   
name=0x6101c866 "/dev/conin", handle=0x24) at /d/src/winsup/
#4  0x6101c95a in hinfo::init_std_file_from_handle (this=0x61068c2c,
fd=0,    handle=0x24, myaccess=2147483648, name=0x6101c608 "{stdin}")   
at /d/src/winsup/
#5  0x6101c6c5 in hinfo_init () at /d/src/winsup/
#6  0x61004344 in dll_crt0_1 () at /d/src/winsup/
#7  0x610045d7 in dll_crt0 (uptr=0x403000) at /d/src/winsup/
#8  0x401176 in cygwin_crt0 (f=0x401050 <main>) at
#9  0x40103a in mainCRTStartup () at
(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;
==>*54            shared_h = OpenFileMappingA (FILE_MAP_READ |
==>*55                                         TRUE, mapname);
57            if (!shared_h &&
58                !(shared_h = CreateFileMappingA ((HANDLE) 0xffffffff,
59                                                 &sec_all,

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