Skip to content

Commit

Permalink
fixed debugger up
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Aug 3, 2012
1 parent 6e843c9 commit 5c9b9f6
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 5 deletions.
3 changes: 3 additions & 0 deletions js/common/mmu.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ function Mmu(size) {
if(l[0] != 'S')
{
ERROR("Invalid srec record!");
throw "Bad srecord";
}

var count = l.substring(2,4);
Expand Down Expand Up @@ -379,6 +380,7 @@ function Mmu(size) {
else
{
ERROR("Unknown SREC type: " + t);
throw "Bad srecord";
return;
}

Expand All @@ -387,6 +389,7 @@ function Mmu(size) {
if((data.length % 2) != 0)
{
ERROR("Length of data in SREC record is not valid: " + data.length);
throw "Bad srecord";
}

addr = parseInt(addr, 16);
Expand Down
8 changes: 6 additions & 2 deletions js/node/node_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ addCommand("loadsrec", function (s,command) {
var setEntry = command.split(" ")[1];
var srecString = command.split(" ")[2];
setEntry = parseInt(setEntry,16);
callNoException(emu.mmu,emu.mmu.loadSREC,[srecString,setEntry]);
try {
callNoException(emu.mmu,emu.mmu.loadSREC,[srecString,setEntry]);
} catch(e){
s.write(e)
}
s.write("ok\n");
});

Expand All @@ -266,7 +270,7 @@ function handleCommand(data) {
for(var i = 0 ; i < commands.length ; i++){
if(data.substr(0,commands[i].length) == commands[i]) {
try {
commandLUT[commands[i]](this,data);
commandLUT[commands[i]](this,data);
} catch (e){
if (e == 1337){
this.write("ERROR: processor exception occured ")
Expand Down
63 changes: 61 additions & 2 deletions tools/AssemblyView.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,72 @@
import wx
import socket
from mips32emu.AssemblyViewPanel import AssemblyViewPanel

class AssemblyView(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None, -1, 'AssemblyView')
toolbar = self.CreateToolBar()
load = toolbar.AddLabelTool(wx.ID_ANY, 'load', wx.Bitmap('tools/tload.png'))
reset = toolbar.AddLabelTool(wx.ID_ANY, 'reset', wx.Bitmap('tools/treset.png'))
step = toolbar.AddLabelTool(wx.ID_ANY, 'step', wx.Bitmap('tools/tstep.png'))
run = toolbar.AddLabelTool(wx.ID_ANY, 'run', wx.Bitmap('tools/trun.png'))
pause = toolbar.AddLabelTool(wx.ID_ANY, 'break', wx.Bitmap('tools/tbreak.png'))
toolbar.Realize()
self.Bind(wx.EVT_TOOL, self.onLoad, load)
self.Bind(wx.EVT_TOOL, self.onStep, step)
self.Bind(wx.EVT_TOOL, self.onRun, run)
self.Bind(wx.EVT_TOOL, self.onReset, reset)
self.Bind(wx.EVT_TOOL, self.onPause, pause)
self.av = AssemblyViewPanel(self)
def onStep(self):
self.av.dbg.step()
self.srec = None
def onRun(self,evt):
try:
self.av.dbg.run()
except socket.error:
wx.MessageBox('Not connected', 'Error', wx.OK | wx.ICON_ERROR)
except Exception as e:
wx.MessageBox(str(e), 'Error', wx.OK | wx.ICON_ERROR)
def onReset(self,evt):
try:
if self.srec == None:
raise Exception("you havent loaded any srecs to reset to yet...")
self.loadSrec(self.srec)
except socket.error:
wx.MessageBox('Not connected', 'Error', wx.OK | wx.ICON_ERROR)
except Exception as e:
wx.MessageBox(str(e), 'Error', wx.OK | wx.ICON_ERROR)
def onPause(self,evt):
try:
self.av.dbg.dbgBreak()
except socket.error:
wx.MessageBox('Not connected', 'Error', wx.OK | wx.ICON_ERROR)
except Exception as e:
wx.MessageBox(str(e), 'Error', wx.OK | wx.ICON_ERROR)

def onStep(self,evt):
try:
self.av.dbg.step()
except socket.error:
wx.MessageBox('Not connected', 'Error', wx.OK | wx.ICON_ERROR)
except Exception as e:
wx.MessageBox(str(e), 'Error', wx.OK | wx.ICON_ERROR)
def onLoad(self,evt):
diag = wx.FileDialog(None)
r = diag.ShowModal()
if r != wx.ID_OK:
return
path = diag.GetPath()
self.srec = path
try:
self.loadSrec(path)
except socket.error:
wx.MessageBox('not connected!', 'Error', wx.OK | wx.ICON_ERROR)
except Exception as e:
wx.MessageBox('error while loading srec file! - ' + str(e), 'Error', wx.OK | wx.ICON_ERROR)
def loadSrec(self,fname):
self.av.dbg.dbgBreak()
for line in open(fname):
self.av.dbg.loadSrec(line,1)

app = wx.App()
frame = AssemblyView()
Expand Down
2 changes: 1 addition & 1 deletion tools/mips32emu/AssemblyViewPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self,parent,id=-1):
wx.FONTWEIGHT_NORMAL, False, 'Courier 10 Pitch')
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.timerHandler, self.timer)
self.timer.Start(1500,False)
self.timer.Start(700,False)
def timerHandler(self,evt):
self.Refresh()
def OnSize(self, event):
Expand Down
Binary file added tools/tbreak.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tools/tload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tools/treset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tools/trun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tools/tstep.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5c9b9f6

Please sign in to comment.