mirror of
https://github.com/specht/champ.git
synced 2024-06-09 19:29:28 +00:00
added pre and post labels to watch diagrams, fixed line numbers
This commit is contained in:
parent
95832e74cd
commit
c1a62aad8a
33
champ.rb
33
champ.rb
|
@ -96,12 +96,12 @@ class Champ
|
||||||
STDERR.puts 'Input file not found.'
|
STDERR.puts 'Input file not found.'
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
Dir::mktmpdir do |temp_dir|
|
if @source_path[-2, 2] == '.s'
|
||||||
FileUtils.cp(@source_path, temp_dir)
|
Dir::mktmpdir do |temp_dir|
|
||||||
|
FileUtils.cp(@source_path, temp_dir)
|
||||||
|
|
||||||
pwd = Dir.pwd
|
pwd = Dir.pwd
|
||||||
Dir.chdir(temp_dir)
|
Dir.chdir(temp_dir)
|
||||||
if @source_path[-2, 2] == '.s'
|
|
||||||
# compile the source
|
# compile the source
|
||||||
merlin_output = `Merlin32 -V . #{File.basename(@source_path)}`
|
merlin_output = `Merlin32 -V . #{File.basename(@source_path)}`
|
||||||
if $?.exitstatus != 0 || File.exist?('error_output.txt')
|
if $?.exitstatus != 0 || File.exist?('error_output.txt')
|
||||||
|
@ -116,10 +116,10 @@ class Champ
|
||||||
# TODO: Adjust addresses!!!
|
# TODO: Adjust addresses!!!
|
||||||
parse_merlin_output(@merlin_output_path)
|
parse_merlin_output(@merlin_output_path)
|
||||||
load_image(@merlin_binary_path, source_file[:address])
|
load_image(@merlin_binary_path, source_file[:address])
|
||||||
else
|
Dir.chdir(pwd)
|
||||||
load_image(@source_path, source_file[:address])
|
|
||||||
end
|
end
|
||||||
Dir.chdir(pwd)
|
else
|
||||||
|
load_image(@source_path, source_file[:address])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -432,21 +432,22 @@ class Champ
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
(0..1).each do |offset|
|
(0..1).each do |offset|
|
||||||
|
component_label = component[:name]
|
||||||
if component_index == 0
|
if component_index == 0
|
||||||
print_s(pixels, width, height,
|
print_s(pixels, width, height,
|
||||||
(canvas_left + canvas_width * 0.5 - component[:name].size * 3 + offset).to_i,
|
(canvas_left + canvas_width * 0.5 - component_label.size * 3 + offset).to_i,
|
||||||
canvas_top + canvas_height + 18,
|
canvas_top + canvas_height + 18,
|
||||||
component[:name], 63)
|
component_label, 63)
|
||||||
else
|
else
|
||||||
print_s_r(pixels, width, height,
|
print_s_r(pixels, width, height,
|
||||||
canvas_left - 22,
|
canvas_left - 22,
|
||||||
(canvas_top + canvas_height * 0.5 - component[:name].size * 3 + offset).to_i,
|
(canvas_top + canvas_height * 0.5 - component_label.size * 3 + offset).to_i,
|
||||||
component[:name], 63)
|
component_label, 63)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
label = "#{watch[:path]}:#{watch[:line_number]}"
|
label = "#{sprintf('0x%04x', watch[:pc])} / #{watch[:path]}:#{watch[:line_number]} (#{watch[:post] ? 'post' : 'pre'})"
|
||||||
print_s(pixels, width, height, width - 6 * label.size - 3, height - 10, label, 63)
|
print_s(pixels, width, height, width / 2 - 3 * label.size, height - 10, label, 63)
|
||||||
|
|
||||||
tr = @highlight_color[1, 2].to_i(16)
|
tr = @highlight_color[1, 2].to_i(16)
|
||||||
tg = @highlight_color[3, 2].to_i(16)
|
tg = @highlight_color[3, 2].to_i(16)
|
||||||
|
@ -588,8 +589,10 @@ class Champ
|
||||||
elsif line_type == 'Code'
|
elsif line_type == 'Code'
|
||||||
@watches[pc] ||= []
|
@watches[pc] ||= []
|
||||||
champ_directives.each do |directive|
|
champ_directives.each do |directive|
|
||||||
|
line_number = parts[1].split(' ').map { |x| x.strip }.reject { |x| x.empty? }.last.to_i
|
||||||
watch = parse_champ_directive(directive, false)
|
watch = parse_champ_directive(directive, false)
|
||||||
watch[:line_number] = @source_line
|
watch[:line_number] = line_number
|
||||||
|
watch[:pc] = pc
|
||||||
@watches[pc] << watch
|
@watches[pc] << watch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user