fix debug

This commit is contained in:
Torsten Ruger 2015-06-09 11:38:03 +02:00
parent 20b28077a1
commit c9ec6e2f39
3 changed files with 10 additions and 9 deletions

View File

@ -29,14 +29,14 @@ module Elf
end
end
end
space.main.blocks.each do |b|
add_symbol "main@#{b.name}" , b.position
end
add_symbol "#register@#{space.init.name}" , space.init.position
assembler.objects.values.each do |slot|
# @object_machine.space.main.blocks.each do |b|
# add_symbol "main@#{b.name}" , b.position
# end
# add_symbol "#register@#{@object_machine.space.init.name}" , @object_machine.space.init.position
@object_machine.objects.each do |slot|
label = "#{slot.class.name}::#{slot.position.to_s(16)}"
label += "=#{slot}" if slot.is_a?(Symbol) or slot.is_a?(String)
label += "=#{slot.string}" if slot.is_a?(Parfait::Word)
label += "=#{slot.name}" if slot.is_a?(Parfait::BinaryCode)
add_symbol label , slot.position
end
end

View File

@ -2,9 +2,9 @@ module Register
class LinkException < Exception
end
# Assemble the object machine into a binary.
# Link first to get positions, then assemble
# Assemble first to get positions, then write
# The link function determines the length of an object and the assemble actually
# The assemble function determines the length of an object and then actually
# writes the bytes they are pretty much dependant. In an earlier version they were
# functions on the objects, but now it has gone to a visitor pattern.
@ -25,6 +25,7 @@ module Register
# binary code (array) to right length
@machine.objects.each do |objekt|
next unless objekt.is_a? Parfait::Method
# should be fill_to_length (with zeros)
objekt.code.set_length(objekt.info.byte_length , 0)
end
at = 0

View File

@ -17,7 +17,7 @@ module Virtual
@codes = []
end
attr_reader :name , :codes , :method
attr_reader :name , :codes , :method , :position
attr_accessor :branch
def reachable ret = []