Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Release 1.0
[palacios.git] / misc / test_vm / scripts / eipToFunction
1 #! /usr/bin/perl
2
3 # Find the function name from the value of the EIP (instruction pointer)
4 # register from a Bochs crash report.  Uses the kernel symbol
5 # map (kernel.syms) produced by compiling the kernel.
6
7 use strict qw(refs vars);
8 use FileHandle;
9
10 if (scalar(@ARGV) != 2){
11         print STDERR "Usage: eipToFunction kernel.syms <eip value>\n";
12         print STDERR "   eip value should be in hex\n";
13         exit 1;
14 }
15
16 my $syms = shift @ARGV;
17 my $eip = hex(shift @ARGV);
18
19 my @text = ();
20
21 my $fh = new FileHandle("<$syms");
22 (defined $fh) || die "Couldn't open $syms: $!\n";
23 while (<$fh>) {
24         #print $_;
25         if (/^([0-9A-Fa-f]+)\s+[Tt]\s+(\S+)\s*$/) {
26                 push @text, [hex($1), $2];
27         }
28 }
29 $fh->close();
30 #print scalar(@text),"\n";
31
32 @text = sort { $a->[0] <=> $b->[0] } @text;
33
34 my $last = undef;
35
36 foreach my $entry (@text) {
37         last if ($eip < $entry->[0]);
38         $last = $entry;
39 }
40 printf("%s\n",(defined $last) ? $last->[1] : "not found");
41
42 # vim:ts=4