Re: dlclose() causing segmentation fault on exit from main()
From: Alexander Popov (s_popovNOSPAM_at_prosyst.bg)
Date: 09/01/04
- Previous message: aires: "Re: problems with real-time POSIX signals"
- Maybe in reply to: Roger Leigh: "Re: dlclose() causing segmentation fault on exit from main()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 1 Sep 2004 12:50:42 +0000
On 31 Aug 2004 07:13:25 -0700 news@exillis.com (Exillis) wrote:
Try running this trough valgrind with a libc with debug...
valgrind (memcheck) will show you what/where exactly is the problem.
It's a good idea to use a deeper stack trace
> Hi,
>
> I'm running into a problem on Linux while dynamically loading and
> unloading DSOs. The problem is, if I build with --fuse-cxa-atexit I
> get a segmentation fault on exit from main() after I've done a
> dlclose() on a DSO and then exit from main(). Commenting out dlclose()
> or compiling with --fno-use-cxa-atexit avoids the segmentation fault.
> My compiler is gcc 3.3 (distro is SuSE 9.0).
>
> The seg fault occurs after main() so I cannot set a breakpoint. It
> seems what's happening is that the DSO has registered destructor calls
> with atexit() and when main() invokes the destructors (via atexit or
> _cxa_atexit()) it crashes because the DSO has previously been
> unloaded.
>
> From what I can gather, if I avoid all function-scoped static objects
> (and static objects declared in anonymous namespaces) the crash won't
> occur. I tried that. I removed all global static objects and
> function-scoped static objects and the seg fault still occurs. At this
> point I don't know where to look to debug this further.
>
> I don't want to rely on building with --fno-use-cxa-atexit. I'd like
> to fix my code and not just cover up the problem with a compiler
> switch.
>
> Has anyone come up with a way to solve this? How can I track done
> which destructor is still being registered for invoking at exit from
> main()? I'm hoping to find a global or static object that I missed
> somewhere (this is a large code base and I may have missed something).
>
> Thanks for any help with this!
>
> Michael
-- Alexander Popov ProSyst Bulgaria Inc. Tech Leader 48 Vladajska Str. RTOS and JVM Dept. Sofia 1606, Bulgaria Phone: +359 2 952 3581/204 http://www.prosyst.com Mobile: +359 887 663 193 OSGi Technology Leaders ----------------------------------------------------------
- Previous message: aires: "Re: problems with real-time POSIX signals"
- Maybe in reply to: Roger Leigh: "Re: dlclose() causing segmentation fault on exit from main()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|