diff options
| author | James Brown | 2003-04-20 16:25:48 +0000 | 
|---|---|---|
| committer | James Brown | 2003-04-20 16:25:48 +0000 | 
| commit | 79189f2e12ef24312848d152a599a65373447b37 (patch) | |
| tree | cd1716306ddf61756c6ae93abc2ad47321e0add6 | |
| parent | ce6859d6c6d0baa6d663fe0d36f10db3eb558531 (diff) | |
| download | scummvm-rg350-79189f2e12ef24312848d152a599a65373447b37.tar.gz scummvm-rg350-79189f2e12ef24312848d152a599a65373447b37.tar.bz2 scummvm-rg350-79189f2e12ef24312848d152a599a65373447b37.zip  | |
Dump Scumm error() to debugger
svn-id: r7033
| -rw-r--r-- | scumm/debugger.cpp | 12 | ||||
| -rw-r--r-- | scumm/debugger.h | 3 | ||||
| -rw-r--r-- | scumm/scummvm.cpp | 13 | 
3 files changed, 24 insertions, 4 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 2a8a8f6e4b..9ffd3b24db 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -48,9 +48,12 @@ ScummDebugger::ScummDebugger() {  }  // Initialisation Functions -void ScummDebugger::attach(Scumm *s) { +void ScummDebugger::attach(Scumm *s, char *entry) {  	if (_s)  		detach(); + +	if (entry) +		errStr = strdup(entry);  	_s = s;  	s->_debugger = this; @@ -161,8 +164,15 @@ void ScummDebugger::enter() {  #ifdef USE_CONSOLE  	if (!_s->_debuggerDialog) {  		_s->_debuggerDialog = new ConsoleDialog(_s->_newgui, _s->_realWidth); +  		Debug_Printf("Debugger started, type 'exit' to return to the game\n");  	} + +	if (errStr) { +		Debug_Printf("ERROR: %s\n\n", errStr); +		free(errStr); +		errStr = NULL; +	}  	_s->_debuggerDialog->setInputeCallback(debuggerInputCallback, this);  	_s->_debuggerDialog->runModal(); diff --git a/scumm/debugger.h b/scumm/debugger.h index 705223e5b3..c84f21f870 100644 --- a/scumm/debugger.h +++ b/scumm/debugger.h @@ -51,7 +51,7 @@ public:  	ScummDebugger();  	void on_frame(); -	void attach(Scumm *s); +	void attach(Scumm *s, char *entry);  protected:  	Scumm *_s; @@ -59,6 +59,7 @@ protected:  	DVar _dvars[256];  	DCmd _dcmds[256];  	bool _detach_now; +	char *errStr;  	void enter();  	void detach(); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 436cf777d7..21fc0df335 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -1400,7 +1400,7 @@ void Scumm::processKbd() {  		_vars[VAR_CHARINC] = _defaultTalkDelay / 20;  	} else if (_lastKeyHit == '~' || _lastKeyHit == '#') { // Debug console -		g_debugger.attach(this); +		g_debugger.attach(this, NULL);  	}  	_mouseButStat = _lastKeyHit; @@ -1591,6 +1591,15 @@ void Scumm::errorString(const char *buf1, char *buf2) {  	} else {  		strcpy(buf2, buf1);  	} + +        // Unless an error -originated- within the debugger, spawn the debugger. Otherwise +        // exit out normally. +        if (!_debugger) { +                printf("%s", buf2);	// (Print it again in-case debugger segfaults) +                g_debugger.attach(this, buf2); +                g_debugger.on_frame(); +        } +  }  void Scumm::waitForTimer(int msec_delay) { @@ -1638,7 +1647,7 @@ void Scumm::parseEvents() {  				else if (event.kbd.keycode == 'g')  					_fastMode ^= 2;  				else if ((event.kbd.keycode == 'd') && (!_system->property(OSystem::PROP_GET_FULLSCREEN, 0))) -					g_debugger.attach(this); +					g_debugger.attach(this, NULL);  				else if (event.kbd.keycode == 's')  					resourceStats();  				else  | 
