Search
lxdream.org :: lxdream/src/gui/debug_win.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui/debug_win.c
changeset 11:0a82ef380c45
prev10:c898b37506e0
next14:fc481a638848
author nkeynes
date Sun Dec 11 12:00:09 2005 +0000 (15 years ago)
permissions -rw-r--r--
last change Moved arm material under aica/
Hooked arm disasm up
file annotate diff log raw
1.1 --- a/src/gui/debug_win.c Sun Dec 11 05:15:36 2005 +0000
1.2 +++ b/src/gui/debug_win.c Sun Dec 11 12:00:09 2005 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: debug_win.c,v 1.4 2005-12-11 05:15:36 nkeynes Exp $
1.6 + * $Id: debug_win.c,v 1.5 2005-12-11 12:00:03 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 @@ -30,6 +30,7 @@
1.11 int disasm_to;
1.12 int disasm_pc;
1.13 struct cpu_desc_struct *cpu;
1.14 + struct cpu_desc_struct **cpu_list;
1.15 GtkCList *msgs_list;
1.16 GtkCList *regs_list;
1.17 GtkCList *disasm_list;
1.18 @@ -39,31 +40,20 @@
1.19 char saved_regs[0];
1.20 };
1.21
1.22 -debug_info_t init_debug_win(GtkWidget *win, struct cpu_desc_struct *cpu )
1.23 +debug_info_t init_debug_win(GtkWidget *win, struct cpu_desc_struct **cpu_list )
1.24 {
1.25 - int i;
1.26 - char buf[20];
1.27 - char *arr[2];
1.28 GnomeAppBar *appbar;
1.29
1.30 - debug_info_t data = g_malloc0( sizeof(struct debug_info_struct) + cpu->regs_size );
1.31 + debug_info_t data = g_malloc0( sizeof(struct debug_info_struct) + cpu_list[0]->regs_size );
1.32 data->disasm_from = -1;
1.33 data->disasm_to = -1;
1.34 data->disasm_pc = -1;
1.35 - data->cpu = cpu;
1.36 + data->cpu = cpu_list[0];
1.37 + data->cpu_list = cpu_list;
1.38
1.39 data->regs_list= gtk_object_get_data(GTK_OBJECT(win), "reg_list");
1.40 - arr[1] = buf;
1.41 - for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
1.42 - arr[0] = data->cpu->regs_info[i].name;
1.43 - if( data->cpu->regs_info->type == REG_INT )
1.44 - sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info->value) );
1.45 - else
1.46 - sprintf( buf, "%f", *((float *)data->cpu->regs_info->value) );
1.47 - gtk_clist_append( data->regs_list, arr );
1.48 - }
1.49 gtk_widget_modify_font( GTK_WIDGET(data->regs_list), fixed_list_font );
1.50 -
1.51 + init_register_list( data );
1.52 data->msgs_list = gtk_object_get_data(GTK_OBJECT(win), "output_list");
1.53 data->disasm_list = gtk_object_get_data(GTK_OBJECT(win), "disasm_list");
1.54 gtk_clist_set_column_width( data->disasm_list, 1, 16 );
1.55 @@ -77,6 +67,24 @@
1.56 return data;
1.57 }
1.58
1.59 +void init_register_list( debug_info_t data )
1.60 +{
1.61 + int i;
1.62 + char buf[20];
1.63 + char *arr[2];
1.64 +
1.65 + gtk_clist_clear( data->regs_list );
1.66 + arr[1] = buf;
1.67 + for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
1.68 + arr[0] = data->cpu->regs_info[i].name;
1.69 + if( data->cpu->regs_info->type == REG_INT )
1.70 + sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
1.71 + else
1.72 + sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
1.73 + gtk_clist_append( data->regs_list, arr );
1.74 + }
1.75 +}
1.76 +
1.77 /*
1.78 * Check for changed registers and update the display
1.79 */
1.80 @@ -120,11 +128,11 @@
1.81
1.82 void set_disassembly_region( debug_info_t data, unsigned int page )
1.83 {
1.84 - uint32_t i, posn;
1.85 + uint32_t i, posn, next;
1.86 uint16_t op;
1.87 char buf[80];
1.88 char addr[10];
1.89 - char opcode[6] = "";
1.90 + char opcode[16] = "";
1.91 char *arr[4] = { addr, " ", opcode, buf };
1.92 unsigned int from = page & 0xFFFFF000;
1.93 unsigned int to = from + 4096;
1.94 @@ -139,11 +147,10 @@
1.95 gtk_clist_append( data->disasm_list, arr );
1.96 gtk_clist_set_foreground( data->disasm_list, 0, &clrError );
1.97 } else {
1.98 - for( i=from; i<to; ) {
1.99 - i = data->cpu->disasm_func( i, buf, sizeof(buf) );
1.100 + for( i=from; i<to; i = next ) {
1.101 + next = data->cpu->disasm_func( i, buf, sizeof(buf), opcode );
1.102 sprintf( addr, "%08X", i );
1.103 op = sh4_read_phys_word(i);
1.104 - sprintf( opcode, "%02X %02X", op&0xFF, op>>8 );
1.105 posn = gtk_clist_append( data->disasm_list, arr );
1.106 if( buf[0] == '?' )
1.107 gtk_clist_set_foreground( data->disasm_list, posn, &clrWarn );
1.108 @@ -198,8 +205,17 @@
1.109
1.110 void set_disassembly_cpu( debug_info_t data, char *cpu )
1.111 {
1.112 -
1.113 -
1.114 + int i;
1.115 + for( i=0; data->cpu_list[i] != NULL; i++ ) {
1.116 + if( strcmp( data->cpu_list[i]->name, cpu ) == 0 ) {
1.117 + if( data->cpu != data->cpu_list[i] ) {
1.118 + data->cpu = data->cpu_list[i];
1.119 + set_disassembly_region( data, data->disasm_from );
1.120 + init_register_list( data );
1.121 + }
1.122 + return;
1.123 + }
1.124 + }
1.125 }
1.126
1.127 uint32_t row_to_address( debug_info_t data, int row ) {
.