Subject: Re: gzip buffer overflow found
To: None <current-users@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: current-users
Date: 01/18/2001 19:56:31
On Fri, 19 Jan 2001, Simon Burge wrote:

> When debugging with gdb it's useful to build debugging versions of
> the programs.  On my main development machine, I have in /etc/mk.conf:
> 
> 	COPTS+=         -g
> 	LDFLAGS+=       -g
> 
> so all programs and libraries get built with debugging information.

Okay. I did this.

Using my other email as an example.

tn3270 says:

#0  0x480f42a6 in strcpy ()
#1  0x8067be0 in _hostname ()
#2  0x8051574 in main (argc=1, argv=0xbfbe5564)
    at /usr/src/usr.bin/tn3270/tn3270/../../telnet/main.c:356
#3  0x8049f9d in ___start ()

telnet says:

#0  0x482032a6 in strcpy ()
#1  0x805a6a0 in _hostname ()
#2  0x804da2c in main (argc=2, argv=0xbfbe556c) at main.c:356
#3  0x804a2e5 in ___start ()

But how can I easily find line "356" with all the #ifdef's and macros?
(Is there some tool for that?)

After testing further, it appears that the bad strcpy is really line 2434
in commands.c. I wonder why the backtrace says the other one.

Anyone have some good pointers to easy-to-understand documentation for
debugging?

   Jeremy C. Reed
   http://www.reedmedia.net/