public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with '-pg' switch..
@ 2006-04-18 15:23 jim marshall
  2006-04-19 19:31 ` dch
  0 siblings, 1 reply; 2+ messages in thread
From: jim marshall @ 2006-04-18 15:23 UTC (permalink / raw)
  To: gcc-help

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



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

* Re: problem with '-pg' switch..
  2006-04-18 15:23 problem with '-pg' switch jim marshall
@ 2006-04-19 19:31 ` dch
  0 siblings, 0 replies; 2+ messages in thread
From: dch @ 2006-04-19 19:31 UTC (permalink / raw)
  To: jim marshall; +Cc: gcc-help

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
>
>
>
>
>
>

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

end of thread, other threads:[~2006-04-19 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-18 15:23 problem with '-pg' switch jim marshall
2006-04-19 19:31 ` dch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).