start to debug
This commit is contained in:
parent
865a116f47
commit
633e99466d
@ -58,7 +58,10 @@ module Risc
|
||||
at += 8 # thats the padding
|
||||
# want to have the objects first in the executable
|
||||
@objects.each do | id , objekt|
|
||||
next if objekt.is_a? Risc::Label # will get assembled as method.risc_instructions
|
||||
if objekt.is_a? Risc::Label # will get assembled as method.cpu_instructions
|
||||
Positioned.set_position(objekt,at)
|
||||
next
|
||||
end
|
||||
next if objekt.is_a? Parfait::BinaryCode
|
||||
Positioned.set_position(objekt,at)
|
||||
at += objekt.padded_length
|
||||
@ -132,10 +135,10 @@ module Risc
|
||||
# and then plonk that binary data into the method.code array
|
||||
def assemble_binary_method method
|
||||
stream = StringIO.new
|
||||
#puts "Method #{method.source.risc_instructions.to_ac}"
|
||||
#puts "Method #{method.source.cpu_instructions.to_ac}"
|
||||
begin
|
||||
#puts "assemble #{method.source.risc_instructions}"
|
||||
method.risc_instructions.assemble_all( stream )
|
||||
#puts "assemble #{method.source.cpu_instructions}"
|
||||
method.cpu_instructions.assemble_all( stream )
|
||||
rescue => e
|
||||
log.debug "Assembly error #{method.name}\n#{method.to_rxf.to_s[0...2000]}"
|
||||
raise e
|
||||
@ -155,7 +158,7 @@ module Risc
|
||||
stream.rewind
|
||||
length = stream.length
|
||||
binary = method.binary
|
||||
total_byte_length = method.risc_instructions.total_byte_length
|
||||
total_byte_length = method.cpu_instructions.total_byte_length
|
||||
log.debug "Assembled code #{method.name} with length #{length}"
|
||||
raise "length error #{binary.char_length} != #{total_byte_length}" if binary.char_length <= total_byte_length
|
||||
raise "length error #{length} != #{total_byte_length}" if total_byte_length != length
|
||||
|
@ -11,7 +11,8 @@ module Positioned
|
||||
if pos == nil
|
||||
str = "position accessed but not set, "
|
||||
str += "#{object.object_id.to_s(16)}\n"
|
||||
raise str + "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.inspect[0...100]}"
|
||||
str += "for #{object.class} byte_length #{object.byte_length if object.respond_to?(:byte_length)} for #{object.inspect[0...100]}"
|
||||
raise str
|
||||
end
|
||||
pos
|
||||
end
|
||||
|
@ -33,10 +33,10 @@ module Risc
|
||||
assert @machine.translate_arm
|
||||
assert @assembler.assemble
|
||||
end
|
||||
def pest_write_space
|
||||
def test_write_space
|
||||
@assembler = Assembler.new(@machine , Collector.collect_space)
|
||||
assert @machine.translate_arm
|
||||
assert @assembler.write_as_string
|
||||
#assert @assembler.write_as_string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user