Skip to contentSkip to conversation

PCMCIA ATA flash support?

DISCUSSION Wolfgang Denk 1 participant 1 message Jun 21, 2000

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines · In message <[email protected]> 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.

Quoted 4 lines

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.

Quoted 1 line

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: [email protected] Knowledge, sir, should be free to all!

	-- Harry Mudd, "I, Mudd", stardate 4513.3

#!/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;
		}
	}
}