node/lib/metasm/metasm/gui/dasm_main.rb
# append one line to the session file
# converts addresses to hex, deletes consecutive set_focus lines
append one line to the session file
converts addresses to hex, deletes consecutive set_focus lines
append one line to the session file converts addresses to hex deletes consecutive set_focus lines
def session_append(str)
		return if not session_file
		str = str.sub(/(\(|\[|= )(\d\d\d\d\d\d+)/) { $1 + ('0x%x' % $2.to_i) }
		@session_lastsz_setfocus ||= nil	
		if str =~ /^@session_focus_addr = / and @session_lastsz_setfocus
			File.truncate(session_file, @session_lastsz_setfocus) if File.size(session_file) == @session_lastsz
			is_setfocus = true
		end
		File.open(session_file, 'a') { |fd| fd.puts str }
		@session_lastsz = File.size(session_file)
		@session_lastsz_setfocus = @session_lastsz if not is_setfocus
	rescue
		@session_file = nil
		puts "Failed to save session, disabling (#{$!.class} #{$!})"
	end
def session_append ( str ) return if not session_file str = str . sub ( / ( \( | \[ |= )( \d \d \d \d \d \d +) / ) { $1 + ( '0x%x' % $2 . to_i ) } @session_lastsz_setfocus ||= nil if str =~ / ^@session_focus_addr =  / and @session_lastsz_setfocus File . truncate ( session_file , @session_lastsz_setfocus ) if File . size ( session_file ) == @session_lastsz is_setfocus = true end File . open ( session_file , 'a' ) { | fd | fd . puts str } @session_lastsz = File . size ( session_file ) @session_lastsz_setfocus = @session_lastsz if not is_setfocus rescue @session_file = nil puts "Failed to save session, disabling (#{$!.class} #{$!})" end
append one line to the session file
converts addresses to hex, deletes consecutive set_focus lines
append one line to the session file converts addresses to hex deletes consecutive set_focus lines
# convert decimal addrs to hex # prevent warning # overwrite previous set_focus
str