diff --git a/lib/risc/interpreter.rb b/lib/risc/interpreter.rb index 5c258841..6a0b08ce 100644 --- a/lib/risc/interpreter.rb +++ b/lib/risc/interpreter.rb @@ -48,7 +48,7 @@ module Risc def set_pc( pos ) raise "Not int #{pos}" unless pos.is_a? Numeric position = Position.at(pos) - log.debug "Setting Position #{pos}" + log.debug "Setting Position #{position}" if position.is_a?(Position::CodePosition) return set_pc(position.at + 12) end diff --git a/lib/risc/machine.rb b/lib/risc/machine.rb index 9e43479e..77a4fc9b 100644 --- a/lib/risc/machine.rb +++ b/lib/risc/machine.rb @@ -90,6 +90,7 @@ module Risc before = at Position.set(objekt,at) at += objekt.padded_length + log.debug "PADDED #{objekt.padded_length}" log.debug "Object #{objekt.class}:#{before.to_s(16)} len: #{(at - before).to_s(16)}" end at diff --git a/lib/risc/position.rb b/lib/risc/position.rb index 408b1b01..1c760bdb 100644 --- a/lib/risc/position.rb +++ b/lib/risc/position.rb @@ -15,6 +15,9 @@ module Risc # entails to affected objects. module Position + include Util::Logging + log_level :debug + @positions = {} def self.positions @@ -39,7 +42,7 @@ module Risc if pos == nil str = "position accessed but not set, " str += "0x#{object.object_id.to_s(16)}\n" - str += "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.inspect[0...130]}" + str += "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.to_s[0...130]}" raise str end pos @@ -55,7 +58,7 @@ module Risc def self.set( object , pos , extra = nil) # resetting of position used to be error, but since relink and dynamic instruction size it is ok. # in measures (of 32) - #puts "Setting #{pos} for #{self.class}" + log.debug "Setting #{pos} for #{object.class}-#{object}" if pos < 3000 old = Position.positions[object] if old != nil old.reset_to(pos) @@ -64,6 +67,7 @@ module Risc position = for_at( object , pos , extra) self.positions[object] = position position.init(pos) + log.debug "Set #{pos} for #{position.class}" if pos < 3000 position end diff --git a/lib/risc/position/object_position.rb b/lib/risc/position/object_position.rb index 61613af3..5ce88155 100644 --- a/lib/risc/position/object_position.rb +++ b/lib/risc/position/object_position.rb @@ -5,6 +5,7 @@ module Risc def initialize( at , object) @at = at + @object = object raise "not int #{self}-#{at}" unless @at.is_a?(Integer) end diff --git a/lib/util/logger.rb b/lib/util/logger.rb index 1514a872..9a85bd77 100644 --- a/lib/util/logger.rb +++ b/lib/util/logger.rb @@ -458,7 +458,7 @@ module Util # Default formatter for log messages class Formatter def call(severity, time, progname, msg) - "#{severity} #{progname} #{time.strftime("%M-%S-%L")} #{progname}::#{msg2str(msg)}\n" + "#{severity} #{progname} #{time.strftime("%M-%S-%L")}::#{msg2str(msg)}\n" end private diff --git a/test/support/risc_interpreter.rb b/test/support/risc_interpreter.rb index aaad2af2..951d2807 100644 --- a/test/support/risc_interpreter.rb +++ b/test/support/risc_interpreter.rb @@ -10,9 +10,8 @@ module Risc Risc.machine.boot do_clean_compile Vool::VoolCompiler.ruby_to_binary( @string_input , :interpreter) - Collector.collect_space @interpreter = Interpreter.new - @interpreter.start Risc.machine.risc_init + @interpreter.start_machine end alias :do_setup :setup