Sha256: 66e83cffc5c4742d2c0292bc1b8ed474c45842ca9f17658f748f813a33ad7eea

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

#    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 plugin
# walks all disassembled instructions referencing an address
# if this address points a C string, show that in the instruction comments
# esp. useful after a disassemble_fast

def stringsxrefs(maxsz = 32)
	@decoded.each_value { |di|
		next if not di.kind_of?(DecodedInstruction)
		di.instruction.args.grep(Expression).each { |e|
			if str = decode_strz(e) and str.length >= 4 and str =~ /^[\x20-\x7e]*$/
				di.add_comment str[0, maxsz].inspect
				add_xref(normalize(e), Xref.new(:r, di.address, 1))
			end
		}
	}
	nil
end

if gui
	stringsxrefs
	gui.gui_update
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metasm-1.0.5 samples/dasm-plugins/stringsxrefs.rb
metasm-1.0.4 samples/dasm-plugins/stringsxrefs.rb
metasm-1.0.3 samples/dasm-plugins/stringsxrefs.rb
metasm-1.0.2 samples/dasm-plugins/stringsxrefs.rb