FreeBSD/usr.sbin/pmcannotate/pmcannotate.c
/*
 * Printout the body of an "objdump -d" assembly function.
 * It does simply stops when a new function is encountered,
 * bringing back the file position in order to not mess up
 * subsequent analysis.
 * C lines and others not recognized are simply skipped.
 */
Printout the body of an "objdump -d" assembly function.
It does simply stops when a new function is encountered,
bringing back the file position in order to not mess up
subsequent analysis.
C lines and others not recognized are simply skipped.
Printout the body of an " objdump - d " assembly function . It does simply stops when a new function is encountered bringing back the file position in order to not mess up subsequent analysis . C lines and others not recognized are simply skipped .
static void
general_printasm(FILE *fp, struct aggent *agg)
{
	char buffer[LNBUFF];
	struct entry *obj;
	int nbytes;
	void *ptr;
	while (fgets(buffer, LNBUFF, fp) != NULL) {
		if ((nbytes = newfunction(buffer)) != 0) {
			fseek(fp, nbytes * -1, SEEK_CUR);
			break;
		}
		if (!isasminline(buffer))
			continue;
		if (sscanf(buffer, " %p:", &ptr) != 1)
			continue;
		obj = general_findent((uintptr_t)ptr);
		if (obj == NULL)
			printf("\t| %s", buffer);
		else
			printf("%.2f%%\t| %s",
			    (float)obj->en_nsamples * 100 / agg->ag_nsamples,
			    buffer);
	}
}
static void general_printasm ( FILE * fp , struct aggent * agg ) { char buffer [ LNBUFF ] ; struct entry * obj ; int nbytes ; void * ptr ; while ( fgets ( buffer , LNBUFF , fp ) != NULL ) { if ( ( nbytes = newfunction ( buffer ) ) != 0 ) { fseek ( fp , nbytes * -1 , SEEK_CUR ) ; break ; } if ( ! isasminline ( buffer ) ) continue ; if ( sscanf ( buffer , " " , & ptr ) != 1 ) continue ; obj = general_findent ( ( uintptr_t ) ptr ) ; if ( obj == NULL ) printf ( " \t " , buffer ) ; else printf ( " \t " , ( float ) obj -> en_nsamples * 100 / agg -> ag_nsamples , buffer ) ; } }
Printout the body of an "objdump -d" assembly function.
Printout the body of an " objdump - d " assembly function .