🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41843

Using MARK() with gprof.

#41843
From: "Peter Leaback"
Date: Tue, 06 Feb 1996 00:00
32 lines
1545 bytes

I'm having difficulty in profiling within functions using gprof and MARK() on 
sparkstations. The macro in prof.h is as follows.
 
#define MARK(L) {\
                asm("   .reserve        .L., 4, \"data\", 4");\
                asm("M.L:");\
                asm("   sethi   %hi(.L.), %o0");\
                asm("   call    mcount");\
                asm("   or      %o0, %lo(.L.), %o0");\
                }
 
I can't see how this would work with gcc because the macro substitution will not
occur within "". I changed the macro as follows.
 
 
#define MARK(L) {\
                asm("   .reserve        ."#L"., 4, \"data\", 4");\
                asm("M."#L":");\
                asm("   sethi   %hi(."#L".), %o0");\
                asm("   call    mcount");\
                asm("   or      %o0, %lo(."#L".), %o0");\
                }
 
This modified macro does work for very simple programs, but causes Segmentation 
Faults in non-trivial programs.
 
Is there a MARK macro that does work with gcc and gprof ?
 
Regards,
        Pete Leaback.
Technical Details
Message-ID: <DMCrrv.9xy@cix.compulink.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4etf9j$c75$1@mhafc.production.compuserve.com> <4f5pli$p70@agate.berkeley.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,c8c72a5da0bb27a7
X-Google-Attributes: gid11318c,public
From: pete_leaback@cix.compulink.co.uk ("Peter Leaback")
Subject: Using MARK() with gprof.
Date: 1996/02/06
Message-ID: <DMCrrv.9xy@cix.compulink.co.uk>
X-Deja-AN: 138158099
references: <4etf9j$c75$1@mhafc.production.compuserve.com> <4f5pli$p70@agate.berkeley.edu>
organization: Compulink Information eXchange
newsgroups: gnu.gcc.help