Hi Jim,
Sounds a bit odd - have you tried doing something in this no-op
function. e.g.
void noop() {
int a;
a = 1;
a++;
return
}
And see if that makes a difference? Perhaps the problem is elsewhere
but shows up here. Also GCC 3.2.2 is very old now - you're basically
four or five major releases behind - 3.3, 3.4, 4.0 and 4.1 I'd give
3.4.x or 4.1.x a go.
Cheers,
David.
jim marshall wrote:
Hello,
I am having a problem when using the -pg compile switch with my
application, and was hoping someone might be able to assist somehow. I
have a fairly large application which compiles and runs fine, I wanted
to do some profiling on it so I added the "-pg" compile switch to my
release build. Now when I start the application it gets a
"segmentation fault" when it is starting. Looking in the debugger it
is failing in a function which is basically a no-op in our release
build - all it does is "return;".
The program consists of a fairly generic executable, this executable
calls into a shared object (implicitly) which starts the real
processing. This shared object implicitly and dynamically links to
other shared objects. However; it seems to crash before it gets to any
other shared objects. The main executable calls the stub function in
the primary shared object and the process seg faults.
Here is some information about my environment
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
Red Hat 9.0 (no patches)
Linux wbempc 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386
GNU/Linux
compile options for main executable
cc -D_LINUX -Wall -D__USE_ISOC99 -D__USE_POSIX -D_COMPILE_UNIX -z defs
-pg -O2 -D_UNICODE -DUNICODE -lourlib
compile options for shared object (ourlib):
cc -Wall -D_LINUX -fpic -pg -O2 -shared -D_COMPILE_UNIX -D__USE_ISOC99
-D__USE_POSIX -D_UNICODE -DUNICODE -D_REENTRANT -z defs
Thanks in advance
Jim Marshall