mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Owens <kaos@sgi.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Paul Mackerras <paulus@samba.org>, Andrew Morton <akpm@osdl.org>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH] All Symbols in /proc/kallsyms
Date: Mon, 10 May 2004 16:05:32 +1000	[thread overview]
Message-ID: <11752.1084169132@kao2.melbourne.sgi.com> (raw)
In-Reply-To: Your message of "Mon, 10 May 2004 15:28:37 +1000." <1084166916.8127.46.camel@bach>

On Mon, 10 May 2004 15:28:37 +1000, 
Rusty Russell <rusty@rustcorp.com.au> wrote:
>Debuggers (ie. xmon) can use kallsyms, but they want all symbols, not
>just functions.  Fair enough.
>
>Name: Debugging Option to Put text symbols in kallsyms
>Status: Tested on 2.6.6-rc3-bk11
>
>kallsyms contains only function names, but some debuggers (eg. xmon on
>PPC/PPC64) use it to lookup symbols: it'd be much nicer if it included
>data symbols too.

The patch needs some more work.  You are including absolute symbols
that are outside the kernel text and data space, which can be very
misleading.  For debugging, you want all symbols, even if they have the
same address as the previous symbol.

The kdb 2.6.6 patch for scripts/kallsyms follows.  I cannot remember
why I excluded kallsyms_addresses, kallsyms_num_syms and
kallsyms_names, there must have been a good reason at the time.

Index: linux/scripts/kallsyms.c
--- linux.orig/scripts/kallsyms.c	Mon May 10 12:33:21 2004
+++ linux/scripts/kallsyms.c	Mon May 10 14:07:41 2004
@@ -6,6 +6,7 @@
  * of the GNU General Public License, incorporated herein by reference.
  *
  * Usage: nm -n vmlinux | scripts/kallsyms > symbols.S
+ * If CONFIG_KDB is defined, generate all symbols for kdb.
  */
 
 #include <stdio.h>
@@ -21,7 +22,12 @@ struct sym_entry {
 
 static struct sym_entry *table;
 static int size, cnt;
-static unsigned long long _stext, _etext, _sinittext, _einittext;
+static unsigned long long _stext, _etext, _sinittext, _einittext, _end;
+#ifdef CONFIG_KDB
+#define kdb 1
+#else
+#define kdb 0
+#endif
 
 static void
 usage(void)
@@ -51,12 +57,18 @@ read_symbol(FILE *in, struct sym_entry *
 static int
 symbol_valid(struct sym_entry *s)
 {
-	if ((s->addr < _stext || s->addr > _etext)
+	if ((s->addr < _stext || (kdb && s->addr > _end) || (!kdb && s->addr > _etext))
 	    && (s->addr < _sinittext || s->addr > _einittext))
 		return 0;
 
 	if (strstr(s->sym, "_compiled."))
 		return 0;
+	if (kdb) {
+		if (strcmp(s->sym, "kallsyms_addresses") == 0 ||
+		    strcmp(s->sym, "kallsyms_num_syms") == 0 ||
+		    strcmp(s->sym, "kallsyms_names") == 0)
+		return 0;
+	}
 
 	return 1;
 }
@@ -87,6 +99,8 @@ read_map(FILE *in)
 			_sinittext = table[i].addr;
 		if (strcmp(table[i].sym, "_einittext") == 0)
 			_einittext = table[i].addr;
+		if (kdb && strcmp(table[i].sym, "_end") == 0)
+			_end = table[i].addr;
 	}
 }
 
@@ -115,7 +129,7 @@ write_src(void)
 		if (!symbol_valid(&table[i]))
 			continue;
 		
-		if (table[i].addr == last_addr)
+		if (table[i].addr == last_addr && !kdb)
 			continue;
 
 		printf("\tPTR\t%#llx\n", table[i].addr);
@@ -140,7 +154,7 @@ write_src(void)
 		if (!symbol_valid(&table[i]))
 			continue;
 		
-		if (table[i].addr == last_addr)
+		if (table[i].addr == last_addr && !kdb)
 			continue;
 
 		for (k = 0; table[i].sym[k] && table[i].sym[k] == prev[k]; ++k)


  reply	other threads:[~2004-05-10  6:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-10  5:28 Rusty Russell
2004-05-10  6:05 ` Keith Owens [this message]
2004-05-10 23:13 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11752.1084169132@kao2.melbourne.sgi.com \
    --to=kaos@sgi.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®