From: Stan Shebs Date: Fri, 8 Mar 1996 02:04:19 +0000 (+0000) Subject: * infcmd.c (do_registers_info): Ignore anonymous registers. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00dd4fd9ad7d8ad1847f7b51740cc6fb2a0f5bb5;p=binutils-gdb.git * infcmd.c (do_registers_info): Ignore anonymous registers. * sh-tdep.c (set processor): New command to set specific processor type. (sh_reg_names, sh3_reg_names): Arrays of register names for SH and SH3 processors. (sh_set_processor_type): New function. * sh3-rom.c (sh3_open): Call it. (sh3_regname): Add names of all the bank registers. (sh3_supply_register): Clean up formatting. * config/sh/tm-sh.h (NUM_REGS, NUM_REALREGS): Increase to include bank registers. (REGISTER_NAMES): Add names of bank registers. (FP15_REGNUM): Define. (REGISTER_VIRTUAL_TYPE): Use it. * monitor.c: Clean up some comments. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 003e8412095..3449d399608 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +Thu Mar 7 17:40:50 1996 Stan Shebs + + * infcmd.c (do_registers_info): Ignore anonymous registers. + * sh-tdep.c (set processor): New command to set specific + processor type. + (sh_reg_names, sh3_reg_names): Arrays of register names for + SH and SH3 processors. + (sh_set_processor_type): New function. + * sh3-rom.c (sh3_open): Call it. + (sh3_regname): Add names of all the bank registers. + (sh3_supply_register): Clean up formatting. + * config/sh/tm-sh.h (NUM_REGS, NUM_REALREGS): Increase to include + bank registers. + (REGISTER_NAMES): Add names of bank registers. + (FP15_REGNUM): Define. + (REGISTER_VIRTUAL_TYPE): Use it. + * monitor.c: Clean up some comments. + Thu Mar 7 12:09:51 1996 J.T. Conklin * i386b-nat.c: Revert part of Mar 5 change. FreeBSD collapsed the @@ -12,7 +30,7 @@ Wed Mar 6 17:57:59 1996 Jeffrey A Law (law@cygnus.com) * breakpoint.c (bfd_lookup_symbol): Provide for all SVR4 systems, not just those with HANDLE_SVR4_EXEC_EMULATORS. - * From Peter Schauer: + From Peter Schauer: * breakpoint.c (internal_breakpoint_number): Move to file scope. (create_solib_event_breakpoint): Use an internal breakpoint number. diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h index 0b3d92f9108..0a57192bec9 100644 --- a/gdb/config/sh/tm-sh.h +++ b/gdb/config/sh/tm-sh.h @@ -1,4 +1,4 @@ -/* Parameters for execution on a Hitachi Super-H machine. +/* Target-specific definition for a Hitachi Super-H. Copyright (C) 1993 Free Software Foundation, Inc. This file is part of GDB. @@ -99,7 +99,7 @@ extern CORE_ADDR sh_skip_prologue (); of data in register N. */ #define REGISTER_VIRTUAL_TYPE(N) \ - ((((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) \ + ((((N) >= FP0_REGNUM && (N) < FP15_REGNUM) \ || (N) == FPUL_REGNUM) \ ? builtin_type_float : builtin_type_int) @@ -107,14 +107,17 @@ extern CORE_ADDR sh_skip_prologue (); Entries beyond the first NUM_REGS are ignored. */ #define REGISTER_NAMES \ - {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "r8", "r9", "r10","r11","r12","r13","r14","r15",\ - "pc", "pr","gbr","vbr","mach","macl", "sr", "fpul", "fpscr", \ + {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "r8", "r9", "r10","r11","r12", "r13", "r14","r15",\ + "pc", "pr", "gbr","vbr","mach","macl","sr", \ + "fpul","fpscr", \ "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", \ "fr8", "fr9", "fr10","fr11","fr12","fr13","fr14","fr15",\ + "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", \ + "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1" \ } -#define NUM_REGS 41 +#define NUM_REGS 57 /* Register numbers of various important registers. Note that some of these values are "real" register numbers, @@ -136,8 +139,9 @@ extern CORE_ADDR sh_skip_prologue (); #define NUM_REALREGS 23 #define FPUL_REGNUM 23 #define FP0_REGNUM 25 +#define FP15_REGNUM 41 #undef NUM_REALREGS -#define NUM_REALREGS 41 +#define NUM_REALREGS 57 /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 9e677aef515..7847f33fb34 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -977,6 +977,11 @@ do_registers_info (regnum, fpregs) continue; } + /* If the register name is empty, it is undefined for this + processor, so don't display anything. */ + if (reg_names[i] == NULL || *(reg_names[i]) == '\0') + continue; + fputs_filtered (reg_names[i], gdb_stdout); print_spaces_filtered (15 - strlen (reg_names[i]), gdb_stdout); @@ -1132,7 +1137,7 @@ attach_command (args, from_tty) char *args; int from_tty; { - extern int auto_solib_add_at_startup; + extern int auto_solib_add; dont_repeat (); /* Not for the faint of heart */ @@ -1167,7 +1172,7 @@ attach_command (args, from_tty) #endif #ifdef SOLIB_ADD - if (auto_solib_add_at_startup) + if (auto_solib_add) /* Add shared library symbols from the newly attached process, if any. */ SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0); #endif diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index a56c826e9fb..20885ecd605 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1,5 +1,5 @@ /* Target-dependent code for Hitachi Super-H, for GDB. - Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -32,6 +32,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "value.h" #include "dis-asm.h" +/* Default to the original SH. */ + +#define DEFAULT_SH_TYPE "sh" + +/* This value is the model of SH in use. */ + +char *sh_processor_type; + +char *tmp_sh_processor_type; + +/* A set of original names, to be used when restoring back to generic + registers from a specific set. */ + +char *sh_generic_reg_names[] = REGISTER_NAMES; + +char *sh_reg_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach","macl", "sr", + "fpul", "fpscr", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "" +}; + +char *sh3_reg_names[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", + "pc", "pr", "gbr", "vbr", "mach","macl","sr", + "fpul", "fpscr", + "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10","fr11","fr12","fr13","fr14","fr15", + "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", + "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1" +}; + +struct { + char *name; + char **regnames; +} sh_processor_type_table[] = { + { "sh", sh_reg_names }, + { "sh3", sh3_reg_names }, + { NULL, NULL } +}; + /* Prologue looks like [mov.l ,@-r15]... [sts.l pr,@-r15] @@ -264,6 +310,74 @@ pop_frame () flush_cached_frames (); } +/* Command to set the processor type. */ + +void +sh_set_processor_type_command (args, from_tty) + char *args; + int from_tty; +{ + int i; + char *temp; + + /* The `set' commands work by setting the value, then calling the hook, + so we let the general command modify a scratch location, then decide + here if we really want to modify the processor type. */ + if (tmp_sh_processor_type == NULL || *tmp_sh_processor_type == '\0') + { + printf_unfiltered ("The known SH processor types are as follows:\n\n"); + for (i = 0; sh_processor_type_table[i].name != NULL; ++i) + printf_unfiltered ("%s\n", sh_processor_type_table[i].name); + + /* Restore the value. */ + tmp_sh_processor_type = strsave (sh_processor_type); + + return; + } + + if (!sh_set_processor_type (tmp_sh_processor_type)) + { + /* Restore to a valid value before erroring out. */ + temp = tmp_sh_processor_type; + tmp_sh_processor_type = strsave (sh_processor_type); + error ("Unknown processor type `%s'.", temp); + } +} + +static void +sh_show_processor_type_command (args, from_tty) + char *args; + int from_tty; +{ +} + +/* Modify the actual processor type. */ + +int +sh_set_processor_type (str) + char *str; +{ + int i, j; + + if (str == NULL) + return 0; + + for (i = 0; sh_processor_type_table[i].name != NULL; ++i) + { + if (strcasecmp (str, sh_processor_type_table[i].name) == 0) + { + sh_processor_type = str; + + for (j = 0; j < NUM_REGS; ++j) + reg_names[j] = sh_processor_type_table[i].regnames[j]; + + return 1; + } + } + + return 0; +} + /* Print the registers in a form similar to the E7000 */ static void @@ -301,7 +415,22 @@ show_regs (args, from_tty) void _initialize_sh_tdep () { + struct cmd_list_element *c; + tm_print_insn = gdb_print_insn_sh; + c = add_set_cmd ("processor", class_support, var_string_noescape, + (char *) &tmp_sh_processor_type, + "Set the type of SH processor in use.\n\ +Set this to be able to access processor-type-specific registers.\n\ +", + &setlist); + c->function.cfunc = sh_set_processor_type_command; + c = add_show_from_set (c, &showlist); + c->function.cfunc = sh_show_processor_type_command; + + tmp_sh_processor_type = strsave (DEFAULT_SH_TYPE); + sh_set_processor_type_command (strsave (DEFAULT_SH_TYPE), 0); + add_com ("regs", class_vars, show_regs, "Print all registers"); } diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c index 315a8c5543e..b5d77e514d8 100644 --- a/gdb/sh3-rom.c +++ b/gdb/sh3-rom.c @@ -43,64 +43,72 @@ sh3_supply_register (regname, regnamelen, val, vallen) regno = -1; if (regnamelen == 2) - switch (regname[0]) - { - case 'S': - if (regname[1] == 'R') - regno = SR_REGNUM; - break; - case 'P': - if (regname[1] == 'C') - regno = PC_REGNUM; - else if (regname[1] == 'R') - regno = PR_REGNUM; - break; - } + { + switch (regname[0]) + { + case 'S': + if (regname[1] == 'R') + regno = SR_REGNUM; + break; + case 'P': + if (regname[1] == 'C') + regno = PC_REGNUM; + else if (regname[1] == 'R') + regno = PR_REGNUM; + break; + } + } else if (regnamelen == 3) - switch (regname[0]) - { - case 'G': - case 'V': - if (regname[1] == 'B' && regname[2] == 'R') - if (regname[0] == 'G') - regno = VBR_REGNUM; - else - regno = GBR_REGNUM; - break; + { + switch (regname[0]) + { + case 'G': + case 'V': + if (regname[1] == 'B' && regname[2] == 'R') + if (regname[0] == 'G') + regno = VBR_REGNUM; + else + regno = GBR_REGNUM; + break; #if 0 - case 'S': - if (regname[1] == 'S' && regname[2] == 'R') - regno = SSR_REGNUM; - else if (regname[1] == 'P' && regname[2] == 'C') - regno = SPC_REGNUM; - break; + case 'S': + if (regname[1] == 'S' && regname[2] == 'R') + regno = SSR_REGNUM; + else if (regname[1] == 'P' && regname[2] == 'C') + regno = SPC_REGNUM; + break; #endif - } + } + } else if (regnamelen == 4) - switch (regname[0]) - { - case 'M': - if (regname[1] == 'A' && regname[2] == 'C') - if (regname[3] == 'H') - regno = MACH_REGNUM; - else if (regname[3] == 'L') - regno = MACL_REGNUM; - break; - case 'R': - if (regname[1] == '0' && regname[2] == '-' && regname[3] == '7') - { - regno = R0_REGNUM; - numregs = 8; - } - } + { + switch (regname[0]) + { + case 'M': + if (regname[1] == 'A' && regname[2] == 'C') + if (regname[3] == 'H') + regno = MACH_REGNUM; + else if (regname[3] == 'L') + regno = MACL_REGNUM; + break; + case 'R': + if (regname[1] == '0' && regname[2] == '-' && regname[3] == '7') + { + regno = R0_REGNUM; + numregs = 8; + } + } + } else if (regnamelen == 5) - if (regname[1] == '8' && regname[2] == '-' && regname[3] == '1' - && regname[4] =='5') - { - regno = R0_REGNUM + 8; - numregs = 8; - } - + { + if (regname[1] == '8' && regname[2] == '-' && regname[3] == '1' + && regname[4] =='5') + { + regno = R0_REGNUM + 8; + numregs = 8; + } + } + if (regno >= 0) while (numregs-- > 0) val = monitor_supply_register (regno++, val); @@ -139,10 +147,17 @@ sh3_load (desc, file, hashmark) either. So, typing "info reg sp" becomes a "r30". */ static char *sh3_regnames[NUM_REGS] = { - "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", - "R8", "R9", "R10","R11","R12","R13","R14","R15", - "PC", "PR", "GBR","VBR","MACH","MACL","SR",NULL, - NULL, NULL, NULL, NULL}; + "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", + "R8", "R9", "R10", "R11","R12", "R13", "R14", "R15", + "PC", "PR", "GBR", "VBR","MACH","MACL", "SR", + NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "R0_BANK0", "R1_BANK0", "R2_BANK0", "R3_BANK0", + "R4_BANK0", "R5_BANK0", "R6_BANK0", "R7_BANK0", + "R0_BANK1", "R1_BANK1", "R2_BANK1", "R3_BANK1", + "R4_BANK1", "R5_BANK1", "R6_BANK1", "R7_BANK1" +}; /* Define the monitor command strings. Since these are passed directly through to a printf style function, we may include formatting @@ -217,9 +232,10 @@ sh3_open (args, from_tty) { char *serial_port_name = args; char *parallel_port_name = 0; + if (args) { - char *cursor = serial_port_name = strsave (args); + char *cursor = serial_port_name = strsave (args); while (*cursor && *cursor != ' ') cursor++; @@ -239,12 +255,15 @@ sh3_open (args, from_tty) if (parallel_port_name) { parallel = SERIAL_OPEN (parallel_port_name); + if (!parallel) - { - perror_with_name ("Unable to open parallel port."); - } + perror_with_name ("Unable to open parallel port."); + parallel_in_use = 1; } + + /* If we connected successfully, we know the processor is an SH3. */ + sh_set_processor_type ("sh3"); }