On Wed, Aug 27, 2003 at 03:15:56PM +0100, Stephen Turner wrote:
> On Tue, 26 Aug 2003, Ken Schweigert wrote:
> >
> > Since I'm quite sure I can get this to reproduce, I'll volunteer to step through
> > with the debugger.  However, I must admit that my debugging skills are very
> > limited.  I can compile stuff just fine, just never needed to debug anything
> > before.  If you'd be willing to walk me through this, and let me know what you
> > need to see, I'll do it.  I've already compiled Analog with -g so there should
> > be debugging information ready.
> >
> > If you don't have time, maybe you can point me to a good gdb tutorial and tell
> > me what you need from it.
> >
> 
> Thanks for your offer, Ken.
> 
> gdb is pretty simple. I think the only commands you need regularly are:
>   r args  Run the program, with specified commandline args.
>   s  Go to next line, including stepping into functions
>   n  Go to next line, jumping over functions
>   b file.c:nnn  Put a breakpoint at line nnn of file.c
>   c  Continue running to next breakpoint
>   p expr  Print the value of an expression
> I've probably forgotten one, but that should get you started.
> 
> I guess for this problem, you'd need to put a breakpoint immediately after
> the call to gethostbyaddr() in alias.c, and see what tempp contains. And if
> tempp is NULL, h_errno will contain an indication of the error (see man
> gethostbyaddr). Oh, you'll have to declare h_errno by putting
>   extern int h_errno;
> at the top of the dnsresolve() function.
> 
> Did any of that make sense?
> 

I think I got everything, however I must be doing something wrong.  After I hit
the first breakpoint and press 'c' to continue to the next, it just seems to
hang.  I let it sit for about five minutes before I finally Ctrl-C'd out of it.
I set the breakpoint to line 608 which is the line just after where tempp gets
set on 607. 

Here's what my session looked like:

[EMAIL PROTECTED] bin]# gdb analog-debugging 
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
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 "i386-redhat-linux-gnu"...
(gdb) b alias.c:608
Breakpoint 1 at 0x804a67d: file alias.c, line 608.
(gdb) r +g/etc/analog/analog.cfg.piratescove
Starting program: /usr/local/bin/analog-debugging +g/etc/analog/analog.cfg.piratescove

Breakpoint 1, dnsresolve (name=0x809c1f0 "12.215.136.140", level=3 '\003') at 
alias.c:609
609           alarm(0);
(gdb) p tempp
$1 = (struct hostent *) 0x42132478
(gdb) p h_errno
Cannot access memory at address 0x228
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
0xffffe002 in ?? ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y
[EMAIL PROTECTED] bin]#




-- 
Ken Schweigert, Network Administrator
Byte Productions, LLC
http://www.byte-productions.com
+------------------------------------------------------------------------
|  TO UNSUBSCRIBE from this list:
|    http://lists.isite.net/listgate/analog-help/unsubscribe.html
|
|  Digest version: http://lists.isite.net/listgate/analog-help-digest/
|  Usenet version: news://news.gmane.org/gmane.comp.web.analog.general
|  List archives:  http://www.analog.cx/docs/mailing.html#listarchives
+------------------------------------------------------------------------

Reply via email to