On Mon, Jun 18, 2001 at 11:20:36PM -0400, Troy Settle wrote:
% How would I need to go about building a dubug version of qmail-remote?
I set conf-cc and conf-ld to 'gcc -g', edited timeoutread.c slightly
to save the return value of the select in a variable, then built
qmail-remote and put it in place of the live one. I'll attach a patch
matching what I did to timeoutread.c.
% Also, how to terminate the process so that I can 'fling' gdb at it?
I wasn't planning on terminating it. Rather I was thinking of using
gdb's "attach" command to take over the process, and then start
examining variables. Mostly, I was going to wing it.
I expect the full attachment sequence to look something like this:
(gdb) attach <pid-of-stuck-qmail-remote>
(gdb) symbol-file /var/qmail/bin/qmail-remote
(gdb) directory <path-to-qmail-source-with-modified-timeoutread.c>
(gdb) bt
(gdb) up <-- repeat until at timeoutread() stack frame
(gdb) p res
(gdb) p fd
(gdb) p rfds <-- or something like that
% With a little I can probably have output from gdb within a couple hours.
Good luck, then.
Mark
--- timeoutread.c Mon Jun 15 03:53:16 1998
+++ timeoutread.c Mon Jun 18 22:23:24 2001
@@ -7,6 +7,7 @@
{
fd_set rfds;
struct timeval tv;
+ int res;
tv.tv_sec = t;
tv.tv_usec = 0;
@@ -14,7 +15,8 @@
FD_ZERO(&rfds);
FD_SET(fd,&rfds);
- if (select(fd + 1,&rfds,(fd_set *) 0,(fd_set *) 0,&tv) == -1) return -1;
+ res = select(fd + 1,&rfds,(fd_set *) 0,(fd_set *) 0,&tv);
+ if (res == -1) return -1;
if (FD_ISSET(fd,&rfds)) return read(fd,buf,len);
errno = error_timeout;