debugging binaries, initial jump issues
This commit is contained in:
@ -9,9 +9,9 @@ module Risc
|
||||
|
||||
class TextWriter
|
||||
include Logging
|
||||
log_level :info
|
||||
log_level :debug
|
||||
|
||||
MARKER = 0xA51AF00D
|
||||
MARKER = 0xBAD4C0DE
|
||||
|
||||
def initialize( machine)
|
||||
@machine = machine
|
||||
@ -25,7 +25,7 @@ module Risc
|
||||
# - all BinaryCode
|
||||
def write_as_string
|
||||
@stream = StringIO.new
|
||||
write_any(@machine.binary_init)
|
||||
write_init(@machine.binary_init)
|
||||
write_debug
|
||||
write_objects
|
||||
write_code
|
||||
@ -146,6 +146,18 @@ module Risc
|
||||
log.debug "Data4 witten stream 0x#{@stream.length.to_s(16)}"
|
||||
end
|
||||
|
||||
# first jump, treated as a binary code, but this one needs
|
||||
# the actual jump as the first
|
||||
def write_init( code )
|
||||
code.each_word do |word|
|
||||
@stream.write_unsigned_int_32( word || 0 )
|
||||
end
|
||||
write_ref_for( code.next )
|
||||
write_ref_for( code.get_type )
|
||||
@stream.write_signed_int_32( MARKER )
|
||||
log.debug "Code16 witten stream 0x#{@stream.length.to_s(16)}"
|
||||
end
|
||||
|
||||
def write_BinaryCode( code )
|
||||
@stream.write_signed_int_32( MARKER )
|
||||
write_ref_for( code.get_type )
|
||||
|
Reference in New Issue
Block a user