linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: Murray Jensen <Murray.Jensen@cmst.csiro.au>
Cc: Mike Coy <coym@embeddedplanet.com>,
	Lucinda Schafer <lucsch@adaptivemicro.com>,
	linuxppc-embedded@lists.linuxppc.org
Subject: Re: PCMCIA ATA flash support?
Date: Wed, 21 Jun 2000 09:07:43 +0200	[thread overview]
Message-ID: <200006210707.JAA01454@denx.local.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]

In message <5824.961553366@msa.cmst.csiro.au> Murray Jensen wrote:
>
> They won't be - the backtrace prints the return (or link in ppc speak)
> address i.e. the next instruction to be executed after a return from the
> current function (or stack frame). Just sort your System.map file on the

The System.map file  _is_ already sorted.

> first column (hex address) and then look for the largest value in the
> first column that is still less than the next address in the backtrace.
> This gives you some idea of which function that address is within, and
> how far in that function it is. A bit tedious but ok for a start.

No need to do this by hand. See the attached script - just  give  the
path  of  the  System.map  file  to  use  as  argument,  and feed the
backtrace to stdin.

> What would be better is to get kgdb working, then gdb will work all this

I agree.

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Knowledge, sir, should be free to all!
	-- Harry Mudd, "I, Mudd", stardate 4513.3


[-- Attachment #2: backtrace --]
[-- Type: text/plain , Size: 956 bytes --]

#!/usr/bin/perl -w

my $mapfile = shift || '/LinuxPPC/usr/src/linux/System.map';

print STDERR "Reading symbols from $mapfile\n";

#
# Read symbol table
#
open (MAP, $mapfile) or die "Can't open $mapfile: $!\n";

my $cnt = 0;

while (<MAP>) {
	chomp;
	my ($a,$t,$n) = split;
	$a = eval ('0x' . $a);
	if ($t =~ /^t$/i) {
		$addr[$cnt] = $a;
		$name[$cnt] = $n;
		++$cnt;
	}
}
close MAP;

my ($i, $n, $last);

#for ($i=0; $i<$cnt; ++$i) {
#	printf "0x%08x  %s\n", $addr[$i], $name[$i];
#}

#
# Now get backtrace info from stdin
#

while (<>) {
	chomp;
	my @a = split;
	my $aa;

	for ($i=0; $i<=$#a; ++$i) {
		$aa = eval ('0x' . $a[$i]);

		$last = -1;
		for ($n=0; $n<$cnt; ++$n) {
			if ($addr[$n] > $aa) {
				last;
			}
			$last = $n;
		}

		if ($last >= 0) {
			my $offset = $aa - $addr[$last];

			printf "0x%08x -- 0x%08x + 0x%04x   %s\n",
				$aa, $addr[$last], $offset, $name[$last];
		} else {
			printf "0x%08x -- unknown address\n", $aa;
		}
	}
}

             reply	other threads:[~2000-06-21  7:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-21  7:07 Wolfgang Denk [this message]
     [not found] <A109131318C4D1119AC20060088DECE330F446@amwmail.adaptivemic ro.com>
2000-06-21  0:43 ` PCMCIA ATA flash support? Mike Coy
2000-06-21  2:09   ` Murray Jensen
  -- strict thread matches above, loose matches on Subject: below --
2000-06-20 15:44 Lucinda Schafer
2000-06-20 14:08 Lucinda Schafer
2000-06-20 13:29 Michael Coy

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=200006210707.JAA01454@denx.local.net \
    --to=wd@denx.de \
    --cc=Murray.Jensen@cmst.csiro.au \
    --cc=coym@embeddedplanet.com \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    --cc=lucsch@adaptivemicro.com \
    /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;
as well as URLs for NNTP newsgroup(s).