Skip to content

Commit

Permalink
Naive support for ARM and SH
Browse files Browse the repository at this point in the history
  • Loading branch information
shinh committed Jan 5, 2015
1 parent 8948f8e commit 7e29696
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dis.rb
Expand Up @@ -161,6 +161,10 @@ def get_data(addr)

if `file #{file}` =~ /PE32/
cmd = "ruby #{File.dirname(File.realpath(__FILE__))}/dispe.rb #{file}"
elsif `file #{file}` =~ / ARM/
cmd = "arm-linux-gnueabihf-objdump -S #{file}"
elsif `file #{file}` =~ / SH,/
cmd = "/usr/local/stow/binutils-all/bin/all-objdump -S #{file}"
else
cmd = "objdump -S #{file}"
end
Expand All @@ -176,14 +180,14 @@ def get_data(addr)
dump.each_line do |line|
if line =~ /^(\h+) <(.*)>:$/
labels[$1.hex] = $2
elsif line =~ /push\s+%[er]bp/
elsif line =~ /push\s+(%[er]bp|{lr})/
addr = line.hex
if !labels[addr] || labels[addr] =~ /^\[L/
label = "[func#{fid}]"
labels[addr] = label
fid += 1
end
elsif line =~ /^\s*(\h+):\s*.*?\s(callq?|j[a-z]+)\s+(?:0x)?(\h+)/
elsif line =~ /^\s*(\h+):\s*.*?\s(callq?|j[a-z]+|b(?:l|lx|sr|t|f))\s+(?:0x)?(\h+)/
from = $1.hex
to = $3.hex
annots[from] = to
Expand Down

0 comments on commit 7e29696

Please sign in to comment.