Search
lxdream.org :: lxdream/src/gtkui/gtk_debug.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gtkui/gtk_debug.c
changeset 998:1754a8c6a9cf
prev887:8b3ee741c9d7
next1000:6e4cabe2b32b
author nkeynes
date Tue Mar 24 11:15:57 2009 +0000 (13 years ago)
permissions -rw-r--r--
last change Add preliminary implementation of the GDB remote debugging server - attaches to
either or both the SH4 and ARM
file annotate diff log raw
1.1 --- a/src/gtkui/gtk_debug.c Mon Oct 20 06:11:10 2008 +0000
1.2 +++ b/src/gtkui/gtk_debug.c Tue Mar 24 11:15:57 2009 +0000
1.3 @@ -200,11 +200,16 @@
1.4 arr[1] = buf;
1.5 for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
1.6 arr[0] = data->cpu->regs_info[i].name;
1.7 - if( data->cpu->regs_info->type == REG_INT )
1.8 - sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
1.9 - else
1.10 - sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
1.11 - gtk_clist_append( data->regs_list, arr );
1.12 + void *value = data->cpu->get_register(i);
1.13 + if( value != NULL ) {
1.14 + if( data->cpu->regs_info->type == REG_INT ) {
1.15 + sprintf( buf, "%08X", *((uint32_t *)value) );
1.16 + gtk_clist_append( data->regs_list, arr );
1.17 + } else if( data->cpu->regs_info->type == REG_FLOAT ) {
1.18 + sprintf( buf, "%f", *((float *)value) );
1.19 + gtk_clist_append( data->regs_list, arr );
1.20 + }
1.21 + }
1.22 }
1.23 }
1.24
1.25 @@ -214,27 +219,33 @@
1.26 void debug_window_update( debug_window_t data )
1.27 {
1.28 int i;
1.29 + int posn = 0;
1.30 for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
1.31 - if( data->cpu->regs_info[i].type == REG_INT ) {
1.32 - /* Yes this _is_ probably fairly evil */
1.33 - if( *((uint32_t *)data->cpu->regs_info[i].value) !=
1.34 - *((uint32_t *)((char *)data->saved_regs + ((char *)data->cpu->regs_info[i].value - (char *)data->cpu->regs))) ) {
1.35 - char buf[20];
1.36 - sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
1.37 - gtk_clist_set_text( data->regs_list, i, 1, buf );
1.38 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_changed );
1.39 + void *value = data->cpu->get_register(i);
1.40 + if( value != NULL ) {
1.41 + if( data->cpu->regs_info[i].type == REG_INT ) {
1.42 + /* Yes this _is_ probably fairly evil */
1.43 + if( *((uint32_t *)value) !=
1.44 + *((uint32_t *)((char *)data->saved_regs + ((char *)value - (char *)data->cpu->regs))) ) {
1.45 + char buf[20];
1.46 + sprintf( buf, "%08X", *((uint32_t *)value) );
1.47 + gtk_clist_set_text( data->regs_list, posn, 1, buf );
1.48 + gtk_clist_set_foreground( data->regs_list, posn, &gui_colour_changed );
1.49 + } else {
1.50 + gtk_clist_set_foreground( data->regs_list, posn, &gui_colour_normal );
1.51 + }
1.52 + posn++;
1.53 } else {
1.54 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_normal );
1.55 - }
1.56 - } else {
1.57 - if( *((float *)data->cpu->regs_info[i].value) !=
1.58 - *((float *)((char *)data->saved_regs + ((char *)data->cpu->regs_info[i].value - (char *)data->cpu->regs))) ) {
1.59 - char buf[20];
1.60 - sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
1.61 - gtk_clist_set_text( data->regs_list, i, 1, buf );
1.62 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_changed );
1.63 - } else {
1.64 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_normal );
1.65 + if( *((float *)value) !=
1.66 + *((float *)((char *)data->saved_regs + ((char *)value - (char *)data->cpu->regs))) ) {
1.67 + char buf[20];
1.68 + sprintf( buf, "%f", *((float *)value) );
1.69 + gtk_clist_set_text( data->regs_list, i, posn, buf );
1.70 + gtk_clist_set_foreground( data->regs_list, posn, &gui_colour_changed );
1.71 + } else {
1.72 + gtk_clist_set_foreground( data->regs_list, posn, &gui_colour_normal );
1.73 + }
1.74 + posn++;
1.75 }
1.76 }
1.77 }
.