From 5a3009cad69b3eacc46f8bd729fd473500c98c85 Mon Sep 17 00:00:00 2001 From: Matthias Koenig Date: Wed, 18 Jul 2007 16:15:44 +0200 Subject: [PATCH] readprofile: fix on ppc64 Fix inconsistency between kernel profiling and readprofile. The range of kernel profiling is between _stext and _etext, and readprofile tries to extract profiling for all the symbols in /boot/System.map-2.6.16.11-7-ppc64 from /proc/profile, but there are more symbols in /boot/System.map-2.6.16.11-7-ppc64 than those between _stext and _etext. Signed-off-by: Matthias Koenig Signed-off-by: Karel Zak --- sys-utils/readprofile.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index 978e6c1d..950e9051 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -325,6 +325,7 @@ main(int argc, char **argv) { */ while (fgets(mapline,S_LEN,map)) { unsigned int this=0; + int done = 0; if (sscanf(mapline,"%llx %s %s",&next_add,mode,next_name)!=3) { fprintf(stderr,_("%s: %s(%i): wrong map line\n"), @@ -333,12 +334,19 @@ main(int argc, char **argv) { } header_printed = 0; - /* ignore any LEADING (before a '[tT]' symbol is found) - Absolute symbols */ - if ((*mode == 'A' || *mode == '?') && total == 0) continue; - if (*mode != 'T' && *mode != 't' && - *mode != 'W' && *mode != 'w') - break; /* only text is profiled */ + /* the kernel only profiles up to _etext */ + if (!strcmp(next_name, "_etext") || + !strcmp(next_name, "__etext")) + done = 1; + else { + /* ignore any LEADING (before a '[tT]' symbol is found) + Absolute symbols */ + if ((*mode == 'A' || *mode == '?') && total == 0) + continue; + if (*mode != 'T' && *mode != 't' && + *mode != 'W' && *mode != 'w') + break; /* only text is profiled */ + } if (indx >= len / sizeof(*buf)) { fprintf(stderr, _("%s: profile address out of range. " @@ -388,6 +396,8 @@ main(int argc, char **argv) { strcpy(fn_name,next_name); maplineno++; + if (done) + break; } /* clock ticks, out of kernel text - probably modules */ -- 2.39.5