diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-09-16 23:45:46 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-09-16 23:45:46 +0000 |
commit | ca0622e7e0e42f223eb2ca79d634c91bf514502b (patch) | |
tree | c14890437eaca1e694a8796eb07f72df736ba9b5 | |
parent | de8c35cfdb6f8dd8eaa87ef4da72d77fae1b9049 (diff) | |
download | gdb-ca0622e7e0e42f223eb2ca79d634c91bf514502b.zip gdb-ca0622e7e0e42f223eb2ca79d634c91bf514502b.tar.gz gdb-ca0622e7e0e42f223eb2ca79d634c91bf514502b.tar.bz2 |
* remote-udi.c, remote-adapt.c, remote-mm.c: Move processor_type
to tm-a29k.h and a29k-tdep.c and make it an enum.
* a29k-tdep.c (a29k_get_processor_type): New function. Fix many
aspects of how we detected the processor type.
* remote-udi.c, remote-adapt.c, remote-mm.c (*_open): Call it
rather than figuring out the type ourselves.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/a29k-tdep.c | 44 | ||||
-rw-r--r-- | gdb/config/a29k/tm-a29k.h | 11 | ||||
-rw-r--r-- | gdb/remote-adapt.c | 34 | ||||
-rw-r--r-- | gdb/remote-mm.c | 33 | ||||
-rw-r--r-- | gdb/remote-udi.c | 43 |
6 files changed, 79 insertions, 95 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c0e0d69..b0902ad 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -8,6 +8,15 @@ Thu Sep 16 12:34:01 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) * dbxread.c (copy_pending): Deal with END NULL. (process_one_symbol): Add comments about what common_block NULL means. +Wed Sep 15 14:50:26 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) + + * remote-udi.c, remote-adapt.c, remote-mm.c: Move processor_type + to tm-a29k.h and a29k-tdep.c and make it an enum. + * a29k-tdep.c (a29k_get_processor_type): New function. Fix many + aspects of how we detected the processor type. + * remote-udi.c, remote-adapt.c, remote-mm.c (*_open): Call it + rather than figuring out the type ourselves. + Thu Sep 16 12:12:59 1993 Stu Grossman (grossman at cygnus.com) * sparc-stub.c (_trap_low): Do restore/save sequence after diff --git a/gdb/a29k-tdep.c b/gdb/a29k-tdep.c index 4b5fa93..f5843b4 100644 --- a/gdb/a29k-tdep.c +++ b/gdb/a29k-tdep.c @@ -817,6 +817,50 @@ push_dummy_frame () write_register (lrnum, read_register (NPC_REGNUM)); } +enum a29k_processor_types processor_type = a29k_unknown; + +void +a29k_get_processor_type () +{ + unsigned int cfg_reg = (unsigned int) read_register (CFG_REGNUM); + + /* Most of these don't have freeze mode. */ + processor_type = a29k_no_freeze_mode; + + switch ((cfg_reg >> 28) & 0xf) + { + case 0: + fprintf_filtered (stderr, "Remote debugging an Am29000"); + break; + case 1: + fprintf_filtered (stderr, "Remote debugging an Am29005"); + break; + case 2: + fprintf_filtered (stderr, "Remote debugging an Am29050"); + processor_type = a29k_freeze_mode; + break; + case 3: + fprintf_filtered (stderr, "Remote debugging an Am29035"); + break; + case 4: + fprintf_filtered (stderr, "Remote debugging an Am29030"); + break; + case 5: + fprintf_filtered (stderr, "Remote debugging an Am2920*"); + break; + case 6: + fprintf_filtered (stderr, "Remote debugging an Am2924*"); + break; + case 7: + fprintf_filtered (stderr, "Remote debugging an Am29040"); + break; + default: + fprintf_filtered (stderr, "Remote debugging an unknown Am29k\n"); + /* Don't bother to print the revision. */ + return; + } + fprintf_filtered (stderr, " revision %c\n", 'A' + ((cfg_reg >> 24) & 0x0f)); +} void _initialize_29k() diff --git a/gdb/config/a29k/tm-a29k.h b/gdb/config/a29k/tm-a29k.h index 9306c96..0b027be 100644 --- a/gdb/config/a29k/tm-a29k.h +++ b/gdb/config/a29k/tm-a29k.h @@ -715,3 +715,14 @@ extern void pop_frame (); "Invalid register number %d in symbol table entry for %s\n", \ (num), SYMBOL_SOURCE_NAME (sym)), (num) \ : (num)) + +extern enum a29k_processor_types { + a29k_unknown, + + /* Bit 0x400 of the CPS does *not* identify freeze mode, i.e. 29000, + 29030, etc. */ + a29k_no_freeze_mode, + + /* Bit 0x400 of the CPS does identify freeze mode, i.e. 29050. */ + a29k_freeze_mode +} processor_type; diff --git a/gdb/remote-adapt.c b/gdb/remote-adapt.c index ff07b4b..575bb6f 100644 --- a/gdb/remote-adapt.c +++ b/gdb/remote-adapt.c @@ -54,23 +54,13 @@ static void adapt_store_registers (); static void adapt_close (); static int adapt_clear_breakpoints(); -/* - * Processor types. It is assumed that the adapt has the correct - * ROM for the given processor. - */ -#define TYPE_UNKNOWN 0 -#define TYPE_A29000 1 -#define TYPE_A29030 2 -#define TYPE_A29050 3 -static char *processor_name[] = { "Unknown", "A29000", "A29030", "A29050" }; -static int processor_type=TYPE_UNKNOWN; - #define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400) -#define USE_SHADOW_PC ((processor_type == TYPE_A29050) && FREEZE_MODE) +#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) /* Can't seem to get binary coff working */ #define ASCII_COFF /* Adapt will be downloaded with ascii coff */ +/* FIXME: Replace with `set remotedebug'. */ #define LOG_FILE "adapt.log" #if defined (LOG_FILE) FILE *log_file=NULL; @@ -570,28 +560,12 @@ the baud rate, and the name of the program to run on the remote system."); /* Clear any break points */ adapt_clear_breakpoints(); - /* Determine the processor revision level */ - prl = (unsigned int)read_register(CFG_REGNUM) >> 24; - if (prl == 0x03) { - processor_type = TYPE_A29000; - } else if ((prl&0xf0) == 0x40) { /* 29030 = 0x4* */ - processor_type = TYPE_A29030; - fprintf_filtered(stderr,"WARNING: debugging of A29030 not tested.\n"); - } else if ((prl&0xf0) == 0x20) { /* 29050 = 0x2* */ - processor_type = TYPE_A29050; - fprintf_filtered(stderr,"WARNING: debugging of A29050 not tested.\n"); - } else { - processor_type = TYPE_UNKNOWN; - fprintf_filtered(stderr,"WARNING: processor type unknown.\n"); - } - /* Print out some stuff, letting the user now what's going on */ - printf_filtered("Remote debugging on an %s connect to an Adapt via %s.\n", - processor_name[processor_type],dev_name); + printf_filtered("Connected to an Adapt via %s.\n", dev_name); /* FIXME: can this restriction be removed? */ printf_filtered("Remote debugging using virtual addresses works only\n"); printf_filtered("\twhen virtual addresses map 1:1 to physical addresses.\n"); - if (processor_type != TYPE_A29050) { + if (processor_type != a29k_freeze_mode) { fprintf_filtered(stderr, "Freeze-mode debugging not available, and can only be done on an A29050.\n"); } diff --git a/gdb/remote-mm.c b/gdb/remote-mm.c index 58a4653..3387ee5 100644 --- a/gdb/remote-mm.c +++ b/gdb/remote-mm.c @@ -62,18 +62,10 @@ static int expect_msg(); static void init_target_mm(); static int mm_memory_space(); -/* - * Processor types. - */ -#define TYPE_UNKNOWN 0 -#define TYPE_A29000 1 -#define TYPE_A29030 2 -#define TYPE_A29050 3 -static char *processor_name[] = { "Unknown", "A29000", "A29030", "A29050" }; -static int processor_type=TYPE_UNKNOWN; #define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400) -#define USE_SHADOW_PC ((processor_type == TYPE_A29050) && FREEZE_MODE) +#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) +/* FIXME: Replace with `set remotedebug'. */ #define LLOG_FILE "minimon.log" #if defined (LOG_FILE) FILE *log_file; @@ -344,30 +336,15 @@ erroid: expect_msg(CONFIG,in_msg_buf,1); - /* Determine the processor revision level */ - /* FIXME: this code is the same as in remote-adapt.c */ - prl = (unsigned int)read_register(CFG_REGNUM) >> 24; - if (prl == 0x03) { - processor_type = TYPE_A29000; - } else if ((prl&0xf0) == 0x40) { /* 29030 = 0x4* */ - processor_type = TYPE_A29030; - fprintf_filtered(stderr,"WARNING: debugging of A29030 not tested.\n"); - } else if ((prl&0xf0) == 0x20) { /* 29050 = 0x2* */ - processor_type = TYPE_A29050; - fprintf_filtered(stderr,"WARNING: debugging of A29050 not tested.\n"); - } else { - processor_type = TYPE_UNKNOWN; - fprintf_filtered(stderr,"WARNING: processor type unknown.\n"); - } + a29k_get_processor_type (); /* Print out some stuff, letting the user now what's going on */ - printf_filtered("Remote debugging on an %s connect to MiniMon via %s.\n", - processor_name[processor_type],dev_name); + printf_filtered("Connected to MiniMon via %s.\n", dev_name); /* FIXME: can this restriction be removed? */ printf_filtered("Remote debugging using virtual addresses works only\n"); printf_filtered("\twhen virtual addresses map 1:1 to physical addresses.\n") ; - if (processor_type != TYPE_A29050) { + if (processor_type != a29k_freeze_mode) { fprintf_filtered(stderr, "Freeze-mode debugging not available, and can only be done on an A29050.\n"); } diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c index f74569b..e04225a 100644 --- a/gdb/remote-udi.c +++ b/gdb/remote-udi.c @@ -68,18 +68,11 @@ static int udi_read_inferior_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len)); static void download PARAMS ((char *load_arg_string, int from_tty)); char CoffFileName[100] = ""; -/* - * Processor types. - */ -#define TYPE_UNKNOWN 0 -#define TYPE_A29000 1 -#define TYPE_A29030 2 -#define TYPE_A29050 3 -static char *processor_name[] = { "Unknown", "Am29000", "Am29030", "Am29050" }; -static int processor_type=TYPE_UNKNOWN; + #define FREEZE_MODE (read_register(CPS_REGNUM) & 0x400) -#define USE_SHADOW_PC ((processor_type == TYPE_A29050) && FREEZE_MODE) +#define USE_SHADOW_PC ((processor_type == a29k_freeze_mode) && FREEZE_MODE) +/* FIXME: Replace with `set remotedebug'. Also, seems not to be used. */ #define LLOG_FILE "udi.log" #if defined (LOG_FILE) FILE *log_file; @@ -273,31 +266,8 @@ udi_open (name, from_tty) } } - /* Determine the processor revision level */ - prl = (unsigned int)read_register (CFG_REGNUM) >> 24; - if ((prl&0xe0) == 0) - { - fprintf_filtered (stderr, - "Remote debugging Am29000 rev %c\n",'A'+(prl&0x1f)); - processor_type = TYPE_A29000; - } - else if ((prl&0xe0) == 0x40) /* 29030 = 0x4* */ - { - fprintf_filtered (stderr, - "Remote debugging Am2903* rev %c\n",'A'+(prl&0x1f)); - processor_type = TYPE_A29030; - } - else if ((prl&0xe0) == 0x20) /* 29050 = 0x2* */ - { - fprintf_filtered (stderr, - "Remote debugging Am29050 rev %c\n",'A'+(prl&0x1f)); - processor_type = TYPE_A29050; - } - else - { - processor_type = TYPE_UNKNOWN; - fprintf_filtered (stderr,"WARNING: processor type unknown.\n"); - } + a29k_get_processor_type (); + if (UDICreateProcess (&PId)) fprintf(stderr, "UDICreateProcess() failed\n"); @@ -307,9 +277,8 @@ udi_open (name, from_tty) error ("UDICapabilities() failed"); if (from_tty) { - printf_filtered ("Remote debugging an %s connected via UDI socket,\n\ + printf_filtered ("Connected via UDI socket,\n\ DFE-IPC version %x.%x.%x TIP-IPC version %x.%x.%x TIP version %x.%x.%x\n %s\n", - processor_name[processor_type], (DFEIPCId>>8)&0xf, (DFEIPCId>>4)&0xf, DFEIPCId&0xf, (TIPIPCId>>8)&0xf, (TIPIPCId>>4)&0xf, TIPIPCId&0xf, (TargetId>>8)&0xf, (TargetId>>4)&0xf, TargetId&0xf, |