This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: gdb 5.3 bug
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Lev Assinovsky <LAssinovsky at algorithm dot aelita dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Sat, 1 Mar 2003 11:04:51 -0500
- Subject: Re: gdb 5.3 bug
- References: <3F6F4712B759A34ABD453A8B39C10D6229DE31@bagman.edm.com>
On Sat, Mar 01, 2003 at 06:59:45PM +0300, Lev Assinovsky wrote:
> Dear Daniel!
> Thank you very match for your advise!
> Snapshot gdb+dejagnu-20030228 works just fine!
> Thank a lot all guys who is involved in gdb development.
> I am sorry but I have to bother you with another gdb problem.
> The problem is I can't step into the function through the pointer
> if the function resides in dynamically loaded shared object (library).
> Here is the simple test case:
Hmm. Your testcase works on GNU/Linux, so it must be related to
i386-solaris shared library support. Maybe someone else on the list
can help.
>
> 1. Shared object:
> ---------- cut here --------
> #include <iostream>
> using namespace std;
>
> extern "C" {
> void my_func()
> {
> cout << "This is my_func" << endl;
> }
>
> }
> ---------- cut here --------
> 2. Main:
> #include <iostream>
> #include <memory>
> #include <dlfcn.h>
> #include <link.h>
>
> using namespace std;
>
> void * handle;
>
> typedef void ( *Func_t)();
>
> Func_t getFunc()
> {
> Func_t p = (Func_t)dlsym ( handle, "my_func" );
> if ( NULL == p )
> {
> cout << dlerror() << endl;
> exit(2);
> }
> return p;
> }
>
> int main()
> {
> handle = (void*) ::dlopen("./func_so/bin/i386-sun-solaris/func_so.so", RTLD_NOW | RTLD_LOCAL | RTLD_GROUP);
> if (handle == NULL)
> {
> cout << dlerror() << endl;
> exit(2);
> }
>
> Func_t f = getFunc();
> f();
> }
> ---------- cut here --------
>
> This testcase works, but I can't step into f() (last line) in gdb.
> Is it possible to work around or fix this problem?
> Thanks in advance!
>
> ----
> Lev Assinovsky
> Aelita Software Corporation
> O&S Core Division, Programmer
> ICQ# 165072909
>
>
> > -----Original Message-----
> > From: Daniel Jacobowitz [mailto:drow at mvista dot com]
> > Sent: Friday, February 28, 2003 8:19 PM
> > To: Lev Assinovsky; gdb at sources dot redhat dot com
> > Subject: Re: gdb 5.3 bug
> >
> >
> > On Thu, Feb 27, 2003 at 02:09:30PM -0500, Daniel Jacobowitz wrote:
> > > On Thu, Feb 27, 2003 at 09:11:14PM +0300, Lev Assinovsky wrote:
> > > > GNU gdb 5.3
> > > > Copyright 2002 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-pc-solaris2.8"...
> > > > (gdb) l
> > > >
> > > > Program received signal SIGSEGV, Segmentation fault.
> > > > 0x08136671 in finish_block (symbol=0x6e5f5f3a,
> > listhead=0x82241f4, old_blocks=0x3a787863, start=1634562671,
> > > > end=1634562720, objfile=0x8263fe0) at buildsym.c:304
> > > > 304 struct type *ftype = SYMBOL_TYPE (symbol);
> > > > (gdb)
> > > >
> > > >
> > > > Any clue what might be the reason of gdb crash?
> > >
> > > OK, the value of "symbol" is obviously wrong. Could you
> > privately send
> > > me the binary? If that's not possible, at least a
> > backtrace would be
> > > useful...
> >
> >
> > Lev,
> >
> > You're in luck, this has already been fixed. It appears to
> > be a bug in
> > the Sun compilers - it outputs end-of-function markers without a
> > corresponding beginning-of-function marker. If you get a GDB snapshot
> > from CVS (http://sources.redhat.com/gdb/) it should handle
> > your program
> > gracefully.
> >
> > --
> > Daniel Jacobowitz
> > MontaVista Software Debian GNU/Linux Developer
> >
>
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer