Hi, The address range was not inverted after all; it was a bad parsing of _etext. kerneltop awaits only 'A' symbols for _etext, while it is 'T' on my 64 bit system. The attached patch fixes that.
Best regards, V.
>From 8c45f306c6e95da3f6834473fd99b3bbc19be83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.ste...@laposte.net> Date: Wed, 5 Sep 2012 22:30:34 +0200 Subject: [PATCH] Fix _etext on 64 bit system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _etext symbol can be not only 'A' but also 'T' on 64 bit systems. For example, on my 64 bit PC, the System.map line for _etext is: ffffffff81368186 T _etext Signed-off-by: Vincent Stehlé <vincent.ste...@laposte.net> --- kerneltop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kerneltop.c b/kerneltop.c index a05928f..17cad2f 100644 --- a/kerneltop.c +++ b/kerneltop.c @@ -166,7 +166,7 @@ static inline long round_up (long n, long size) { * ? Symbol type is unknown or object file format specific * * What kerneltop wants/needs is all of the 'T' and 't' symbols that - * are between "<address> T _stext" and "<address> A _etext". + * are between "<address> T _stext" and "<address> A(or T) _etext". */ static void @@ -572,7 +572,7 @@ static void mapfile_read (const char *mapFile, int opt_mapfile) char mode [8]; int fn_len; char begin_text[] = "_stext"; // want all T/t between begin/end text - char end_text[] = "_etext"; // this one is Absolute. + char end_text[] = "_etext"; // this one is absolute or T. if (!(mapf = myopen (mapFile, "r", &popenMap))) { // if !opt_mapfile, try default + uname_release; @@ -622,7 +622,7 @@ file_ok: exit (1); } - if (*mode == 'A' && + if ((*mode == 'A' || *mode == 'T') && !strcmp (fn_name, end_text)) { adrz = fn_adr; text_lines++; @@ -668,7 +668,7 @@ file_ok: prgname, mapFile, maplineno); exit (1); } - if (*mode == 'A' && + if ((*mode == 'A' || *mode == 'T') && !strcmp (fn_name, end_text)) break; if (*mode != 'T' && *mode != 't') -- 1.7.10.4