Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Profiling still broken?
@ 1997-09-29 17:51 Toon Moene
  0 siblings, 0 replies; 8+ messages in thread
From: Toon Moene @ 1997-09-29 17:51 UTC (permalink / raw)


Harvey,

>  Is profiling working now?  I saw various discussions in
>  the axp-list archive about broken profiling, but they
>  seemed to be fairly old and have been resolved.  None
>  the less, I'm still having trouble using profiling.
>
>  Basically, if I compile with -pg then the program
>  segfaults in __i333_set_fp_control.  If I compile with
>  -p then the program runs but gprof can't process the
>  profiling file, and I don't seem to have a prof program.

>  This is with gcc-2.7.2.1-2b, which is rpm 2.7.2.1-2 +
>  Richard Henderson's recently distributed patch,
>  glibc-0.961212-5, and kernel-source-2.0.30-3.  I.e. - a
>  fairly straight forward RedHat 4.2 + the recent gcc patch.

Well, I don't know for sure, because I don't know what's in "the  
recent gcc patch", but there is (still) a problem in gcc with  
respect to profiling.  The symptom is that C code with nested  
functions (of which glibc seems to use a lot) has a fairly good  
chance of dying with a segmentation violation.

For instance, g77-0.5.21 has a change in the code of  
profile_function in final.c that fixes this in gcc-2.7.2.3, so  
apparently all publicly available gcc's have this bug.

The problem is that the static chain pointer has to be saved around  
the calls of mcount that profiling inserts.

HTH,
Toon.

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <34335786.41C67EA6@iis.fhg.de>]
* Re: Profiling still broken?
@ 1997-10-02  8:12 Stefan Schroepfer
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Schroepfer @ 1997-10-02  8:12 UTC (permalink / raw)


Richard Henderson wrote:
> 
> Yep.  David Mosberger posted a patch for that function about 6
> months ago.  I have no idea how easy it will be to find in the
> archives.
> 
> Memory is failing me, but I seem to recall he also had binaries
> for that one object file you could replace in libc_p.a.  If it
> is anywhere it would be on ftp.azstarnet.com:~axplinux/.
> 

David Modberger-Tang's patches relative to RedHat 4.1 were

http://www.redhat.com/support/mailing-lists/archives/axp-list/1997-March/0463.html

fix for gprof,

http://www.redhat.com/support/mailing-lists/archives/axp-list/1997-March/0464.html

fix for three object files in libc_p.a.

But I don't know if these are applicable to RH 4.2.

Stefan Schroepfer
scr@iis.fhg.de

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <199710011105.NAA09773@blinky.bfr.co.il>]
[parent not found: <9709291751.AA16877@moene.indiv.nluug.nl>]
* Re: Profiling still broken?
@ 1997-09-30 17:35 Toon Moene
  0 siblings, 0 replies; 8+ messages in thread
From: Toon Moene @ 1997-09-30 17:35 UTC (permalink / raw)


>  So in any case, what's one to do regarding profiling?
>  Is there a patch for gcc 2.7.2.1 to fix it?  Or should
>  I grab some code from g77-0.5.21?  Or should I get
>  2.7.2.3?  Or what?

This is the patch that went into g77-0.5.21 for gcc-2.7.2.3:

- - - - - - - - 8< - - - - - - - - - - - 8< - - - - - - - - - - - -
diff -rcp2N gcc-2.7.2.3/final.c gcc-2.7.2.3.f.1/final.c
*** gcc-2.7.2.3/final.c Sun Nov 26 18:50:00 1995
--- gcc-2.7.2.3.f.1/final.c     Fri Jul 11 00:11:16 1997
*************** profile_function (file)
*** 983,991 ****
    text_section ();

! #ifdef STRUCT_VALUE_INCOMING_REGNUM
    if (sval)
      ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_INCOMING_REGNUM);
  #else
! #ifdef STRUCT_VALUE_REGNUM
    if (sval)
      ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_REGNUM);
--- 983,991 ----
    text_section ();

! #if defined(STRUCT_VALUE_INCOMING_REGNUM) &&  
defined(ASM_OUTPUT_REG_PUSH)
    if (sval)
      ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_INCOMING_REGNUM);
  #else
! #if defined(STRUCT_VALUE_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
    if (sval)
      ASM_OUTPUT_REG_PUSH (file, STRUCT_VALUE_REGNUM);
*************** profile_function (file)
*** 993,1027 ****
  #endif

! #if 0
! #ifdef STATIC_CHAIN_INCOMING_REGNUM
    if (cxt)
      ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_INCOMING_REGNUM);
  #else
! #ifdef STATIC_CHAIN_REGNUM

  #else
! #ifdef STATIC_CHAIN_REGNUM
    if (cxt)
      ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_REGNUM);
  #endif
  #endif
- #endif                                /* 0 */

    FUNCTION_PROFILER (file, profile_label_no);

! #if 0
! #ifdef STATIC_CHAIN_INCOMING_REGNUM
    if (cxt)
      ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_INCOMING_REGNUM);
  #else
! #ifdef STATIC_CHAIN_REGNUM
    if (cxt)
      ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_REGNUM);
  #endif
  #endif
- #endif                                /* 0 */

! #ifdef STRUCT_VALUE_INCOMING_REGNUM
    if (sval)
      ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_INCOMING_REGNUM);
  #else
! #ifdef STRUCT_VALUE_REGNUM
    if (sval)
      ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_REGNUM);
--- 993,1023 ----
  #endif

! #if defined(STATIC_CHAIN_INCOMING_REGNUM) &&  
defined(ASM_OUTPUT_REG_PUSH)
    if (cxt)
      ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_INCOMING_REGNUM);
  #else
! #if defined(STATIC_CHAIN_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
    if (cxt)
      ASM_OUTPUT_REG_PUSH (file, STATIC_CHAIN_REGNUM);
  #endif
  #endif

    FUNCTION_PROFILER (file, profile_label_no);

! #if defined(STATIC_CHAIN_INCOMING_REGNUM) &&  
defined(ASM_OUTPUT_REG_PUSH)
    if (cxt)
      ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_INCOMING_REGNUM);
  #else
! #if defined(STATIC_CHAIN_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
    if (cxt)
      ASM_OUTPUT_REG_POP (file, STATIC_CHAIN_REGNUM);
  #endif
  #endif

! #if defined(STRUCT_VALUE_INCOMING_REGNUM) &&  
defined(ASM_OUTPUT_REG_PUSH)
    if (sval)
      ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_INCOMING_REGNUM);
  #else
! #if defined(STRUCT_VALUE_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
    if (sval)

! #if defined(STRUCT_VALUE_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
    if (sval)
      ASM_OUTPUT_REG_POP (file, STRUCT_VALUE_REGNUM);
- - - - - - - - 8< - - - - - - - - - - - 8< - - - - - - - - - - - -

This also seems to be what still is in egcs-970922, so it looks  
like this is safe.  However, use at your own risk, void where  
prohibited, etc.

HTH,
Toon.

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Profiling still broken?
@ 1997-09-29 13:37 Harvey J. Stein
  0 siblings, 0 replies; 8+ messages in thread
From: Harvey J. Stein @ 1997-09-29 13:37 UTC (permalink / raw)


Is profiling working now?  I saw various discussions in the axp-list
archive about broken profiling, but they seemed to be fairly old and
have been resolved.  None the less, I'm still having trouble using
profiling.

Basically, if I compile with -pg then the program segfaults in
__i333_set_fp_control.  If I compile with -p then the program runs but
gprof can't process the profiling file, and I don't seem to have a
prof program.

This is with gcc-2.7.2.1-2b, which is rpm 2.7.2.1-2 + Richard
Henderson's recently distributed patch, glibc-0.961212-5, and
kernel-source-2.0.30-3.  I.e. - a fairly straight forward RedHat 4.2 +
the recent gcc patch.

Here's an example:
   hjstein@randy:~/pascal/Tests/cmo$ cat foo.c
   #include <stdio.h>

   main ()
   {
       int i;
       double x = 0;
       for (i=1; i<100; i++) {
	   x+= i*i/2;
       }
       printf("x = %f\n", x);
   }
   hjstein@randy:~/pascal/Tests/cmo$ gcc -p -g -o foo foo.c
   hjstein@randy:~/pascal/Tests/cmo$ ls -l gmon.out
   ls: gmon.out: No such file or directory
   hjstein@randy:~/pascal/Tests/cmo$ ./foo
   x = 164150.000000
   hjstein@randy:~/pascal/Tests/cmo$ ls -l gmon.out
   -rw-r--r--   1 hjstein  users         378 Sep 29 09:27 gmon.out
   hjstein@randy:~/pascal/Tests/cmo$ gprof foo gmon.out
   gprof: gmon.out: unexpected end of file
   hjstein@randy:~/pascal/Tests/cmo$ prof foo gmon.out
   bash: prof: command not found
   hjstein@randy:~/pascal/Tests/cmo$ rm gmon.out 
   hjstein@randy:~/pascal/Tests/cmo$ gcc -pg -g -o foo foo.c
   hjstein@randy:~/pascal/Tests/cmo$ ./foo
   Segmentation fault (core dumped)
   hjstein@randy:~/pascal/Tests/cmo$ gdb foo
   GDB is free software and you are welcome to distribute copies of it
    under certain conditions; type "show copying" to see the conditions.
   There is absolutely no warranty for GDB; type "show warranty" for details.
   GDB 4.16 (alpha-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
   (gdb) run
   Starting program: /home/hjstein/pascal/Tests/cmo/foo 

   Program received signal SIGSEGV, Segmentation fault.
   __ieee_set_fp_control () at ../sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S:29
   ../sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S:29: No such file or directory.
   Current language:  auto; currently asm
   (gdb) quit
   The program is running.  Quit anyway (and kill it)? (y or n) y

Thanks,

-- 
Harvey J. Stein
Berger Financial Research
hjstein@bfr.co.il

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

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

end of thread, other threads:[~1997-10-02 16:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-09-29 17:51 Profiling still broken? Toon Moene
     [not found] <34335786.41C67EA6@iis.fhg.de>
1997-10-02 16:05 ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
1997-10-02  8:12 Stefan Schroepfer
     [not found] <199710011105.NAA09773@blinky.bfr.co.il>
1997-10-02  6:09 ` Richard Henderson
     [not found] <9709291751.AA16877@moene.indiv.nluug.nl>
1997-09-30 13:50 ` Harvey J. Stein
1997-10-01 11:05 ` Harvey J. Stein
1997-09-30 17:35 Toon Moene
1997-09-29 13:37 Harvey J. Stein

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