Search
lxdream.org :: lxdream :: r392:39e596b3b6dd
lxdream 0.9.1
released Jun 29
Download Now
changeset392:39e596b3b6dd
parent391:16afb90b5d47
child393:5e5335b61373
authornkeynes
dateTue Sep 18 10:48:57 2007 +0000 (16 years ago)
Remove debugger from default startup - now only shown if started with -D
src/gui/debug_win.c
src/gui/gui.c
src/gui/gui.h
src/main.c
1.1 --- a/src/gui/debug_win.c Tue Sep 18 09:14:20 2007 +0000
1.2 +++ b/src/gui/debug_win.c Tue Sep 18 10:48:57 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: debug_win.c,v 1.19 2006-05-15 08:28:52 nkeynes Exp $
1.6 + * $Id: debug_win.c,v 1.20 2007-09-18 10:48:57 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 @@ -19,6 +19,7 @@
1.11 #include <stdio.h>
1.12 #include <gnome.h>
1.13 #include <math.h>
1.14 +#include "sh4/sh4dasm.h"
1.15 #include "gui/gui.h"
1.16 #include "mem.h"
1.17 #include "cpu.h"
1.18 @@ -26,6 +27,7 @@
1.19
1.20 GdkColor *msg_colors[] = { &clrError, &clrError, &clrWarn, &clrNormal,
1.21 &clrDebug, &clrTrace };
1.22 +char *msg_levels[] = { "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE" };
1.23
1.24 void init_register_list( debug_info_t data );
1.25
1.26 @@ -34,7 +36,7 @@
1.27 int disasm_to;
1.28 int disasm_pc;
1.29 struct cpu_desc_struct *cpu;
1.30 - struct cpu_desc_struct **cpu_list;
1.31 + const cpu_desc_t *cpu_list;
1.32 GtkCList *msgs_list;
1.33 GtkCList *regs_list;
1.34 GtkCList *disasm_list;
1.35 @@ -130,9 +132,11 @@
1.36
1.37 void update_icount( debug_info_t data )
1.38 {
1.39 - // sprintf( data->icounter_text, "%d", *data->cpu->icount );
1.40 - sprintf( data->icounter_text, "%d", pvr2_get_frame_count() );
1.41 - gtk_progress_bar_set_text( data->icounter, data->icounter_text );
1.42 + if( data != NULL ) {
1.43 + // sprintf( data->icounter_text, "%d", *data->cpu->icount );
1.44 + sprintf( data->icounter_text, "%d", pvr2_get_frame_count() );
1.45 + gtk_progress_bar_set_text( data->icounter, data->icounter_text );
1.46 + }
1.47 }
1.48
1.49 void set_disassembly_region( debug_info_t data, unsigned int page )
1.50 @@ -292,7 +296,10 @@
1.51 else data = (debug_info_t)ptr;
1.52 va_start(ap, msg);
1.53
1.54 + strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );
1.55 +
1.56 if( data == NULL ) {
1.57 + fprintf( stderr, "%s %08X %-5s ", buf, *sh4_cpu_desc.pc, msg_levels[level] );
1.58 vfprintf( stderr, msg, ap );
1.59 fprintf( stderr, "\n" );
1.60 va_end(ap);
1.61 @@ -300,7 +307,6 @@
1.62 }
1.63
1.64 p = g_strdup_vprintf( msg, ap );
1.65 - strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );
1.66 sprintf( addr, "%08X", *data->cpu->pc );
1.67 arr[3] = p;
1.68 posn = gtk_clist_append(data->msgs_list, arr);
1.69 @@ -333,8 +339,10 @@
1.70
1.71 void debug_win_set_running( debug_info_t data, gboolean isRunning )
1.72 {
1.73 - debug_win_enable_widget( data, "stop_btn", isRunning );
1.74 - debug_win_enable_widget( data, "step_btn", !isRunning );
1.75 - debug_win_enable_widget( data, "run_btn", !isRunning );
1.76 - debug_win_enable_widget( data, "runto_btn", !isRunning );
1.77 + if( data != NULL ) {
1.78 + debug_win_enable_widget( data, "stop_btn", isRunning );
1.79 + debug_win_enable_widget( data, "step_btn", !isRunning );
1.80 + debug_win_enable_widget( data, "run_btn", !isRunning );
1.81 + debug_win_enable_widget( data, "runto_btn", !isRunning );
1.82 + }
1.83 }
2.1 --- a/src/gui/gui.c Tue Sep 18 09:14:20 2007 +0000
2.2 +++ b/src/gui/gui.c Tue Sep 18 10:48:57 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: gui.c,v 1.13 2007-01-11 12:15:36 nkeynes Exp $
2.6 + * $Id: gui.c,v 1.14 2007-09-18 10:48:57 nkeynes Exp $
2.7 *
2.8 * Top-level GUI (GTK2) module.
2.9 *
2.10 @@ -33,8 +33,7 @@
2.11 GdkColor clrBreak, clrTempBreak, clrWhite;
2.12 PangoFontDescription *fixed_list_font;
2.13
2.14 -debug_info_t main_debug;
2.15 -
2.16 +debug_info_t main_debug = NULL;
2.17
2.18 void open_file_callback(GtkWidget *btn, gint result, gpointer user_data);
2.19
2.20 @@ -55,7 +54,6 @@
2.21
2.22 void gtk_gui_init() {
2.23 GdkColormap *map;
2.24 - GtkWidget *debug_win;
2.25
2.26 clrNormal.red = clrNormal.green = clrNormal.blue = 0;
2.27 clrChanged.red = clrChanged.green = 64*256;
2.28 @@ -88,13 +86,16 @@
2.29 gdk_colormap_alloc_color(map, &clrTempBreak, TRUE, TRUE);
2.30 gdk_colormap_alloc_color(map, &clrWhite, TRUE, TRUE);
2.31 fixed_list_font = pango_font_description_from_string("Courier 10");
2.32 - debug_win = create_debug_win ();
2.33 +}
2.34 +
2.35 +void gtk_gui_show_debugger()
2.36 +{
2.37 + GtkWidget *debug_win = create_debug_win ();
2.38 main_debug = init_debug_win(debug_win, cpu_descs);
2.39 init_mmr_win();
2.40
2.41 gtk_widget_show (debug_win);
2.42 -
2.43 -}
2.44 +}
2.45
2.46 /**
2.47 * Hook called when DC starts running. Just disables the run/step buttons
2.48 @@ -130,12 +131,12 @@
2.49 }
2.50
2.51 void gtk_gui_update(void) {
2.52 - if( main_debug == NULL )
2.53 - return;
2.54 - update_registers(main_debug);
2.55 - update_icount(main_debug);
2.56 - update_mmr_win();
2.57 - dump_win_update_all();
2.58 + if( main_debug != NULL ) {
2.59 + update_registers(main_debug);
2.60 + update_icount(main_debug);
2.61 + update_mmr_win();
2.62 + dump_win_update_all();
2.63 + }
2.64 }
2.65
2.66 void open_file_callback(GtkWidget *btn, gint result, gpointer user_data) {
3.1 --- a/src/gui/gui.h Tue Sep 18 09:14:20 2007 +0000
3.2 +++ b/src/gui/gui.h Tue Sep 18 10:48:57 2007 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: gui.h,v 1.15 2006-06-19 11:00:42 nkeynes Exp $
3.6 + * $Id: gui.h,v 1.16 2007-09-18 10:48:57 nkeynes Exp $
3.7 *
3.8 * General GUI definitions
3.9 *
3.10 @@ -32,6 +32,7 @@
3.11 #endif
3.12
3.13 void gtk_gui_init(void);
3.14 +void gtk_gui_show_debugger(void);
3.15 void gtk_gui_update(void);
3.16 extern struct dreamcast_module gtk_gui_module;
3.17
4.1 --- a/src/main.c Tue Sep 18 09:14:20 2007 +0000
4.2 +++ b/src/main.c Tue Sep 18 10:48:57 2007 +0000
4.3 @@ -1,5 +1,5 @@
4.4 /**
4.5 - * $Id: main.c,v 1.23 2007-09-12 09:21:01 nkeynes Exp $
4.6 + * $Id: main.c,v 1.24 2007-09-18 10:48:57 nkeynes Exp $
4.7 *
4.8 * Main program, initializes dreamcast and gui, then passes control off to
4.9 * the gtk main loop (currently).
4.10 @@ -35,7 +35,7 @@
4.11
4.12 #define S3M_PLAYER "s3mplay.bin"
4.13
4.14 -char *option_list = "a:s:A:V:puhbd:c:t:x";
4.15 +char *option_list = "a:s:A:V:puhbd:c:t:xD";
4.16 struct option longopts[1] = { { NULL, 0, 0, 0 } };
4.17 char *aica_program = NULL;
4.18 char *s3m_file = NULL;
4.19 @@ -47,6 +47,7 @@
4.20 gboolean headless = FALSE;
4.21 gboolean without_bios = FALSE;
4.22 gboolean use_xlat = FALSE;
4.23 +gboolean show_debugger = FALSE;
4.24 uint32_t time_secs = 0;
4.25 uint32_t time_nanos = 0;
4.26
4.27 @@ -78,6 +79,9 @@
4.28 case 'd': /* Mount disc */
4.29 disc_file = optarg;
4.30 break;
4.31 + case 'D': /* Launch w/ debugger */
4.32 + show_debugger = TRUE;
4.33 + break;
4.34 case 's': /* AICA-only w/ S3M player */
4.35 aica_program = S3M_PLAYER;
4.36 s3m_file = optarg;
4.37 @@ -118,6 +122,9 @@
4.38 gnome_init ("lxdream", VERSION, argc, argv);
4.39 dreamcast_init();
4.40 dreamcast_register_module( &gtk_gui_module );
4.41 + if( show_debugger ) {
4.42 + gtk_gui_show_debugger();
4.43 + }
4.44 } else {
4.45 dreamcast_init();
4.46 }
.