version 1.6, 2002/04/20 03:37:40 |
version 1.7, 2002/05/08 16:46:35 |
|
|
|
|
#include "gprof.h" |
#include "gprof.h" |
|
|
#define iscall(pc) ((*pc) == 0xE8) |
#define iscall(off) ((*(u_char *)&textspace[off]) == 0xE8) |
|
|
void |
void |
findcall( parentp , p_lowpc , p_highpc ) |
findcall( parentp , p_lowpc , p_highpc ) |
|
|
unsigned long p_lowpc; |
unsigned long p_lowpc; |
unsigned long p_highpc; |
unsigned long p_highpc; |
{ |
{ |
unsigned char *pc; |
unsigned long pc; |
long len; |
long len; |
nltype *childp; |
nltype *childp; |
unsigned long destpc; |
unsigned long destpc; |
|
int off; |
|
|
if (textspace == 0) |
if (textspace == 0) |
return; |
return; |
|
|
parentp -> name , p_lowpc , p_highpc ); |
parentp -> name , p_lowpc , p_highpc ); |
} |
} |
# endif /* DEBUG */ |
# endif /* DEBUG */ |
for (pc = textspace + p_lowpc - N_TXTADDR(xbuf) ; pc < textspace + p_highpc - N_TXTADDR(xbuf) ; pc += len) { |
for (pc = p_lowpc; pc < p_highpc; pc += len) { |
|
off = pc - s_lowpc; |
len = 1; |
len = 1; |
if (iscall(pc)) { |
if (iscall(off)) { |
destpc = *(unsigned long *)(pc + 1) + (pc - textspace + N_TXTADDR(xbuf)) + 5; |
destpc = *(u_long *)&textspace[off + 1] + off + 5; |
# ifdef DEBUG |
# ifdef DEBUG |
if ( debug & CALLDEBUG ) { |
if ( debug & CALLDEBUG ) { |
printf( "[findcall]\t0x%x:calls" , pc - textspace ); |
printf( "[findcall]\t0x%x:calls" , pc - textspace ); |