[dns-operations] Fwd: Execution Problems WAS (Re: friday version of dnscap)

Tyler Reguly ht at computerdefense.org
Thu May 10 07:31:32 UTC 2007

I'm by no means a C developer (python is my language of choice) or a
power gdb user... so I'll do my best... I'll try and provide what I
see as relevant info here and if there's anything I've forgotten let
me know and I'll provide it

I'm at even more of a disadvantage than usual because it's PPC so I
don't recognize any of the registers.

1. file ~/dnscap/dnscap
2. break getopt
3. set args -c2 -g
4. r
>Breakpoint 1 at 0x1006d654
>Breakpoint 1 at 0xff591e0

>Breakpoint 1, 0x0ff591e0 in getopt () from /lib/libc.so.6
5. info stack
>(gdb) info stack
>#0  0x0ff591e0 in getopt () from /lib/libc.so.6
>#1  0x100025e4 in parse_args (argc=3, argv=0x7fc70af4) at dnscap.c:326
>#2  0x10001e14 in main (argc=3, argv=0x7fc70af4) at dnscap.c:230

Registers Containing Seemingly Useful Things:
(gdb) x/5s $r5
0x1004b38c <__PRETTY_FUNCTION__.7293+1352>:
0x1004b3ab <__PRETTY_FUNCTION__.7293+1383>:      ""
0x1004b3ac <__PRETTY_FUNCTION__.7293+1384>:      "invalid host address"
0x1004b3c1 <__PRETTY_FUNCTION__.7293+1405>:      ""
0x1004b3c2 <__PRETTY_FUNCTION__.7293+1406>:      ""

(gdb) x/5s $pc
0xff591e0 <getopt+20>:   "8?"
0xff591e3 <getopt+23>:   ""
0xff591e4 <getopt+24>:   "K??i\200\001"
0xff591eb <getopt+31>:   "\0248!"
0xff591ef <getopt+35>:   "\020|\b\003?N\200"
(gdb) x/5s $lr
0x100025e4 <parse_args+1460>:    "Tc\006>8\003??+\200"
0x100025ef <parse_args+1471>:    "@A\235??= \020\0059)?\030T"
0x100025fe <parse_args+1486>:    "\020:|\t"
0x10002603 <parse_args+1491>:    ".|"
0x10002606 <parse_args+1494>:    "J\024|\t\003?N\200\004
(gdb) x/5s $ctr
0xff591cc <getopt>:      "|?\002?\224!??8?"
0xff591d7 <getopt+11>:   ""
0xff591d8 <getopt+12>:   "9"
0xff591da <getopt+14>:   ""
0xff591db <getopt+15>:   ""

And on we go:

Make selected stack frame return now? (y or n) y
#0  parse_args (argc=3, argv=0x7fc70af4) at dnscap.c:330
330                     switch (ch) {
(gdb) return
Make parse_args return now? (y or n) y
#0  main (argc=<value optimized out>, argv=<value optimized out>) at
231             prepare_bpft();
#0  0x0febb8ec in __libc_init_first () from /lib/libc.so.6

--- I had already typed out all of that so I'll leave it... but I
believe i found my problem... Being lazy and disliking errors.. I
removed -Werror

As a result.. I bypassed the following:

dnscap.c: In function 'parse_args':
dnscap.c:327: warning: comparison is always true due to limited range
of data type
dnscap.c:311: warning: function might be possible candidate for
attribute 'noreturn'

On 5/10/07, Paul Vixie <paul at vix.com> wrote:
> > After solving the --enable-bind problem..
> you mean --enable-libbind i think, if you're referring to the invocation
> of "./configure" when building bind9 from source.
> > (previously I was replacing  ns_put32 with NS_PUT32 and including
> > -lresolv in order to get the fp_nquey function)
> if your libresolv includes fp_nquery then you can link against it, sure.
> alas, system integrators have put fp_nquery in a lot of places, and the
> only sure way i know to write this makefile is to depend on -lbind.  if
> you install bind9 from source, using --enable-libbind, you'll have it.
> (if you install bind8, you'll also get libbind, but plz don't do that!)
> > I'm still having other issues... I get the help output regardless of
> > what I do
> >
> > Using man page example:
> > root at iMac:/home/htregz/dnscap# ./dnscap -d - | tcpdump -r -
> > dnscap: usage error: unrecognized command line option
> how very odd.
> > Using email example:
> >
> > root at iMac:/home/htregz/dnscap# ./dnscap -g -c2
> > dnscap: usage error: unrecognized command line option
> that's terribly strange.
> > I'm running Ubuntu 6.06.1 LTS PPC.
> on freebsd and on suselinux, those examples produce expected (good) output.
> so, perhaps you can use gdb in order to find out what getopt() is returning?
> _______________________________________________
> dns-operations mailing list
> dns-operations at lists.oarci.net
> http://lists.oarci.net/mailman/listinfo/dns-operations

More information about the dns-operations mailing list