diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index b512b842..9a4e8b08 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug.cpp,v 1.93 2008-05-21 08:50:59 qbix79 Exp $ */ +/* $Id: debug.cpp,v 1.94 2008-06-02 17:26:59 qbix79 Exp $ */ #include "dosbox.h" #if C_DEBUG @@ -56,8 +56,8 @@ void WIN32_Console(); #include #include static struct termios consolesettings; -int old_cursor_state; #endif +int old_cursor_state; // Forwards static void DrawCode(void); @@ -595,18 +595,17 @@ void CBreakpoint::ShowList(void) CBreakpoint* bp = (*i); if (bp->GetType()==BKPNT_PHYSICAL) { DEBUG_ShowMsg("%02X. BP %04X:%04X\n",nr,bp->GetSegment(),bp->GetOffset()); - nr++; } else if (bp->GetType()==BKPNT_INTERRUPT) { if (bp->GetValue()==BPINT_ALL) DEBUG_ShowMsg("%02X. BPINT %02X\n",nr,bp->GetIntNr()); else DEBUG_ShowMsg("%02X. BPINT %02X AH=%02X\n",nr,bp->GetIntNr(),bp->GetValue()); - nr++; } else if (bp->GetType()==BKPNT_MEMORY) { DEBUG_ShowMsg("%02X. BPMEM %04X:%04X (%02X)\n",nr,bp->GetSegment(),bp->GetOffset(),bp->GetValue()); - nr++; } else if (bp->GetType()==BKPNT_MEMORY_PROT) { DEBUG_ShowMsg("%02X. BPPM %04X:%08X (%02X)\n",nr,bp->GetSegment(),bp->GetOffset(),bp->GetValue()); - nr++; + } else if (bp->GetType()==BKPNT_MEMORY_LINEAR ) { + DEBUG_ShowMsg("%02X. BPLM %08X (%02X)\n",nr,bp->GetOffset(),bp->GetValue()); }; + nr++; } }; @@ -803,7 +802,7 @@ static void DrawCode(void) { } if (toolarge) { waddstr(dbg.win_code,".."); drawsize++; }; // Spacepad up to 20 characters - if(drawsize && (drawsize < 10)) { + if(drawsize && (drawsize < 11)) { line20[20 - drawsize*2] = 0; waddstr(dbg.win_code,line20); line20[20 - drawsize*2] = ' '; @@ -1016,12 +1015,12 @@ bool ParseCommand(char* str) { }; name[12] = 0; if(!name[0]) return false; - DEBUG_ShowMsg("DEBUG: Variable list load (%s) : %s.\n",name,(CDebugVar::SaveVars(name)?"ok":"failure")); + DEBUG_ShowMsg("DEBUG: Variable list load (%s) : %s.\n",name,(CDebugVar::LoadVars(name)?"ok":"failure")); return true; }; if (command == "SR") { // Set register value - DEBUG_ShowMsg("DEBUG: Set Register success.\n",(ChangeRegister(found)?"success":"failure")); + DEBUG_ShowMsg("DEBUG: Set Register %s.\n",(ChangeRegister(found)?"success":"failure")); return true; }; @@ -1109,7 +1108,7 @@ bool ParseCommand(char* str) { DEBUG_ShowMsg("DEBUG: Breakpoints deleted.\n"); } else { // delete single breakpoint - CBreakpoint::DeleteByIndex(bpNr); + DEBUG_ShowMsg("DEBUG: Breakpoint deletion %s.\n",(CBreakpoint::DeleteByIndex(bpNr)?"success":"failure")); } return true; }; @@ -1256,9 +1255,10 @@ bool ParseCommand(char* str) { DEBUG_ShowMsg("F9 - Set/Remove breakpoint.\n"); DEBUG_ShowMsg("F10/F11 - Step over / trace into instruction.\n"); DEBUG_ShowMsg("ALT + D/E/S/X/B - Set data view to DS:SI/ES:DI/SS:SP/DS:DX/ES:BX.\n"); - DEBUG_ShowMsg("Escape - clear input line."); + DEBUG_ShowMsg("Escape - Clear input line."); DEBUG_ShowMsg("Up/Down - Move code view cursor.\n"); DEBUG_ShowMsg("Page Up/Down - Scroll data view.\n"); + DEBUG_ShowMsg("Home/End - Scroll log messages.\n"); DEBUG_ShowMsg("BP [segment]:[offset] - Set breakpoint.\n"); DEBUG_ShowMsg("BPINT [intNr] * - Set interrupt breakpoint.\n"); DEBUG_ShowMsg("BPINT [intNr] [ah] - Set interrupt breakpoint with ah.\n"); @@ -1274,7 +1274,7 @@ bool ParseCommand(char* str) { #if C_HEAVY_DEBUG DEBUG_ShowMsg("LOG [num] - Write cpu log file.\n"); DEBUG_ShowMsg("LOGS/LOGL [num] - Write short/long cpu log file.\n"); - DEBUG_ShowMsg("HEAVYLOG - Enable/Disable automatic cpu when dosbox exits.\n"); + DEBUG_ShowMsg("HEAVYLOG - Enable/Disable automatic cpu log when dosbox exits.\n"); DEBUG_ShowMsg("ZEROPROTECT - Enable/Disable zero code execution detecion.\n"); #endif DEBUG_ShowMsg("SR [reg] [value] - Set register value.\n"); @@ -1464,12 +1464,15 @@ char* AnalyzeInstruction(char* inst, bool saveSelector) { } break; } if (jmp) { + pos = strchr(instu,'$'); + if (pos) { pos = strchr(instu,'+'); if (pos) { strcpy(result,"(down)"); } else { strcpy(result,"(up)"); } + } } else { sprintf(result,"(no jmp)"); } @@ -1836,13 +1839,13 @@ static void LogInstruction(Bit16u segValue, Bit32u eipValue, ofstream& out) { << " DS:" << setw(4) << SegValue(ds)<< " ES:" << setw(4) << SegValue(es); if(cpuLogType == 0) { - out << " SS:" << setw(4) << SegValue(ss) << " C" << get_CF() << " Z" << get_ZF() - << " S" << get_SF() << " O" << get_OF() << " I" << GETFLAGBOOL(IF); + out << " SS:" << setw(4) << SegValue(ss) << " C" << (get_CF()>0) << " Z" << (get_ZF()>0) + << " S" << (get_SF()>0) << " O" << (get_OF()>0) << " I" << GETFLAGBOOL(IF); } else { out << " FS:" << setw(4) << SegValue(fs) << " GS:" << setw(4) << SegValue(gs) << " SS:" << setw(4) << SegValue(ss) - << " CF:" << get_CF() << " ZF:" << get_ZF() << " SF:" << get_SF() - << " OF:" << get_OF() << " AF:" << get_AF() << " PF:" << get_PF() + << " CF:" << (get_CF()>0) << " ZF:" << (get_ZF()>0) << " SF:" << (get_SF()>0) + << " OF:" << (get_OF()>0) << " AF:" << (get_AF()>0) << " PF:" << (get_PF()>0) << " IF:" << GETFLAGBOOL(IF); } if(cpuLogType == 2) { @@ -1950,8 +1953,8 @@ static void DEBUG_ShutDown(Section * sec) { CBreakpoint::DeleteAll(); CDebugVar::DeleteAll(); - #ifndef WIN32 curs_set(old_cursor_state); + #ifndef WIN32 tcsetattr(0, TCSANOW,&consolesettings); // printf("\e[0m\e[2J"); //Seems to destroy scrolling printf("\ec"); diff --git a/src/debug/debug_gui.cpp b/src/debug/debug_gui.cpp index ca1e23af..1964632f 100644 --- a/src/debug/debug_gui.cpp +++ b/src/debug/debug_gui.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug_gui.cpp,v 1.35 2008-05-21 08:51:22 qbix79 Exp $ */ +/* $Id: debug_gui.cpp,v 1.36 2008-06-02 17:26:59 qbix79 Exp $ */ #include "dosbox.h" @@ -69,7 +69,7 @@ void DEBUG_ShowMsg(char const* format,...) { if (logBuffPos!=logBuff.end()) { logBuffPos=logBuff.end(); DEBUG_RefreshPage(0); - mvwprintw(dbg.win_out,dbg.win_out->_maxy-1, 0, ""); +// mvwprintw(dbg.win_out,dbg.win_out->_maxy-1, 0, ""); } logBuff.push_back(buf); if (logBuff.size() > MAX_LOG_BUFFER) @@ -85,15 +85,19 @@ void DEBUG_RefreshPage(char scroll) { else if (scroll==1 && logBuffPos!=logBuff.end()) logBuffPos++; list::iterator i = logBuffPos; - int rem_lines = dbg.win_out->_maxy; + int maxy, maxx; getmaxyx(dbg.win_out,maxy,maxx); + int rem_lines = maxy; wclear(dbg.win_out); while (rem_lines > 0 && i!=logBuff.begin()) { - rem_lines -= (int) ((*--i).size() / dbg.win_out->_maxx) + 1; + --i; + for (string::size_type posf=0, posl; (posl=(*i).find('\n',posf)) != string::npos ;posf=posl+1) + rem_lines -= (int) ((posl-posf) / maxx) + 1; // len=(posl+1)-posf-1 /* Const cast is needed for pdcurses which has no const char in mvwprintw (bug maybe) */ mvwprintw(dbg.win_out,rem_lines-1, 0, const_cast((*i).c_str())); } + mvwprintw(dbg.win_out,maxy-1, 0, ""); wrefresh(dbg.win_out); } @@ -159,22 +163,23 @@ static void DrawBars(void) { static void MakeSubWindows(void) { /* The Std output win should go in bottem */ /* Make all the subwindows */ + int win_main_maxy, win_main_maxx; getmaxyx(dbg.win_main,win_main_maxy,win_main_maxx); int outy=1; /* The Register window */ - dbg.win_reg=subwin(dbg.win_main,4,dbg.win_main->_maxx,outy,0); + dbg.win_reg=subwin(dbg.win_main,4,win_main_maxx,outy,0); outy+=5; /* The Data Window */ - dbg.win_data=subwin(dbg.win_main,10,dbg.win_main->_maxx,outy,0); + dbg.win_data=subwin(dbg.win_main,10,win_main_maxx,outy,0); outy+=11; /* The Code Window */ - dbg.win_code=subwin(dbg.win_main,11,dbg.win_main->_maxx,outy,0); + dbg.win_code=subwin(dbg.win_main,11,win_main_maxx,outy,0); outy+=12; /* The Variable Window */ - dbg.win_var=subwin(dbg.win_main,4,dbg.win_main->_maxx,outy,0); + dbg.win_var=subwin(dbg.win_main,4,win_main_maxx,outy,0); outy+=5; /* The Output Window */ - dbg.win_out=subwin(dbg.win_main,dbg.win_main->_maxy-outy-1,dbg.win_main->_maxx,outy,0); - dbg.input_y=dbg.win_main->_maxy-1; + dbg.win_out=subwin(dbg.win_main,win_main_maxy-outy-1,win_main_maxx,outy,0); + dbg.input_y=win_main_maxy-1; scrollok(dbg.win_out,TRUE); DrawBars(); Draw_RegisterLayout(); @@ -266,10 +271,10 @@ void DBGUI_StartUp(void) { nodelay(dbg.win_main,true); keypad(dbg.win_main,true); #ifndef WIN32 - resizeterm(50,81); + resizeterm(50,80); touchwin(dbg.win_main); - old_cursor_state = curs_set(0); #endif + old_cursor_state = curs_set(0); start_color(); cycle_count=0; MakePairs();