node/lib/metasm/metasm/disassemble.rb
# yields each xref to a given address, optionnaly restricted to a type
yields each xref to a given address, optionnaly restricted to a type
yields each xref to a given address optionnaly restricted to a type
def each_xref(addr, type=nil)
		addr = normalize addr
		x = @xrefs[addr]
		x = case x
		    when nil; []
		    when ::Array; x.dup
		    else [x]
		    end
		x.delete_if { |x_| x_.type != type } if type
		if (not type or type == :reloc) and l = get_label_at(addr) and a = @inv_section_reloc[l]
			a.each { |b, e, o, r|
				addr = Expression[b]+o
				x << Xref.new(:reloc, addr) if not x.find { |x_|
					next if not x_.origin or not di_at(x_.origin)
					(addr - x_.origin) < @decoded[x_.origin].bin_length rescue false
				}
			}
		end
		x.each { |x_| yield x_ }
	end
def each_xref ( addr , type = nil ) addr = normalize addr x = @xrefs [ addr ] x = case x when nil ; [ ] when :: Array ; x . dup else [ x ] end x . delete_if { | x_ | x_ . type != type } if type if ( not type or type == :reloc ) and l = get_label_at ( addr ) and a = @inv_section_reloc [ l ] a . each { | b , e , o , r | addr = Expression [ b ] + o x << Xref . new ( :reloc , addr ) if not x . find { | x_ | next if not x_ . origin or not di_at ( x_ . origin ) ( addr - x_ . origin ) < @decoded [ x_ . origin ] . bin_length rescue false } } end x . each { | x_ | yield x_ } end
yields each xref to a given address, optionnaly restricted to a type
yields each xref to a given address optionnaly restricted to a type
# add pseudo-xrefs for exe relocs # ignore relocs embedded in an already-listed instr
addr
type