From 364205668684c691fe4d379a6bd799854b8a7902 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 7 Jan 2003 18:03:39 +0000 Subject: [PATCH] debugger fixes under linux Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@624 --- src/debug/debug.cpp | 16 ++++++++++++---- src/debug/debug_gui.cpp | 13 +++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index 3c3d1bd3..720613fd 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -38,8 +38,11 @@ #ifdef WIN32 void WIN32_Console(); +#else +#include +#include +static struct termios consolesettings; #endif - // Forwards static void DrawCode(void); static bool DEBUG_Log_Loop(int count); @@ -855,6 +858,7 @@ Bit32u DEBUG_CheckKeys(void) { case 0x0A: codeViewData.inputMode = FALSE; ParseCommand(codeViewData.inputStr); break; + case 0x107: //backspace (linux) case 0x08: // delete if (strlen(codeViewData.inputStr)>0) codeViewData.inputStr[strlen(codeViewData.inputStr)-1] = 0; break; @@ -1126,9 +1130,10 @@ void DEBUG_SetupConsole(void) { #ifdef WIN32 WIN32_Console(); - #else - printf("\e[8;50;80t"); //resize terminal - fflush(NULL); + #else + tcgetattr(0,&consolesettings); + printf("\e[8;50;80t"); //resize terminal + fflush(NULL); #endif memset((void *)&dbg,0,sizeof(dbg)); debugging=false; @@ -1141,6 +1146,9 @@ void DEBUG_SetupConsole(void) static void DEBUG_ShutDown(Section * sec) { CBreakpoint::DeleteAll(); + #ifndef WIN32 + tcsetattr(0, TCSANOW,&consolesettings); + #endif }; void DEBUG_Init(Section* sec) { diff --git a/src/debug/debug_gui.cpp b/src/debug/debug_gui.cpp index 64eb95fb..a89b2d87 100644 --- a/src/debug/debug_gui.cpp +++ b/src/debug/debug_gui.cpp @@ -118,14 +118,15 @@ static void MakePairs(void) { void DBGUI_StartUp(void) { /* Start the main window */ dbg.win_main=initscr(); - cbreak(); /* take input chars one at a time, no wait for \n */ - noecho(); /* don't echo input */ + cbreak(); /* take input chars one at a time, no wait for \n */ + noecho(); /* don't echo input */ nodelay(dbg.win_main,true); keypad(dbg.win_main,true); - #ifndef WIN32 - resizeterm(50,80); - touchwin(dbg.win_main); - #endif + #ifndef WIN32 + resizeterm(50,80); + touchwin(dbg.win_main); + #endif + start_color(); cycle_count=0; MakePairs(); MakeSubWindows();