metasm/gui/debug.rb in metasm-1.0.3 vs metasm/gui/debug.rb in metasm-1.0.4

- old
+ new

@@ -117,11 +117,11 @@ end @idle_checking = false @dbg.dasm_invalidate @mem.gui_update @dbg.disassembler.sections.clear if @dbg.state == :dead - @dbg.disassembler.disassemble_fast(@dbg.pc) + @dbg.disassembler.disassemble_fast(@dbg.pc) if not @dbg.disassembler.di_at(@dbg.pc) @children.each { |c| if wp = @watchpoint[c] c.focus_addr @dbg.resolve_expr(wp), nil, true end } @@ -249,11 +249,11 @@ swapin_tid @reg_pos = [] # list of x y w h vx of the reg drawing on widget, vx is x of value @default_color_association = ColorTheme.merge :label => :text, :data => :blue, :write_pending => :darkred, - :changed => :green, :caret => :text, :inactive => :palegrey + :changed => :darkgreen, :caret => :text, :inactive => :palegrey end def swapin_tid stf = @tid_stuff[[@dbg.pid, @dbg.tid]] ||= {} return if not @dbg.cpu @@ -311,11 +311,15 @@ @reg_pos << [x, y, (strlen+1)*@font_width, @font_height, x+regstrlen*@font_width] render["#{reg}=".ljust(regstrlen), :label] v = @write_pending[reg] || @reg_cache[reg] col = running ? :inactive : @write_pending[reg] ? :write_pending : @reg_cache_old.fetch(reg, v) != v ? :changed : :data - render["%0#{@register_size[reg]}x " % v, col] + if v.kind_of?(::Integer) + render["%0#{@register_size[reg]}x " % v, col] + else + render[v.to_s, col] + end x += @font_width # space } @flags.each { |reg| if x + @font_width >= w_w # XXX nowrap flags ? @@ -972,11 +976,15 @@ @dbg.dasm_invalidate p.gui_update } new_command('?', 'display a value') { |arg| next if not v = solve_expr(arg) - add_log "#{v} 0x#{v.to_s(16)} #{[v & 0xffff_ffff].pack('L').inspect} #{@dbg.addrname!(v)}" + if v.kind_of?(Expression) + add_log "#{v}" + else + add_log "#{v} 0x#{v.to_s(16)} #{[v & 0xffff_ffff].pack('L').inspect} #{@dbg.addrname!(v)}" + end } new_command('exit', 'quit', 'quit the debugger interface') { p.win.destroy } new_command('ruby', 'execute arbitrary ruby code') { |arg| case ret = eval(arg) when nil, true, false, Symbol; add_log ret.inspect @@ -1230,9 +1238,10 @@ end class DbgWindow < Window attr_accessor :dbg_widget def initialize_window(dbg = nil, title='metasm debugger') + dbg, title = title, dbg if dbg.kind_of?(::String) or title.kind_of?(Debugger) self.title = title display(dbg) if dbg end # show a new DbgWidget