On Monday 25 August 2003 12:27, Brian Candler wrote: > On Mon, Aug 25, 2003 at 09:53:00AM -0400, Jesse Guardiani wrote: > > > You could try attaching gdb to the running process: > > > > > > gdb /path/to/sqwebmail pid > > > > > > then do 'bt' to get a backtrace of the current stack frame. Then you > > > can single-step it. This will let you see where this infinite loop is > > > happening. > > > > OK. Sounds good. I'll do that next time it happens. I don't have to > > compile wth any special flags for gdb to work, do I? > > Probably with '-g' if it's not there already, and make sure you do 'make > install' rather than 'make install-strip' otherwise the debug symbols will > be removed.
So where would I put the -g? In my configure statement? Could you give me an example? I have always used printf debugging in the past. (Yeah, I know. It's about time I learned how to use a proper debugger.) BTW, I got another chance to examine some non-debug-symbol-compiled mem hog processes today. Here is the sqwebmail process list: ------ BEGIN sqwebmail ps output ------ [11:[EMAIL PROTECTED]:[~]# ps auxwwwo ppid | grep sqweb vpopmail 30817 24.8 25.2 263504 263064 ?? RN 12:22AM 270:56.82 sqwebmail 515 vpopmail 49645 25.2 11.0 115888 115336 ?? RN 8:58AM 51:45.69 sqwebmail 60227 vpopmail 30707 25.1 16.7 263600 174524 ?? RN 12:21AM 271:12.74 sqwebmail 513 vpopmail 30711 0.0 0.1 1820 1116 ?? I 12:21AM 0:00.00 sqwebmail 30707 vpopmail 30820 0.0 0.1 1820 1116 ?? I 12:22AM 0:00.00 sqwebmail 30817 vpopmail 49648 0.0 0.1 1796 1160 ?? IN 8:58AM 0:00.00 sqwebmail 49645 ------ END sqwebmail ps output ------ The last column is the parent pid. ppid 515, 513, and 60227 are apache web server processes. Looks like sqwebmail process 49645 was spawned by the web server. It then spawned another sqwebmail process 49648, which appears to be relatively idle. Here are some gdb session transcripts: ------ BEGIN gdb transcript for process 30817 ------ [12:[EMAIL PROTECTED]:[~]# gdb /usr/local/apache/cgi-bin/sqwebmail 30817 GNU gdb 4.18 (FreeBSD) Copyright 1998 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 "i386-unknown-freebsd"...(no debugging symbols found)... /usr/home/jesse/30817: No such file or directory. Attaching to program: /usr/local/apache/cgi-bin/sqwebmail, process 30817 Reading symbols from /usr/lib/libm.so.2...(no debugging symbols found)...done. Reading symbols from /usr/local/lib/mysql/libmysqlclient.so.10...(no debugging symbols found)...done. Reading symbols from /usr/lib/libz.so.2...(no debugging symbols found)...done. Reading symbols from /usr/lib/libcrypt.so.2...(no debugging symbols found)...done. Reading symbols from /usr/lib/libc.so.4...(no debugging symbols found)...done. Reading symbols from /usr/libexec/ld-elf.so.1...(no debugging symbols found)...done. 0x281b125e in memcpy () from /usr/lib/libc.so.4 (gdb) bt #0 0x281b125e in memcpy () from /usr/lib/libc.so.4 #1 0x7fb6000 in ?? () #2 0x281b0f01 in realloc () from /usr/lib/libc.so.4 #3 0x8073ea6 in free () #4 0x8073f94 in free () #5 0x8072e9c in free () #6 0x8072a6b in free () #7 0x807257c in free () #8 0x8063764 in free () #9 0x8070eb9 in free () #10 0x8071ed4 in free () #11 0x8071700 in free () #12 0x804a1d2 in free () (gdb) ? Undefined command: "". Try "help". (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) next Single stepping until exit from function memcpy, which has no line number information. ^CQuit 0x281b125e in memcpy () from /usr/lib/libc.so.4 (gdb) step Single stepping until exit from function memcpy, which has no line number information. ^C Program received signal SIGINT, Interrupt. 0x281b125e in memcpy () from /usr/lib/libc.so.4 (gdb) quit The program is running. Quit anyway (and detach it)? (y or n) y Detaching from program: /usr/local/apache/cgi-bin/sqwebmail, process 30817 [12:[EMAIL PROTECTED]:[~]# ps auxwwwo ppid | grep sqweb vpopmail 49645 37.8 8.3 117664 86928 ?? RN 8:58AM 53:22.76 sqwebmail 60227 vpopmail 30707 37.6 25.3 264368 263924 ?? RN 12:21AM 272:49.50 sqwebmail 513 vpopmail 30711 0.0 0.1 1820 1108 ?? I 12:21AM 0:00.00 sqwebmail 30707 vpopmail 49648 0.0 0.1 1796 1152 ?? IN 8:58AM 0:00.00 sqwebmail 49645 ------ END gdb transcript for process 30817 ------ As you can see, I accidentally killed the process by typing CTRL+C in gdb. How else can I terminate a 'next' or 'step'? Here is another transcript: ------ BEGIN gdb transcript for process 60227 ------ [12:[EMAIL PROTECTED]:[~]# gdb /usr/local/apache/cgi-bin/sqwebmail 60227 GNU gdb 4.18 (FreeBSD) Copyright 1998 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 "i386-unknown-freebsd"...(no debugging symbols found)... /usr/home/jesse/60227: No such file or directory. Attaching to program: /usr/local/apache/cgi-bin/sqwebmail, process 60227 0x28110ecc in ?? () (gdb) bt #0 0x28110ecc in ?? () #1 0x80524a9 in free () #2 0x804fcfb in free () #3 0x804fd5f in free () #4 0x804fccb in free () #5 0x8060c79 in free () #6 0x80613cc in free () #7 0x8061750 in free () #8 0x8061ccd in free () #9 0x806232c in free () #10 0x804f4ae in free () (gdb) step Cannot find bounds of current function (gdb) next Cannot find bounds of current function (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) quit The program is running. Quit anyway (and detach it)? (y or n) y Detaching from program: /usr/local/apache/cgi-bin/sqwebmail, process 60227 [12:[EMAIL PROTECTED]:[~]# ps auxwwwo ppid | grep sqweb vpopmail 49645 39.1 11.6 121864 121308 ?? RN 8:58AM 57:19.02 sqwebmail 60227 vpopmail 30707 38.5 18.6 266272 194280 ?? RN 12:21AM 276:47.88 sqwebmail 513 vpopmail 30711 0.0 0.1 1820 1108 ?? I 12:21AM 0:00.00 sqwebmail 30707 vpopmail 49648 0.0 0.1 1796 1152 ?? IN 8:58AM 0:00.00 sqwebmail 49645 ------ END gdb transcript for process 60227 ------ This one didn't die when I quit gdb, but it couldn't step or next either. And another: ------ BEGIN gdb transcript for process 49648 ------ [12:[EMAIL PROTECTED]:[~]# gdb /usr/local/apache/cgi-bin/sqwebmail 49648 GNU gdb 4.18 (FreeBSD) Copyright 1998 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 "i386-unknown-freebsd"...(no debugging symbols found)... /usr/home/jesse/49648: No such file or directory. Attaching to program: /usr/local/apache/cgi-bin/sqwebmail, process 49648 Reading symbols from /usr/lib/libm.so.2...(no debugging symbols found)...done. Reading symbols from /usr/local/lib/mysql/libmysqlclient.so.10...(no debugging symbols found)...done. Reading symbols from /usr/lib/libz.so.2...(no debugging symbols found)...done. Reading symbols from /usr/lib/libcrypt.so.2...(no debugging symbols found)...done. Reading symbols from /usr/lib/libc.so.4...(no debugging symbols found)...done. Reading symbols from /usr/libexec/ld-elf.so.1...(no debugging symbols found)...done. 0x2816fecc in wait4 () from /usr/lib/libc.so.4 (gdb) bt #0 0x2816fecc in wait4 () from /usr/lib/libc.so.4 #1 0x2816406d in wait () from /usr/lib/libc.so.4 #2 0x8073e21 in free () #3 0x8073f94 in free () #4 0x8072e9c in free () #5 0x8072a6b in free () #6 0x807257c in free () #7 0x8063764 in free () #8 0x8070eb9 in free () #9 0x8071ed4 in free () #10 0x8071700 in free () #11 0x804a1d2 in free () (gdb) step Single stepping until exit from function wait4, which has no line number information. ^D ^C Program received signal SIGINT, Interrupt. 0x2816fecc in wait4 () from /usr/lib/libc.so.4 (gdb) next Single stepping until exit from function wait4, which has no line number information. ^C Program received signal SIGINT, Interrupt. 0x2816fecc in wait4 () from /usr/lib/libc.so.4 (gdb) quit The program is running. Quit anyway (and detach it)? (y or n) y Detaching from program: /usr/local/apache/cgi-bin/sqwebmail, process 49648 [12:[EMAIL PROTECTED]:[~]# ps auxwwwo ppid | grep sqweb vpopmail 49645 38.8 5.9 62216 61600 ?? RN 8:58AM 57:51.51 sqwebmail 60227 vpopmail 30707 38.6 22.0 266528 229328 ?? RN 12:21AM 277:20.46 sqwebmail 513 vpopmail 30711 0.0 0.1 1820 1108 ?? I 12:21AM 0:00.00 sqwebmail 30707 vpopmail 49648 0.0 0.0 0 0 ?? ZN 8:58AM 0:00.00 (sqwebmail) 49645 ------ END gdb transcript for process 49648 ------ This one died too because of the CTRL+C. So, I take it that compiling sqwebmail with debugging symbols will reveal a bit more info? Tell me what I need to do. I'm anxious to get to the bottom of this. Thanks! -- Jesse Guardiani, Systems Administrator WingNET Internet Services, P.O. Box 2605 // Cleveland, TN 37320-2605 423-559-LINK (v) 423-559-5145 (f) http://www.wingnet.net