Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* stepping into a shared object
@ 2002-05-16 12:22 Ed Harcourt
  2002-05-16 15:48 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Harcourt @ 2002-05-16 12:22 UTC (permalink / raw)
  To: gdb

Are there any known issues while trying to step into a shared object using 
gdb in mixed C/C++?

Here's the situation.

I have a main.c compiled using the Solaris C compiler (not C++). Version is 
Sun WorkShop 6 update 1 C 5.2 2000/09/11.

I have C++ objects built using g++ 2.95.2. Everything built with -g. An 
entry function f is extern "C".

I linked the C++ objects and created a mylib.so using the Solaris linker ld.

main does a dlopen to get at the mylib.so. I can't step into f from main.

Sound familiar? Or should this work?

Thanks in advance.

Ed

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stepping into a shared object
  2002-05-16 12:22 stepping into a shared object Ed Harcourt
@ 2002-05-16 15:48 ` Kevin Buettner
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Buettner @ 2002-05-16 15:48 UTC (permalink / raw)
  To: Ed Harcourt, gdb

On May 16,  3:22pm, Ed Harcourt wrote:

> I have a main.c compiled using the Solaris C compiler (not C++). Version is 
> Sun WorkShop 6 update 1 C 5.2 2000/09/11.
> 
> I have C++ objects built using g++ 2.95.2. Everything built with -g. An 
> entry function f is extern "C".
> 
> I linked the C++ objects and created a mylib.so using the Solaris linker ld.
> 
> main does a dlopen to get at the mylib.so. I can't step into f from main.
> 
> Sound familiar? Or should this work?

It should work.

Here are some things to try:

 1) After the library is dlopen'd, are you able to place a breakpoint
    in the shared library and continue to the breakpoint?

 2) Are you able to step into other types of shared libraries (i.e,
    ones that aren't dlopen'd?

(This won't directly solve your problem, but knowing the answers might
help us to figure out what's going wrong.)

Kevin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: stepping into a shared object
@ 2002-05-17  5:58 Ed Harcourt
  0 siblings, 0 replies; 3+ messages in thread
From: Ed Harcourt @ 2002-05-17  5:58 UTC (permalink / raw)
  To: kevinb, gdb

Kevin,

Thanks for the prompt reply.

>  1) After the library is dlopen'd, are you able to place a breakpoint
>     in the shared library and continue to the breakpoint?

No, I can't set a breakpoint anywhere in the shared object. I did some 
further experiments and I'm starting to think this may not be a gdb problem 
since I can't step into it in dbx either. But dbx gives me an error message 
that says:

   "cannot find object file corresponding to source f.cpp"

gdb doesn't tell me anything. However, I can step into it in dbx if I build 
my .so with the Sun compiler and not g++.

So maybe its a problem with linking the mix and match of Sun object files 
and g++ object files.  Or maybe I need some other magic switch other than -g 
in on gcc or the linker yet that I haven't yet discovered.

>  2) Are you able to step into other types of shared libraries (i.e,
>     ones that aren't dlopen'd?

Yes. I tried to create a small testcase of a main compiled with Sun's cc and 
a separate .so with g++ and link them. Unfortunately things work fine in 
this case. The example that doesn't work is on quite a large system.

Any other hints on what I might try next?

Ed

>From: Kevin Buettner <kevinb@redhat.com>
>To: "Ed Harcourt" <shmooga@hotmail.com>, gdb@sources.redhat.com
>Subject: Re: stepping into a shared object
>Date: Thu, 16 May 2002 15:47:52 -0700
>MIME-Version: 1.0
>Received: from cygnus.com ([205.180.83.203]) by hotmail.com with Microsoft 
>SMTPSVC(5.0.2195.4905); Thu, 16 May 2002 15:47:49 -0700
>Received: from romulus.sfbay.redhat.com (remus.sfbay.redhat.com 
>[172.16.27.252])by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id 
>PAA05642;Thu, 16 May 2002 15:47:54 -0700 (PDT)
>Received: (from kev@localhost)by romulus.sfbay.redhat.com (8.11.6/8.11.6) 
>id g4GMlqg19910;Thu, 16 May 2002 15:47:52 -0700
>Message-Id: <1020516224752.ZM19909@localhost.localdomain>
>In-Reply-To: "Ed Harcourt" <shmooga@hotmail.com>        "stepping into a 
>shared object" (May 16,  3:22pm)
>References: <F169xw8Zw5V6QcqnWwA00003938@hotmail.com>
>X-Mailer: Z-Mail (4.0.1 13Jan97 Caldera)
>Return-Path: kev@redhat.com
>X-OriginalArrivalTime: 16 May 2002 22:47:49.0855 (UTC) 
>FILETIME=[B49ACEF0:01C1FD2B]
>
>On May 16,  3:22pm, Ed Harcourt wrote:
>
> > I have a main.c compiled using the Solaris C compiler (not C++). Version 
>is
> > Sun WorkShop 6 update 1 C 5.2 2000/09/11.
> >
> > I have C++ objects built using g++ 2.95.2. Everything built with -g. An
> > entry function f is extern "C".
> >
> > I linked the C++ objects and created a mylib.so using the Solaris linker 
>ld.
> >
> > main does a dlopen to get at the mylib.so. I can't step into f from 
>main.
> >
> > Sound familiar? Or should this work?
>
>It should work.
>
>Here are some things to try:
>
>  1) After the library is dlopen'd, are you able to place a breakpoint
>     in the shared library and continue to the breakpoint?
>
>  2) Are you able to step into other types of shared libraries (i.e,
>     ones that aren't dlopen'd?
>
>(This won't directly solve your problem, but knowing the answers might
>help us to figure out what's going wrong.)
>
>Kevin






_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-05-17 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-16 12:22 stepping into a shared object Ed Harcourt
2002-05-16 15:48 ` Kevin Buettner
2002-05-17  5:58 Ed Harcourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox