Skip to content

Commit

Permalink
add dasm-plugins/gui_hide_nops
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyg committed Nov 13, 2020
1 parent 58140ab commit 74dcf5e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions metasm/gui/dasm_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1316,8 +1316,14 @@ def build_ctx(ctx)
}
}

build_ctx_boxes(ctx)
end

def build_ctx_boxes(ctx)
# calc box dimensions/text
ctx.box.each { |b|
b[:line_address].clear
b[:line_text_col].clear
colstr = []
curaddr = nil
line = 0
Expand Down
19 changes: 19 additions & 0 deletions samples/dasm-plugins/gui_hide_nops.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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: hide 'nop' instructions from the graph view
if gui
gui.keyboard_callback[?H] = lambda { |*_|
next if not gui.curview.respond_to?(:curcontext)
addr = gui.curaddr
gui.curview.curcontext.box.each { |b|
b[:addresses].delete_if { |a| di_at(a) and di_at(a).opcode.name == 'nop' }
}
gui.curview.build_ctx_boxes(gui.curview.curcontext)
gui.curview.curcontext.auto_arrange_boxes
gui.focus_addr(addr)
}
end

0 comments on commit 74dcf5e

Please sign in to comment.