filename | src/gui/debug_win.c |
changeset | 69:2e8634272a98 |
prev | 45:f99236f0632e |
next | 94:8d80d9c7cc7d |
author | nkeynes |
date | Tue Jan 10 13:58:35 2006 +0000 (18 years ago) |
permissions | -rw-r--r-- |
last change | Force redisasm when switching cpus Handle emits when gui hasn't been created yet (dump to stderr) |
file | annotate | diff | log | raw |
1.1 --- a/src/gui/debug_win.c Tue Dec 27 08:41:22 2005 +00001.2 +++ b/src/gui/debug_win.c Tue Jan 10 13:58:35 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: debug_win.c,v 1.14 2005-12-27 08:41:22 nkeynes Exp $1.6 + * $Id: debug_win.c,v 1.15 2006-01-10 13:58:35 nkeynes Exp $1.7 * This file is responsible for the main debugger gui frame.1.8 *1.9 * Copyright (c) 2005 Nathan Keynes.1.10 @@ -16,11 +16,13 @@1.11 */1.12 #include <stdlib.h>1.13 #include <stdarg.h>1.14 +#include <stdio.h>1.15 #include <gnome.h>1.16 #include <math.h>1.17 #include "gui/gui.h"1.18 #include "mem.h"1.19 #include "cpu.h"1.20 +#include "video.h"1.22 GdkColor *msg_colors[] = { &clrError, &clrError, &clrWarn, &clrNormal,1.23 &clrDebug, &clrTrace };1.24 @@ -128,14 +130,14 @@1.26 void update_icount( debug_info_t data )1.27 {1.28 - sprintf( data->icounter_text, "%d", *data->cpu->icount );1.29 + // sprintf( data->icounter_text, "%d", *data->cpu->icount );1.30 + sprintf( data->icounter_text, "%d", video_frame_count );1.31 gtk_progress_bar_set_text( data->icounter, data->icounter_text );1.32 }1.34 void set_disassembly_region( debug_info_t data, unsigned int page )1.35 {1.36 uint32_t i, posn, next;1.37 - uint16_t op;1.38 char buf[80];1.39 char addr[10];1.40 char opcode[16] = "";1.41 @@ -156,7 +158,6 @@1.42 for( i=from; i<to; i = next ) {1.43 next = data->cpu->disasm_func( i, buf, sizeof(buf), opcode );1.44 sprintf( addr, "%08X", i );1.45 - op = sh4_read_phys_word(i);1.46 posn = gtk_clist_append( data->disasm_list, arr );1.47 if( buf[0] == '?' )1.48 gtk_clist_set_foreground( data->disasm_list, posn, &clrWarn );1.49 @@ -227,6 +228,7 @@1.50 if( strcmp( data->cpu_list[i]->name, cpu ) == 0 ) {1.51 if( data->cpu != data->cpu_list[i] ) {1.52 data->cpu = data->cpu_list[i];1.53 + data->disasm_from = data->disasm_to = -1; /* Force reload */1.54 set_disassembly_pc( data, *data->cpu->pc, FALSE );1.55 init_register_list( data );1.56 update_icount( data );1.57 @@ -288,8 +290,14 @@1.58 if( ptr == NULL )1.59 data = main_debug;1.60 else data = (debug_info_t)ptr;1.61 + va_start(ap, msg);1.63 - va_start(ap, msg);1.64 + if( data == NULL ) {1.65 + vfprintf( stderr, msg, ap );1.66 + va_end(ap);1.67 + return;1.68 + }1.69 +1.70 p = g_strdup_vprintf( msg, ap );1.71 strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );1.72 sprintf( addr, "%08X", *data->cpu->pc );
.