DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/debug/debug_inc.h
00001 /*
00002  *  Copyright (C) 2002-2020  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License along
00015  *  with this program; if not, write to the Free Software Foundation, Inc.,
00016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 /* Local Debug Function */
00020 
00021 
00022 #if C_DEBUG
00023 #include <curses.h>
00024 #include "mem.h"
00025 
00026 #include <string>
00027 
00028 #define PAIR_BLACK_BLUE 1
00029 #define PAIR_BYELLOW_BLACK 2
00030 #define PAIR_GREEN_BLACK 3
00031 #define PAIR_BLACK_GREY 4
00032 #define PAIR_GREY_RED 5
00033 #define PAIR_BLACK_GREEN 6
00034 #define PAIR_WHITE_BLUE 7
00035 
00036 void DBGUI_StartUp(void);
00037 
00038 extern const unsigned int dbg_def_win_height[];
00039 extern const char *dbg_def_win_titles[];
00040 extern const char *dbg_win_names[];
00041 
00042 class DBGBlock {
00043 public:
00044     enum {
00045         DATV_SEGMENTED=0,
00046         DATV_VIRTUAL,
00047         DATV_PHYSICAL
00048     };
00049     enum {
00050         /* main not counted */
00051         WINI_REG,
00052         WINI_DATA,
00053         WINI_CODE,
00054         WINI_VAR,
00055         WINI_OUT,
00056         /* inp not counted */
00057 
00058         WINI_MAX_INDEX
00059     };
00060     bool win_vis[WINI_MAX_INDEX] = {};
00061     std::string win_title[WINI_MAX_INDEX];
00062     unsigned char win_order[WINI_MAX_INDEX] = {};
00063     unsigned int win_height[WINI_MAX_INDEX] = {};
00064 public:
00065         DBGBlock() : win_main(NULL), win_reg(NULL), win_data(NULL), win_code(NULL),
00066                 win_var(NULL), win_out(NULL), win_inp(NULL), active_win(WINI_CODE), input_y(0), global_mask(0), data_view(0xFF) {
00067         for (unsigned int i=0;i < WINI_MAX_INDEX;i++) {
00068             win_height[i] = dbg_def_win_height[i];
00069             win_title[i] = dbg_def_win_titles[i];
00070             win_vis[i] = (i != WINI_VAR);
00071             win_order[i] = i;
00072         }
00073     }
00074 public:
00075         WINDOW * win_main;                                      /* The Main Window (not counted in tab enumeration) */
00076 
00077         WINDOW * win_reg;                                       /* Register Window */
00078         WINDOW * win_data;                                      /* Data Output window */
00079         WINDOW * win_code;                                      /* Disassembly/Debug point Window */
00080         WINDOW * win_var;                                       /* Variable Window */
00081         WINDOW * win_out;                                       /* Text Output Window */
00082 
00083     WINDOW * win_inp;                   /* Input window (not counted in tab enumeration) */
00084 
00085     Bit32u active_win;                                  /* Current active window */
00086         Bit32u input_y;
00087         Bit32u global_mask;                                     /* Current msgmask */
00088 
00089     unsigned char data_view;
00090 
00091     void set_data_view(unsigned int view);
00092 
00093     WINDOW *get_win(int idx);
00094     WINDOW* &get_win_ref(int idx);
00095     const char *get_winname(int idx);
00096     const char *get_wintitle(int idx);
00097     std::string windowlist_by_name(void);
00098     int name_to_win(const char *name);
00099     WINDOW *get_active_win(void);
00100     int win_find_order(int wnd);
00101     int win_prev_by_order(int order);
00102     int win_next_by_order(int order);
00103     void swap_order(int o1,int o2);
00104     void next_window(void);
00105 };
00106 
00107 
00108 struct DASMLine {
00109         Bit32u pc;
00110         char dasm[80];
00111         PhysPt ea;
00112         Bit16u easeg;
00113         Bit32u eaoff;
00114 };
00115 
00116 extern DBGBlock dbg;
00117 
00118 /* Local Debug Stuff */
00119 Bitu DasmI386(char* buffer, PhysPt pc, Bit32u cur_ip, bool bit32);
00120 int  DasmLastOperandSize(void);
00121 #endif
00122