2010-09-09 18:19:35 +00:00
|
|
|
# This file is part of Metasm, the Ruby assembly manipulation suite
|
|
|
|
# Copyright (C) 2006-2009 Yoann GUILLOT
|
|
|
|
#
|
|
|
|
# Licence is LGPL, see LICENCE in the top-level directory
|
|
|
|
|
|
|
|
|
|
|
|
# metasm dasm GUI plugin: hilight lines of code based on the opcode name
|
|
|
|
if gui
|
2011-04-06 17:40:01 +00:00
|
|
|
@gui_opcode_color = { 'call' => '8f8', 'jmp' => 'faa', 'jcc' => 'fc8' }
|
2010-09-09 18:19:35 +00:00
|
|
|
|
|
|
|
obg = gui.bg_color_callback # chain old callback
|
|
|
|
gui.bg_color_callback = lambda { |a|
|
2011-04-06 17:40:01 +00:00
|
|
|
if di = di_at(a) and pr = di.opcode.props
|
|
|
|
if pr[:saveip] and (@function[di.block.to_normal.to_a.first] or di.block.to_subfuncret.to_a.first)
|
|
|
|
# don't color call+pop
|
|
|
|
@gui_opcode_color['call']
|
|
|
|
elsif pr[:stopexec]
|
|
|
|
@gui_opcode_color['jmp']
|
|
|
|
elsif pr[:setip]
|
|
|
|
@gui_opcode_color['jcc']
|
|
|
|
else
|
|
|
|
obg[a] if obg
|
|
|
|
end
|
2010-09-09 18:19:35 +00:00
|
|
|
else
|
|
|
|
obg[a] if obg
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|