lib/metasm/metasm/disassemble_api.rb
# find the addresses of calls calling the address, handles thunks
find the addresses of calls calling the address, handles thunks
find the addresses of calls calling the address handles thunks
def call_sites(funcaddr)
		find_call_site = proc { |a|
			until not di = di_at(a)
				if di.opcode.props[:saveip]
					cs = di.address
					break
				end
				if di.block.from_subfuncret.to_a.first
					while di.block.from_subfuncret.to_a.length == 1
						a = di.block.from_subfuncret[0]
						break if not di_at(a)
						a = @decoded[a].block.list.first.address
						di = @decoded[a]
					end
				end
				break if di.block.from_subfuncret.to_a.first
				break if di.block.from_normal.to_a.length != 1
				a = di.block.from_normal.first
			end
			cs
		}
		ret = []
		each_xref(normalize(funcaddr), :x) { |a|
			ret << find_call_site[a.origin]
		}
		ret.compact.uniq
	end
def call_sites ( funcaddr ) find_call_site = proc { | a | until not di = di_at ( a ) if di . opcode . props [ :saveip ] cs = di . address break end if di . block . from_subfuncret . to_a . first while di . block . from_subfuncret . to_a . length == 1 a = di . block . from_subfuncret [ 0 ] break if not di_at ( a ) a = @decoded [ a ] . block . list . first . address di = @decoded [ a ] end end break if di . block . from_subfuncret . to_a . first break if di . block . from_normal . to_a . length != 1 a = di . block . from_normal . first end cs } ret = [ ] each_xref ( normalize ( funcaddr ) , :x ) { | a | ret << find_call_site [ a . origin ] } ret . compact . uniq end
find the addresses of calls calling the address, handles thunks
find the addresses of calls calling the address handles thunks
funcaddr