Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jun 2000 11:28:26 +0200
From:      Dirk Zoller <duz@onlinehome.de>
To:        questions@FreeBSD.org
Subject:   I'm unable to profile multithreaded C++ Code.
Message-ID:  <3945FEBA.28CBF4AD@onlinehome.de>

next in thread | raw e-mail | index | archive | help

Hello together,

unfortunately, my *multithreaded* C++ programs crash with a bus error
when I'm trying to *profile*. The error happens in in the first global
constructor being called.


I'm using FreeBSD-4.0-STABLE for Intel, freshly cvsup'd and world made.
I'm compiling using the gcc-2.95.2 which comes with that finest of all
operating systems. I compile and link using

	c++ -pthread -g -pg ... (lots of -I and -D I spare you)

where -v reports a linker line which includes:

	/usr/libexec/elf/ld -m elf_i386 -dynamic-linker
		/usr/libexec/ld-elf.so.1 -o irrelevant
		/usr/lib/gcrt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
		(some irrelevant -L I spare you)
		-L/usr/local/lib -L/usr/X11R6/lib
		-L/usr/libexec/elf -L/usr/libexec -L/usr/lib
		(some irrelevant *.o and -l)
		-lcipher -lstdc++ -lm /usr/lib/libgcc_r.a -lc_r_p
		/usr/lib/libgcc_r.a /usr/lib/crtend.o /usr/lib/crtn.o


The rest are assumptions/observations.

I studied the stuff inside /usr/lib/gcrt1.o from _start and how profiling
is initialized using monstartup() prior to running the global constructors
in _init.

What I read in all those little files in /usr/src/lib/csu/i386-elf
makes a lot of sense to me. I find it very likely that monstartup is
actually called.

Then I tried to set a breakpoint in monstartup. Apparently this is
never hit. Instead I get the bus error with a traceback which seems to
point into my global constructors. Alas, I doubt this backtrace, because
do_ctors() is missing from the function call hierarchy.

I find it more likely that I'm in fact inside monstartup. And that
monstartup crashes for whatever reason.


Did anybody succeed in profiling multithreaded C++ stuff??

I'm appreciating any hint.

Dirk
-- 
Dirk Zoller				Fon: 06106-876566
Obere Marktstraße 5			e-mail: duz@sol-3.de
63110 Rodgau


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3945FEBA.28CBF4AD>