On Fri, Aug 9, 2013 at 11:19 PM, Richard Henderson <r...@twiddle.net> wrote:
> The script massages the output produced for architectures that are
> not supported internally by qemu though an external objdump program
> for disassembly.

I'd add something like the following to get disassembled hunks with correct
addresses:

diff --git a/scripts/disas-objdump.pl b/scripts/disas-objdump.pl
index c66a629..b6824b4 100755
--- a/scripts/disas-objdump.pl
+++ b/scripts/disas-objdump.pl
@@ -38,15 +38,17 @@ $objdump[2] = mkobjcommand($tobjdump, $tmachine);
 # Zero-initialize current dumping state.
 my $mem = "";
 my $inobjd = 0;
+my $vma = "";

-sub objcommand {
+sub objcommand ($) {
+    my ($vma) = @_;
     my $ret = $objdump[$inobjd];
     if (!$ret) {
         die "Host machine type not specified" if $inobjd == 1;
         die "Target machine type not specified" if $inobjd == 2;
         die "Internal error";
     }
-    return $ret;
+    return $ret . " --adjust-vma=" . $vma;
 }

 while (<>) {
@@ -69,7 +71,8 @@ while (<>) {
         syswrite $outh, $mem;

         # Pipe from objdump...
-        open IN, "-|", objcommand();
+        $vma =~ s/:.*//;
+        open IN, "-|", objcommand($vma);

         # ... copying all but the first 7 lines of boilerplate to our stdout.
        my $i = 0;
@@ -82,6 +85,7 @@ while (<>) {
         $mem = "";
         $inobjd = 0;
     } else {
+        $vma = $_;
         print;
     }
 }

-- 
Thanks.
-- Max

Reply via email to