Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Mar 2000 20:51:44 -0700 (MST)
From:      Nate Williams <nate@yogotech.com>
To:        freebsd-stable@FreeBSD.org
Subject:   GDB on C++ programs under FreeBSD 3.X
Message-ID:  <200003020351.UAA04126@nomad.yogotech.com>

next in thread | raw e-mail | index | archive | help
Any idea what would cause this?  A co-worker is debugging a C++ program,
and this sort of things works fine under 2.2, but doesn't work under
3.X.

> 	The "-static" linker flag did not appear to change anything.
> Any additional insights would be greatly appreciated.
> 
> FreeBSD Version: 3.3-RELEASE
> 
> GDB Version: GNU gdb 4.18
> 
> Typical GDB Output:
> =-=-=
> (gdb) p pkt
> $1 = (CpfPkt *) 0x8d28a04
> (gdb) call pkt->printAll(0, (void *)0)
> Cannot resolve method CpfPkt::printAll to any overloaded instance
> (gdb) call pkt->printAll()
> Cannot resolve method CpfPkt::printAll to any overloaded instance
> (gdb) call CpfSimNodeNameGet()
> Segmentation fault(core dumped)
> =-=-=

I tried creating a simple test program, but the test program works as
expected.

Under FreeBSD 2.2.8-stable.
(gdb) print pkt
$1 = (CpfPkt *) 0xa83a04
(gdb) call pkt->printAll(0, (void *)0)
      node3: 0.056106 Pkt [0xa83a04] object CpfPkt: originated in node3/br.0
      node3: 0.056106 CpfProtoComm CpfPkt: originated in node3/br.0 node node3
      node3: 0.056106     Owner Broadcast Radio MAC (1a2eb04), Current proto Broadcast Radio MAC (1a2eb04)
      node3: 0.056106     Retain flag 0, Notify flag 0, Notify type 0x10000000
....

You get the point.

I'll keep trying to develop a simple test case, but this is a rather
large C++ program, and breaking things down into smaller pieces don't
seem to work.

In the same vein, I have other weird behavior that occurs, which may
shed some light.

I tried linking statically to see if that would help, and that doesn't
seem to do anything.  To link statically, I add '-static' to the link
line, but the resulting executable is still created as a dynamic
executable (at least according to file).
    www:~/roof/cpt/examples/hier % file prog
    prog: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, not stripped

However, if I run ldd on the resulting 'dynamic' executable, the
following error occurs.

    www:~/roof/cpt/examples/hier % ldd prog
    prog:
    ELF interpreter /usr/lib/libc.so.1 not found
    prog: signal 6

I don't have any 4.* systems, nor do I have the resources to create one,
so I can't test there.

Thanks for any help you can provide!


Nate




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003020351.UAA04126>