]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Debugger updates.
authorToni Wilen <twilen@winuae.net>
Sat, 2 May 2020 17:02:33 +0000 (20:02 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 2 May 2020 17:02:33 +0000 (20:02 +0300)
cfgfile.cpp
debug.cpp
include/options.h
include/sysdeps.h
od-win32/win32gui.cpp
od-win32/writelog.cpp

index 3fc021e2d70f553e34d430eed6932ea8cd214340..01c788ca8bd9ae20089f5d3f7514344121a00a8e 100644 (file)
@@ -2621,7 +2621,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_write_bool (f, _T("rtg_nocustom"), p->picasso96_nocustom);
        cfgfile_write (f, _T("rtg_modes"), _T("0x%x"), p->picasso96_modeflags);
 
-       cfgfile_write_bool (f, _T("log_illegal_mem"), p->illegal_mem);
+       cfgfile_write_bool(f, _T("debug_mem"), p->debug_mem);
+       cfgfile_write_bool(f, _T("log_illegal_mem"), p->illegal_mem);
 
 #if 0
        if (p->catweasel >= 100)
@@ -3341,6 +3342,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_yesno(option, value, _T("sound_volcnt"), &p->sound_volcnt)
                || cfgfile_yesno(option, value, _T("sound_stereo_swap_paula"), &p->sound_stereo_swap_paula)
                || cfgfile_yesno(option, value, _T("sound_stereo_swap_ahi"), &p->sound_stereo_swap_ahi)
+               || cfgfile_yesno(option, value, _T("debug_mem"), &p->debug_mem)
                || cfgfile_yesno(option, value, _T("log_illegal_mem"), &p->illegal_mem)
                || cfgfile_yesno(option, value, _T("filesys_no_fsdb"), &p->filesys_no_uaefsdb)
                || cfgfile_yesno(option, value, _T("gfx_monochrome"), &p->gfx_grayscale)
@@ -8144,6 +8146,8 @@ static void buildin_default_prefs (struct uae_prefs *p)
 
        p->mountitems = 0;
 
+       p->debug_mem = false;
+
        target_default_options (p, 1);
        cfgfile_compatibility_romtype(p);
 }
index 7246695a153aa37504306a7eb72235854a7a0486..9ca68419a99ca913cf3333ba5aca977369a36521 100644 (file)
--- a/debug.cpp
+++ b/debug.cpp
@@ -3716,6 +3716,7 @@ static void memwatch (TCHAR **c)
        mwn->reg = 0xffffffff;
        mwn->frozen = 0;
        mwn->modval_written = 0;
+       mwn->mustchange = 0;
        mwn->bus_error = 0;
        ignore_ws (c);
        if (more_params (c)) {
@@ -7227,6 +7228,7 @@ struct dsprintfstack
 };
 static dsprintfstack debugsprintf_stack[DEBUGSPRINTF_SIZE];
 static uae_u16 debugsprintf_latch, debugsprintf_latched;
+static uae_u32 debugsprintf_cycles, debugsprintf_cycles_set;
 
 static void read_bstring(char *out, int max, uae_u32 addr)
 {
@@ -7267,6 +7269,20 @@ static void read_string(char *out, int max, uae_u32 addr)
        }
 }
 
+static char *parse_custom(char *p, char *d)
+{
+       if (!strcmp(p, "CYCLES")) {
+               if (debugsprintf_cycles_set) {
+                       uae_u32 c = (get_cycles() - debugsprintf_cycles) / CYCLE_UNIT;
+                       sprintf(d, "%u", c);
+               } else {
+                       strcpy(d, "-");
+               }
+               d += strlen(d);
+       }
+       return d;
+}
+
 static void debug_sprintf_do(uae_u32 s)
 {
        int cnt = 0;
@@ -7307,6 +7323,14 @@ static void debug_sprintf_do(uae_u32 s)
                                        sprintf(d, "%d", stack->val);
                                } else if (cn == 'u') {
                                        sprintf(d, "%u", stack->val);
+                               } else if (cn == '[') {
+                                       char *next = strchr(p, ']');
+                                       if (next) {
+                                               p++;
+                                               *next = 0;
+                                               d = parse_custom(p, d);
+                                               p = next + 1;
+                                       }
                                } else {
                                        d[0] = '?';
                                        d[1] = 0;
@@ -7325,7 +7349,7 @@ static void debug_sprintf_do(uae_u32 s)
 
 bool debug_sprintf(uaecptr addr, uae_u32 val, int size)
 {
-       if (currprefs.uaeboard < 2)
+       if (!currprefs.debug_mem)
                return false;
 
        uae_u32 v = val;
@@ -7351,6 +7375,8 @@ bool debug_sprintf(uaecptr addr, uae_u32 val, int size)
                debug_sprintf_do(v);
                debugsprintf_cnt = 0;
                debugsprintf_latched = 0;
+               debugsprintf_cycles = get_cycles();
+               debugsprintf_cycles_set = 1;
        } else {
                if (debugsprintf_cnt < DEBUGSPRINTF_SIZE) {
                        debugsprintf_stack[debugsprintf_cnt].val = v;
index cd2ccb1aaa261f5e45d7602882da4c6ebf7b4dc4..76e930f49e779477dea18b768727705d26364c42 100644 (file)
@@ -474,6 +474,7 @@ struct uae_prefs {
        TCHAR config_window_title[256];
 
        bool illegal_mem;
+       bool debug_mem;
        bool use_serial;
        bool serial_demand;
        bool serial_hwctsrts;
index 5997008833b25cee9eb83b6d70b5b76e64803e98..94d4c31fe0af5178c5814b3ba03c62629178812d 100644 (file)
@@ -456,6 +456,7 @@ extern void logging_init (void);
 extern FILE *log_open (const TCHAR *name, int append, int bootlog, TCHAR*);
 extern void log_close (FILE *f);
 extern TCHAR *write_log_get_ts(void);
+extern bool is_console_open(void);
 
 extern bool use_long_double;
 
index 824816cbd09fc076e8ab52ef21cd72cde0e86d1b..28b1e54a2fefc375ba8047eae583d2f5fe303631 100644 (file)
@@ -4647,7 +4647,7 @@ static const struct miscentry misclist[] = {
        { 0, 1, _T("Native on-screen display"), NULL, &workprefs.leds_on_screen, STATUSLINE_CHIPSET, STATUSLINE_CHIPSET },
        { 0, 1, _T("RTG on-screen display"), NULL, &workprefs.leds_on_screen, STATUSLINE_RTG, STATUSLINE_RTG },
        { 0, 0, _T("Create winuaelog.txt log"), &workprefs.win32_logfile },
-       { 0, 0, _T("Log illegal memory accesses"), &workprefs.illegal_mem },
+       { 0, 1, _T("Log illegal memory accesses"), &workprefs.illegal_mem },
        { 0, 0, _T("Blank unused displays"), &workprefs.win32_blankmonitors },
        { 0, 0, _T("Start mouse uncaptured"), &workprefs.win32_start_uncaptured  },
        { 0, 0, _T("Start minimized"), &workprefs.win32_start_minimized  },
@@ -4661,6 +4661,7 @@ static const struct miscentry misclist[] = {
        { 0, 1, _T("Warn when attempting to close window"), &workprefs.win32_warn_exit },
        { 0, 1, _T("Power led dims when audio filter is disabled"), NULL, &workprefs.power_led_dim, 128, 0 },
        { 0, 1, _T("Automatically capture mouse when window is activated"), &workprefs.win32_capture_always },
+       { 0, 0, _T("Debug memory space"), &workprefs.debug_mem },
        { 0, NULL }
 };
 
index 0ff3395e1639f30330ae1aee6b150c046fd61d9f..2110eb6a67d3b79d0ed0d44fc4e095f211e36797 100644 (file)
@@ -75,6 +75,11 @@ int always_flush_log = 0;
 
 /* console functions for debugger */
 
+bool is_console_open(void)
+{
+       return consoleopen;
+}
+
 static HWND myGetConsoleWindow (void)
 {
        return GetConsoleWindow ();