node/lib/metasm/metasm/disassemble.rb
# returns the label at the specified address, creates it if needed using "prefix_addr"
# renames the existing label if it is in the form rewritepfx_addr
# returns nil if the address is not known and is not a string
returns the label at the specified address, creates it if needed using "prefix_addr"
renames the existing label if it is in the form rewritepfx_addr
returns nil if the address is not known and is not a string
returns the label at the specified address creates it if needed using " prefix_addr " renames the existing label if it is in the form rewritepfx_addr returns nil if the address is not known and is not a string
def auto_label_at(addr, base='xref', *rewritepfx)
		addr = Expression[addr].reduce
		addrstr = "#{base}_#{Expression[addr]}"
		return if addrstr !~ /^\w+$/
		e, b = get_section_at(addr)
		if not e
			l = Expression[addr].reduce_rec if Expression[addr].reduce_rec.kind_of? ::String
			l ||= addrstr if addr.kind_of? Expression and addr.externals.grep(::Symbol).empty?
		elsif not l = e.inv_export[e.ptr]
			l = @program.new_label(addrstr)
			e.add_export l, e.ptr
			@label_alias_cache = nil
			@old_prog_binding[l] = @prog_binding[l] = b + e.ptr
		elsif rewritepfx.find { |p| base != p and addrstr.sub(base, p) == l }
			newl = addrstr
			newl = @program.new_label(newl) unless @old_prog_binding[newl] and @old_prog_binding[newl] == @prog_binding[l]	
			rename_label l, newl
			l = newl
		end
		l
	end
def auto_label_at ( addr , base = 'xref' , * rewritepfx ) addr = Expression [ addr ] . reduce addrstr = "#{base}_#{Expression[addr]}" return if addrstr !~ / ^ \w +$ / e , b = get_section_at ( addr ) if not e l = Expression [ addr ] . reduce_rec if Expression [ addr ] . reduce_rec . kind_of? :: String l ||= addrstr if addr . kind_of? Expression and addr . externals . grep ( :: Symbol ) . empty? elsif not l = e . inv_export [ e . ptr ] l = @program . new_label ( addrstr ) e . add_export l , e . ptr @label_alias_cache = nil @old_prog_binding [ l ] = @prog_binding [ l ] = b + e . ptr elsif rewritepfx . find { | p | base != p and addrstr . sub ( base , p ) == l } newl = addrstr newl = @program . new_label ( newl ) unless @old_prog_binding [ newl ] and @old_prog_binding [ newl ] == @prog_binding [ l ] rename_label l , newl l = newl end l end
returns the label at the specified address, creates it if needed using "prefix_addr"
renames the existing label if it is in the form rewritepfx_addr
returns nil if the address is not known and is not a string
returns the label at the specified address creates it if needed using " prefix_addr " renames the existing label if it is in the form rewritepfx_addr returns nil if the address is not known and is not a string
# avoid _uuid when a -> b -> a
addr
base
rewritepfx