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: "Hannu E K Nevalainen" To: Subject: cygpath hang - using gdb Date: Wed, 8 Oct 2003 20:00:21 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 > I will be investigating the problem in every way that anyone can > think of as time permits. No promises though, as usual. > I'll have to learn bits and pieces of cvs and gdb for starters - > I'll do my best. $ MODE=ironic rant "I'll be back" - is this a general salute nowadays? ;-P You're about to see me trying to use gdb for the first time. Say after me please: "YES, WE LOVE IT!" ... Ahh... I didn't hear you ;-) $ MODE=serious Looking at "sample use" in "info gdb" I see things that looks fairly straight forward and familiar. Now when I try "gdb --pid=" - when cygpath has hung - I end up with a situation that I don't recognise from that sample. A couple of "s" commands and the gdb session ends up having no "(gdb)" prompt. I get the impression that cygpath has stopped somewhere in a system DLL, and debugging fails in there. Killing cygpath makes the prompt return. In hope that it will tell SOMETHING I have copied two sessions into the remainder of this message. I'll be persuing this a bit more, but that might take some time. Please *DO* point out facts for me if you see anything useful. $ pwd /bin $ g++ -O0 -g3 -o cygpath cygpath.cc $ objdump -g cygpath.exe | wc -l 18485 $ cat /etc/postinstall/t3.sh #!/bin/bash -x TOPFOLDER="`cygpath -A -P`/Cygwin-XFree86" echo $TOPFOLDER $ cygstart -- /install/setup.exe --mno-md5 "Running /etc/postinstall/t3.sh" at 99% $ ps PID PPID PGID WINPID TTY UID STIME COMMAND 576 1 576 1988 con 500 10:15:50 /usr/bin/rxvt I 1100 576 1100 304 0 500 10:15:50 /usr/bin/bash 360 1 360 2016 con 500 14:19:55 /usr/bin/rxvt 2340 360 2340 2028 2 500 14:19:55 /usr/bin/bash I 2776 2340 2776 2736 2 500 14:34:39 /usr/bin/info 672 1 672 820 con 500 15:18:15 /usr/bin/rxvt 2796 672 2796 1952 1 500 15:18:15 /usr/bin/bash 2816 1 2816 2816 con 500 15:29:50 /usr/bin/sh I 612 2816 2816 612 con 500 15:29:50 /usr/bin/bash 2828 612 2816 2828 con 500 15:29:51 /usr/bin/cygpath 732 2796 732 2740 1 500 15:29:59 /usr/bin/ps $ gdb --pid=2828 GNU gdb 2003-09-20-cvs (cygwin-special) Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-cygwin". Attaching to process 2828 [Switching to thread 2828.0x7d8] (gdb) bt #0 0x77fa144c in ntdll!DbgUiConnectToDbg () from /cygdrive/f/WINNT/system32/NTDLL.DLL #1 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL #2 0x7c4e987c in SetThreadExecutionState () from /cygdrive/f/WINNT/system32/KERNEL32.DLL -- Using s, n, f, file, p or list from here seems to be of no use. Any advice? -- (gdb) s Single stepping until exit from function ntdll!DbgUiConnectToDbg, which has no line number information. 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) list No symbol table is loaded. Use the "file" command. (gdb) f #0 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) s Single stepping until exit from function KERNEL32!DebugActiveProcess, which has no line number information. -- no more prompt here -- From another bash: $ ps PID PPID PGID WINPID TTY UID STIME COMMAND ... 2828 612 2816 2828 con 500 15:29:51 /usr/bin/cygpath 2012 2796 2012 552 1 500 15:30:10 /usr/bin/gdb 2844 1100 2844 2740 0 500 15:47:40 /usr/bin/ps $ kill -9 2012 $ ps PID PPID PGID WINPID TTY UID STIME COMMAND ... 2828 612 2816 1552 con 500 15:47:51 2768 1100 2768 392 0 500 15:47:58 /usr/bin/ps $ kill -9 2828 $ ps PID PPID PGID WINPID TTY UID STIME COMMAND 576 1 576 1988 con 500 10:15:50 /usr/bin/rxvt 1100 576 1100 304 0 500 10:15:50 /usr/bin/bash 360 1 360 2016 con 500 14:19:55 /usr/bin/rxvt 2340 360 2340 2028 2 500 14:19:55 /usr/bin/bash I 2776 2340 2776 2736 2 500 14:34:39 /usr/bin/info 2816 1100 2816 1824 0 500 15:48:09 /usr/bin/ps $ -- YET ANOTHER SESSION -- Does this tell anything at all? (I was trying to find out anything useful about the situation) (gdb) info source Current source file is cygpath.cc Compilation directory is /bin/ Located in /usr/bin/cygpath.cc Contains 769 lines. Source language is c++. Compiled with stabs debugging format. Does not include preprocessor macro info. (gdb) attach 1076 Attaching to program `/usr/bin/cygpath.exe', process 1076 [Switching to thread 1076.0xacc] (gdb) bt #0 0x77fa144c in ntdll!DbgUiConnectToDbg () from /cygdrive/f/WINNT/system32/NTDLL.DLL #1 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL #2 0x7c4e987c in SetThreadExecutionState () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) f #0 0x77fa144c in ntdll!DbgUiConnectToDbg () from /cygdrive/f/WINNT/system32/NTDLL.DLL (gdb) info args No symbol table info available. (gdb) info dll DLL Name Load Address /cygdrive/f/WINNT/system32/NTDLL.DLL 77f81000 /usr/bin/cygwin1.dll 61001000 /cygdrive/f/WINNT/system32/KERNEL32.DLL 7c4e1000 /cygdrive/f/WINNT/system32/USER32.DLL 77e11000 /cygdrive/f/WINNT/system32/GDI32.DLL 77f41000 /cygdrive/f/WINNT/system32/ADVAPI32.DLL 7c2d1000 /cygdrive/f/WINNT/system32/rpcrt4.dll 77d31000 (gdb) info frame Stack level 0, frame at 0xb6ffac: eip = 0x77fa144c in ntdll!DbgUiConnectToDbg; saved eip 0x7c50dfdb called by frame at 0xb6ffbc Arglist at 0xb6ffa4, args: Locals at 0xb6ffa4, Previous frame's sp is 0xb6ffac Saved registers: eip at 0xb6ffa8 (gdb) f 1 #1 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) info frame Stack level 1, frame at 0xb6ffbc: eip = 0x7c50dfdb in KERNEL32!DebugActiveProcess; saved eip 0x7c4e987c called by frame at 0xb6fff4, caller of frame at 0xb6ffac Arglist at 0xb6ffb4, args: Locals at 0xb6ffb4, Previous frame's sp is 0xb6ffbc Saved registers: ebx at 0xb6ff20, ebp at 0xb6ffb4, eip at 0xb6ffb8 (gdb) f 2 #2 0x7c4e987c in SetThreadExecutionState () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) info frame Stack level 2, frame at 0xb6fff4: eip = 0x7c4e987c in SetThreadExecutionState; saved eip 0x0 caller of frame at 0xb6ffbc Arglist at 0xb6ffec, args: Locals at 0xb6ffec, Previous frame's sp is 0xb6fff4 Saved registers: ebx at 0xb6ff20, ebp at 0xb6ffec, eip at 0xb6fff0 (gdb) info functions All defined functions: File cygpath.cc: int main(int, char **); static void convert_slashes(char*); static void doit(char*); static void dowin(char); static char *get_long_name(char const*, unsigned long&); static DWORD get_long_path_name_w32impl(char const*, char*, unsigned long); static char *get_long_paths(char*); static char *get_mixed_name(char const*); static char *get_short_name(char const*); static char *get_short_paths(char*); static void print_version(); static void usage(__sFILE64*, int); Non-debugging symbols: 0x00401000 _RUNTIME_PSEUDO_RELOC_LIST_END__ 0x00401000 _RUNTIME_PSEUDO_RELOC_LIST__ 0x00401000 __RUNTIME_PSEUDO_RELOC_LIST_END__ 0x00401000 __RUNTIME_PSEUDO_RELOC_LIST__ 0x00401000 _end__ 0x00401000 mainCRTStartup 0x00401040 __do_sjlj_init 0x00403370 w32_atom_suffix 0x00403390 __w32_sharedptr_default_unexpected 0x004033b0 __w32_eh_shared_initialize 0x00403420 __w32_sharedptr_initialize 0x00403560 __w32_sharedptr_set 0x004035f0 __w32_sharedptr_get 0x00403660 __w32_sharedptr_fixup_after_fork 0x00403690 __chkstk 0x00403690 _alloca 0x00403696 probe 0x004036ad done 0x004036c0 cygwin_crt0 0x00403720 __main 0x00403730 isspace 0x00403740 fgets 0x00403750 setbuf 0x00403760 perror 0x00403770 setmode 0x00403780 fopen 0x00403790 strcasecmp 0x004037a0 strtoul 0x004037b0 getopt_long 0x004037c0 puts 0x004037d0 cygwin_conv_to_win32_path 0x004037e0 cygwin_conv_to_full_win32_path 0x004037f0 cygwin_conv_to_full_posix_path 0x00403800 cygwin_posix_to_win32_path_list 0x00403810 cygwin_win32_to_posix_path_list 0x00403820 cygwin_posix_to_win32_path_list_buf_size 0x00403830 cygwin_win32_to_posix_path_list_buf_size 0x00403840 printf ---Type to continue, or q to quit---q Quit (gdb) l 201 continue; 202 } 203 pelem = strchr (next, '\\'); 204 len = pelem ? (pelem++ - next) : strlen (next); 205 strncpy (ptr, next, len); 206 ptr[len] = 0; 207 if (next[1] != ':' && strcmp(next, ".") && strcmp(next, "..")) 208 { 209 if (FindFirstFile (buf2, &w32_fd) != INVALID_HANDLE_VALUE) 210 strcpy (ptr, w32_fd.cFileName); (gdb) info line 205 Line 205 of "cygpath.cc" starts at address 0x401bec <_Z26get_long_path_name_w32implPKcPcm+246> and ends at 0x401c0e <_Z26get_long_path_name_w32implPKcPcm+280>. (gdb) bt #0 0x77fa144c in ntdll!DbgUiConnectToDbg () from /cygdrive/f/WINNT/system32/NTDLL.DLL #1 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL #2 0x7c4e987c in SetThreadExecutionState () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) info program Using the running image of child thread 1076.0xacc. Program stopped at 0x77fa144c. (gdb) f 0 #0 0x77fa144c in ntdll!DbgUiConnectToDbg () from /cygdrive/f/WINNT/system32/NTDLL.DLL (gdb) s Single stepping until exit from function ntdll!DbgUiConnectToDbg, which has no line number information. 0x7c50dfdb in KERNEL32!DebugActiveProcess () from /cygdrive/f/WINNT/system32/KERNEL32.DLL (gdb) s Single stepping until exit from function KERNEL32!DebugActiveProcess, which has no line number information. - no prompt back after this - $ kill -9 ;kill -9 # from another shell Program exited with code 0204400. (gdb) The program is not being run. (gdb) Killed /Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E -- UTC+01, DST -> UTC+02 -- --END OF MESSAGE-- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/