GNU Binutils with patches for OS216
修订版 | 42a8e64187bd4a88baedc8c3e730b014a8f055ed (tree) |
---|---|
时间 | 2002-06-29 08:19:26 |
作者 | Andrew Cagney <cagney@redh...> |
Commiter | Andrew Cagney |
merge with trunk
@@ -641,7 +641,7 @@ macrotab_h = macrotab.h $(obstack_h) $(bcache_h) | ||
641 | 641 | macroscope_h = macroscope.h $(macrotab_h) $(symtab_h) |
642 | 642 | memattr_h = memattr.h |
643 | 643 | monitor_h = monitor.h |
644 | -objfiles_h = objfiles.h | |
644 | +objfiles_h = objfiles.h $(bcache_h) | |
645 | 645 | parser_defs_h = parser-defs.h $(doublest_h) |
646 | 646 | ppc_tdep_h = ppc-tdep.h osabi.h |
647 | 647 | regcache_h = regcache.h |
@@ -655,7 +655,7 @@ solist_h = solist.h | ||
655 | 655 | source_h = source.h |
656 | 656 | stabsread_h = stabsread.h |
657 | 657 | symfile_h = symfile.h |
658 | -symtab_h = symtab.h $(bcache_h) | |
658 | +symtab_h = symtab.h | |
659 | 659 | target_h = target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h) |
660 | 660 | terminal_h = terminal.h |
661 | 661 | top_h = top.h |
@@ -665,6 +665,7 @@ ui_out_h = ui-out.h | ||
665 | 665 | valprint_h = valprint.h |
666 | 666 | value_h = value.h $(symtab_h) $(gdbtypes_h) $(expression_h) $(doublest_h) |
667 | 667 | varobj_h = varobj.h $(symtab_h) $(gdbtypes_h) |
668 | +vax_tdep_h = vax-tdep.h osabi.h | |
668 | 669 | version_h = version.h |
669 | 670 | wrapper_h = wrapper.h |
670 | 671 | xcoffsolib_h = xcoffsolib.h |
@@ -875,7 +876,7 @@ init.c: $(INIT_FILES) | ||
875 | 876 | -e 's|\([^ ][^ ]*\)|$(srcdir)/\1|g' | \ |
876 | 877 | while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \ |
877 | 878 | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \ |
878 | - ( echo _initialize_gdbtypes ; grep -v -e '^_initialize_gdbtypes$$' ) > init.l-tmp | |
879 | + ( echo _initialize_gdbtypes ; grep -v '^_initialize_gdbtypes$$' ) > init.l-tmp | |
879 | 880 | @echo '/* Do not modify this file. */' >>init.c-tmp |
880 | 881 | @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp |
881 | 882 | @echo '#include "defs.h"' >>init.c-tmp |
@@ -2236,7 +2237,7 @@ values.o: values.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \ | ||
2236 | 2237 | $(gdb_string_h) scm-lang.h $(doublest_h) |
2237 | 2238 | |
2238 | 2239 | vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax.h $(defs_h) $(symtab_h) \ |
2239 | - $(arch_utils_h) $(inferior_h) vax-tdep.h | |
2240 | + $(arch_utils_h) $(inferior_h) $(vax_tdep_h) | |
2240 | 2241 | |
2241 | 2242 | x86-64-linux-tdep.o : x86-64-linux-tdep.c $(defs_h) $(inferior_h) \ |
2242 | 2243 | $(gdbcore_h) $(regcache_h) x86-64-tdep.h i386-tdep.h $(dwarf2cfi_h) |
@@ -76,12 +76,22 @@ abug_supply_register (char *regname, int regnamelen, char *val, int vallen) | ||
76 | 76 | * registers either. So, typing "info reg sp" becomes an "A7". |
77 | 77 | */ |
78 | 78 | |
79 | -static char *abug_regnames[NUM_REGS] = | |
79 | +static const char * | |
80 | +abug_regname (int index) | |
80 | 81 | { |
81 | - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
82 | - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
83 | - "PC", | |
84 | -}; | |
82 | + static char *regnames[] = | |
83 | + { | |
84 | + "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
85 | + "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
86 | + "PC", | |
87 | + }; | |
88 | + | |
89 | + if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) | |
90 | + || (index < 0) || (index >= NUM_REGS)) | |
91 | + return NULL; | |
92 | + else | |
93 | + return regnames[index]; | |
94 | +} | |
85 | 95 | |
86 | 96 | /* |
87 | 97 | * Define the monitor command strings. Since these are passed directly |
@@ -141,7 +151,8 @@ init_abug_cmds (void) | ||
141 | 151 | abug_cmds.cmd_end = NULL; /* optional command terminator */ |
142 | 152 | abug_cmds.target = &abug_ops; /* target operations */ |
143 | 153 | abug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ |
144 | - abug_cmds.regnames = abug_regnames; /* registers names */ | |
154 | + abug_cmds.regnames = NULL; /* registers names */ | |
155 | + abug_cmds.regname = abug_regname; | |
145 | 156 | abug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ |
146 | 157 | }; |
147 | 158 |
@@ -118,22 +118,6 @@ legacy_register_sim_regno (int regnum) | ||
118 | 118 | } |
119 | 119 | |
120 | 120 | int |
121 | -legacy_register_sim_regno (int regnum) | |
122 | -{ | |
123 | - /* Only makes sense to supply raw registers. */ | |
124 | - gdb_assert (regnum >= 0 && regnum < NUM_REGS); | |
125 | - /* NOTE: cagney/2002-05-13: The old code did it this way and it is | |
126 | - suspected that some GDB/SIM combinations may rely on this | |
127 | - behavour. The default should be one2one_register_sim_regno | |
128 | - (below). */ | |
129 | - if (REGISTER_NAME (regnum) != NULL | |
130 | - && REGISTER_NAME (regnum)[0] != '\0') | |
131 | - return regnum; | |
132 | - else | |
133 | - return LEGACY_SIM_REGNO_IGNORE; | |
134 | -} | |
135 | - | |
136 | -int | |
137 | 121 | generic_frameless_function_invocation_not (struct frame_info *fi) |
138 | 122 | { |
139 | 123 | return 0; |
@@ -1144,7 +1144,7 @@ static struct dummy_frame *dummy_frame_stack = NULL; | ||
1144 | 1144 | adjust for DECR_PC_AFTER_BREAK. This is because it is only legal |
1145 | 1145 | to call this function after the PC has been adjusted. */ |
1146 | 1146 | |
1147 | -struct regcache * | |
1147 | +static struct regcache * | |
1148 | 1148 | generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) |
1149 | 1149 | { |
1150 | 1150 | struct dummy_frame *dummyframe; |
@@ -1161,6 +1161,15 @@ generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) | ||
1161 | 1161 | return 0; |
1162 | 1162 | } |
1163 | 1163 | |
1164 | +char * | |
1165 | +deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp) | |
1166 | +{ | |
1167 | + struct regcache *regcache = generic_find_dummy_frame (pc, fp); | |
1168 | + if (regcache == NULL) | |
1169 | + return NULL; | |
1170 | + return deprecated_grub_regcache_for_registers (regcache); | |
1171 | +} | |
1172 | + | |
1164 | 1173 | /* Function: pc_in_call_dummy (pc, sp, fp) |
1165 | 1174 | |
1166 | 1175 | Return true if the PC falls in a dummy frame created by gdb for an |
@@ -1233,7 +1242,7 @@ generic_push_dummy_frame (void) | ||
1233 | 1242 | dummy_frame->sp = read_sp (); |
1234 | 1243 | dummy_frame->top = dummy_frame->sp; |
1235 | 1244 | dummy_frame->fp = fp; |
1236 | - regcache_save (dummy_frame->regcache); | |
1245 | + regcache_cpy (dummy_frame->regcache, current_regcache); | |
1237 | 1246 | dummy_frame->next = dummy_frame_stack; |
1238 | 1247 | dummy_frame_stack = dummy_frame; |
1239 | 1248 | } |
@@ -1281,7 +1290,7 @@ generic_pop_dummy_frame (void) | ||
1281 | 1290 | if (!dummy_frame) |
1282 | 1291 | error ("Can't pop dummy frame!"); |
1283 | 1292 | dummy_frame_stack = dummy_frame->next; |
1284 | - regcache_restore (dummy_frame->regcache); | |
1293 | + regcache_cpy (current_regcache, dummy_frame->regcache); | |
1285 | 1294 | flush_cached_frames (); |
1286 | 1295 | |
1287 | 1296 | regcache_xfree (dummy_frame->regcache); |
@@ -1366,10 +1375,11 @@ generic_call_dummy_register_unwind (struct frame_info *frame, void **cache, | ||
1366 | 1375 | #endif |
1367 | 1376 | gdb_assert (registers != NULL); |
1368 | 1377 | /* Return the actual value. */ |
1369 | - memcpy (bufferp, | |
1370 | - (deprecated_grub_regcache_for_registers (registers) | |
1371 | - + REGISTER_BYTE (regnum)), | |
1372 | - REGISTER_RAW_SIZE (regnum)); | |
1378 | + /* FIXME: cagney/2002-06-26: This should be via the | |
1379 | + gdbarch_register_read() method so that it, on the fly, | |
1380 | + constructs either a raw or pseudo register from the raw | |
1381 | + register cache. */ | |
1382 | + regcache_read (registers, regnum, bufferp); | |
1373 | 1383 | } |
1374 | 1384 | } |
1375 | 1385 |
@@ -1515,6 +1525,10 @@ generic_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, | ||
1515 | 1525 | if (lval) /* found it in a CALL_DUMMY frame */ |
1516 | 1526 | *lval = not_lval; |
1517 | 1527 | if (raw_buffer) |
1528 | + /* FIXME: cagney/2002-06-26: This should be via the | |
1529 | + gdbarch_register_read() method so that it, on the fly, | |
1530 | + constructs either a raw or pseudo register from the raw | |
1531 | + register cache. */ | |
1518 | 1532 | regcache_read (generic_find_dummy_frame (frame->pc, frame->frame), |
1519 | 1533 | regnum, raw_buffer); |
1520 | 1534 | return; |
@@ -6769,6 +6769,8 @@ delete_command (char *arg, int from_tty) | ||
6769 | 6769 | { |
6770 | 6770 | struct breakpoint *b, *temp; |
6771 | 6771 | |
6772 | + dont_repeat (); | |
6773 | + | |
6772 | 6774 | if (arg == 0) |
6773 | 6775 | { |
6774 | 6776 | int breaks_to_delete = 0; |
@@ -210,6 +210,26 @@ extern void help_list (struct cmd_list_element *, char *, | ||
210 | 210 | extern void help_cmd_list (struct cmd_list_element *, enum command_class, |
211 | 211 | char *, int, struct ui_file *); |
212 | 212 | |
213 | +extern void add_setshow_cmd (char *name, | |
214 | + enum command_class class, | |
215 | + var_types var_type, void *var, | |
216 | + char *set_doc, char *show_doc, | |
217 | + cmd_sfunc_ftype *set_func, | |
218 | + cmd_sfunc_ftype *show_func, | |
219 | + struct cmd_list_element **set_list, | |
220 | + struct cmd_list_element **show_list); | |
221 | + | |
222 | +extern void add_setshow_cmd_full (char *name, | |
223 | + enum command_class class, | |
224 | + var_types var_type, void *var, | |
225 | + char *set_doc, char *show_doc, | |
226 | + cmd_sfunc_ftype *set_func, | |
227 | + cmd_sfunc_ftype *show_func, | |
228 | + struct cmd_list_element **set_list, | |
229 | + struct cmd_list_element **show_list, | |
230 | + struct cmd_list_element **set_result, | |
231 | + struct cmd_list_element **show_result); | |
232 | + | |
213 | 233 | extern struct cmd_list_element *add_set_cmd (char *name, enum |
214 | 234 | command_class class, |
215 | 235 | var_types var_type, void *var, |
@@ -74,12 +74,22 @@ cpu32bug_supply_register (char *regname, int regnamelen, char *val, int vallen) | ||
74 | 74 | * registers either. So, typing "info reg sp" becomes an "A7". |
75 | 75 | */ |
76 | 76 | |
77 | -static char *cpu32bug_regnames[NUM_REGS] = | |
77 | +static const char * | |
78 | +cpu32bug_regname (int index) | |
78 | 79 | { |
79 | - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
80 | - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
81 | - "SR", "PC", | |
82 | -}; | |
80 | + static char *regnames[] = | |
81 | + { | |
82 | + "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
83 | + "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
84 | + "SR", "PC" | |
85 | + }; | |
86 | + | |
87 | + if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) | |
88 | + || (index < 0) || (index >= NUM_REGS)) | |
89 | + return NULL; | |
90 | + else | |
91 | + return regnames[index]; | |
92 | +} | |
83 | 93 | |
84 | 94 | /* |
85 | 95 | * Define the monitor command strings. Since these are passed directly |
@@ -139,7 +149,8 @@ init_cpu32bug_cmds (void) | ||
139 | 149 | cpu32bug_cmds.cmd_end = NULL; /* optional command terminator */ |
140 | 150 | cpu32bug_cmds.target = &cpu32bug_ops; /* target operations */ |
141 | 151 | cpu32bug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ |
142 | - cpu32bug_cmds.regnames = cpu32bug_regnames; /* registers names */ | |
152 | + cpu32bug_cmds.regnames = NULL; /* registers names */ | |
153 | + cpu32bug_cmds.regname = cpu32bug_regname; | |
143 | 154 | cpu32bug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ |
144 | 155 | }; /* init_cpu32bug_cmds */ |
145 | 156 |
@@ -1155,7 +1155,7 @@ cris_frame_init_saved_regs (struct frame_info *fi) | ||
1155 | 1155 | CORE_ADDR ip; |
1156 | 1156 | struct symtab_and_line sal; |
1157 | 1157 | int best_limit; |
1158 | - char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame); | |
1158 | + char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame); | |
1159 | 1159 | |
1160 | 1160 | /* Examine the entire prologue. */ |
1161 | 1161 | register int frameless_p = 0; |
@@ -76,13 +76,25 @@ dbug_supply_register (char *regname, int regnamelen, char *val, int vallen) | ||
76 | 76 | different names than GDB does, and don't support all the registers |
77 | 77 | either. So, typing "info reg sp" becomes an "A7". */ |
78 | 78 | |
79 | -static char *dbug_regnames[NUM_REGS] = | |
79 | +static const char * | |
80 | +dbug_regname (int index) | |
80 | 81 | { |
81 | - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
82 | - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
83 | - "SR", "PC" | |
84 | - /* no float registers */ | |
85 | -}; | |
82 | + static char *regnames[] = | |
83 | + { | |
84 | + "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
85 | + "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
86 | + "SR", "PC" | |
87 | + /* no float registers */ | |
88 | + }; | |
89 | + | |
90 | + if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) | |
91 | + || (index < 0) || (index >= NUM_REGS)) | |
92 | + return NULL; | |
93 | + else | |
94 | + return regnames[index]; | |
95 | + | |
96 | +} | |
97 | + | |
86 | 98 | static struct target_ops dbug_ops; |
87 | 99 | static struct monitor_ops dbug_cmds; |
88 | 100 |
@@ -135,7 +147,8 @@ init_dbug_cmds (void) | ||
135 | 147 | dbug_cmds.cmd_end = NULL; /* optional command terminator */ |
136 | 148 | dbug_cmds.target = &dbug_ops; /* target operations */ |
137 | 149 | dbug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ |
138 | - dbug_cmds.regnames = dbug_regnames; /* registers names */ | |
150 | + dbug_cmds.regnames = NULL; /* registers names */ | |
151 | + dbug_cmds.regname = dbug_regname; | |
139 | 152 | dbug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ |
140 | 153 | } /* init_debug_ops */ |
141 | 154 |
@@ -310,7 +310,13 @@ extern void generic_pop_dummy_frame (void); | ||
310 | 310 | |
311 | 311 | extern int generic_pc_in_call_dummy (CORE_ADDR pc, |
312 | 312 | CORE_ADDR sp, CORE_ADDR fp); |
313 | -extern struct regcache *generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp); | |
313 | + | |
314 | +/* NOTE: cagney/2002-06-26: Targets should no longer use this | |
315 | + function. Instead, the contents of a dummy frames registers can be | |
316 | + obtained by applying: frame_register_unwind to the dummy frame; or | |
317 | + get_saved_register to the next outer frame. */ | |
318 | + | |
319 | +extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp); | |
314 | 320 | |
315 | 321 | extern void generic_fix_call_dummy (char *dummy, CORE_ADDR pc, CORE_ADDR fun, |
316 | 322 | int nargs, struct value **args, |
@@ -42,6 +42,15 @@ | ||
42 | 42 | #define P_FMOVM 0xf237 |
43 | 43 | #define P_TRAP 0x4e40 |
44 | 44 | |
45 | +enum | |
46 | +{ | |
47 | + E_FP_REGNUM = 14, /* Contains address of executing stack frame */ | |
48 | + E_SP_REGNUM = 15, /* Contains address of top of stack */ | |
49 | + E_PS_REGNUM = 16, /* Contains processor status */ | |
50 | + E_PC_REGNUM = 17, /* Contains program counter */ | |
51 | + E_FP0_REGNUM = 18 /* Floating point register 0 */ | |
52 | +}; | |
53 | + | |
45 | 54 | void m68k_frame_init_saved_regs (struct frame_info *frame_info); |
46 | 55 | |
47 | 56 | static int |
@@ -917,7 +926,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
917 | 926 | #if 0 |
918 | 927 | tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep)); |
919 | 928 | #endif |
920 | - | |
929 | + | |
921 | 930 | gdbarch = gdbarch_alloc (&info, 0); |
922 | 931 | |
923 | 932 | set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext); |
@@ -932,6 +941,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
932 | 941 | set_gdbarch_inner_than (gdbarch, core_addr_lessthan); |
933 | 942 | set_gdbarch_stack_align (gdbarch, m68k_stack_align); |
934 | 943 | |
944 | + | |
945 | + set_gdbarch_believe_pcc_promotion (gdbarch, 1); | |
935 | 946 | set_gdbarch_decr_pc_after_break (gdbarch, 2); |
936 | 947 | |
937 | 948 | set_gdbarch_store_struct_return (gdbarch, m68k_store_struct_return); |
@@ -940,10 +951,16 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
940 | 951 | set_gdbarch_store_return_value (gdbarch, m68k_store_return_value); |
941 | 952 | |
942 | 953 | set_gdbarch_frame_chain (gdbarch, m68k_frame_chain); |
954 | + set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid); | |
943 | 955 | set_gdbarch_frame_saved_pc (gdbarch, m68k_frame_saved_pc); |
944 | 956 | set_gdbarch_frame_init_saved_regs (gdbarch, m68k_frame_init_saved_regs); |
945 | 957 | set_gdbarch_frameless_function_invocation (gdbarch, |
946 | 958 | m68k_frameless_function_invocation); |
959 | + /* OK to default this value to 'unknown'. */ | |
960 | + set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); | |
961 | + set_gdbarch_frame_args_skip (gdbarch, 8); | |
962 | + set_gdbarch_frame_args_address (gdbarch, default_frame_address); | |
963 | + set_gdbarch_frame_locals_address (gdbarch, default_frame_address); | |
947 | 964 | |
948 | 965 | set_gdbarch_register_raw_size (gdbarch, m68k_register_raw_size); |
949 | 966 | set_gdbarch_register_virtual_size (gdbarch, m68k_register_virtual_size); |
@@ -956,6 +973,11 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
956 | 973 | set_gdbarch_num_regs (gdbarch, 29); |
957 | 974 | set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok); |
958 | 975 | set_gdbarch_register_bytes (gdbarch, (16 * 4 + 8 + 8 * 12 + 3 * 4)); |
976 | + set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); | |
977 | + set_gdbarch_fp_regnum (gdbarch, E_FP_REGNUM); | |
978 | + set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); | |
979 | + set_gdbarch_ps_regnum (gdbarch, E_PS_REGNUM); | |
980 | + set_gdbarch_fp0_regnum (gdbarch, E_FP0_REGNUM); | |
959 | 981 | |
960 | 982 | set_gdbarch_use_generic_dummy_frames (gdbarch, 0); |
961 | 983 | set_gdbarch_call_dummy_location (gdbarch, ON_STACK); |
@@ -1183,7 +1183,10 @@ monitor_fetch_register (int regno) | ||
1183 | 1183 | zerobuf = alloca (MAX_REGISTER_RAW_SIZE); |
1184 | 1184 | memset (zerobuf, 0, MAX_REGISTER_RAW_SIZE); |
1185 | 1185 | |
1186 | - name = current_monitor->regnames[regno]; | |
1186 | + if (current_monitor->regname != NULL) | |
1187 | + name = current_monitor->regname (regno); | |
1188 | + else | |
1189 | + name = current_monitor->regnames[regno]; | |
1187 | 1190 | monitor_debug ("MON fetchreg %d '%s'\n", regno, name ? name : "(null name)"); |
1188 | 1191 | |
1189 | 1192 | if (!name || (*name == '\0')) |
@@ -1335,8 +1338,12 @@ monitor_store_register (int regno) | ||
1335 | 1338 | { |
1336 | 1339 | char *name; |
1337 | 1340 | ULONGEST val; |
1338 | - | |
1339 | - name = current_monitor->regnames[regno]; | |
1341 | + | |
1342 | + if (current_monitor->regname != NULL) | |
1343 | + name = current_monitor->regname (regno); | |
1344 | + else | |
1345 | + name = current_monitor->regnames[regno]; | |
1346 | + | |
1340 | 1347 | if (!name || (*name == '\0')) |
1341 | 1348 | { |
1342 | 1349 | monitor_debug ("MON Cannot store unknown register\n"); |
@@ -116,6 +116,9 @@ struct monitor_ops | ||
116 | 116 | struct target_ops *target; /* target operations */ |
117 | 117 | int stopbits; /* number of stop bits */ |
118 | 118 | char **regnames; /* array of register names in ascii */ |
119 | + /* deprecated: use regname instead */ | |
120 | + const char *(*regname) (int index); | |
121 | + /* function for dynamic regname array */ | |
119 | 122 | int num_breakpoints; /* If set_break != NULL, number of supported |
120 | 123 | breakpoints */ |
121 | 124 | int magic; /* Check value */ |
@@ -22,6 +22,8 @@ | ||
22 | 22 | #if !defined (OBJFILES_H) |
23 | 23 | #define OBJFILES_H |
24 | 24 | |
25 | +#include "bcache.h" | |
26 | + | |
25 | 27 | /* This structure maintains information on a per-objfile basis about the |
26 | 28 | "entry point" of the objfile, and the scope within which the entry point |
27 | 29 | exists. It is possible that gdb will see more than one objfile that is |
@@ -200,6 +200,8 @@ static void | ||
200 | 200 | ppcnbsd_init_abi (struct gdbarch_info info, |
201 | 201 | struct gdbarch *gdbarch) |
202 | 202 | { |
203 | + /* Stop at main. */ | |
204 | + set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid); | |
203 | 205 | |
204 | 206 | set_solib_svr4_fetch_link_map_offsets (gdbarch, |
205 | 207 | nbsd_ilp32_solib_svr4_fetch_link_map_offsets); |
@@ -1003,7 +1003,8 @@ supply_register (int regnum, char *val) | ||
1003 | 1003 | values. */ |
1004 | 1004 | |
1005 | 1005 | #ifdef DEPRECATED_CLEAN_UP_REGISTER_VALUE |
1006 | - DEPRECATED_CLEAN_UP_REGISTER_VALUE (regnum, register_buffer (regnum)); | |
1006 | + DEPRECATED_CLEAN_UP_REGISTER_VALUE \ | |
1007 | + (regnum, register_buffer (current_regcache, regnum)); | |
1007 | 1008 | #endif |
1008 | 1009 | } |
1009 | 1010 |
@@ -76,12 +76,24 @@ est_supply_register (char *regname, int regnamelen, char *val, int vallen) | ||
76 | 76 | * registers either. So, typing "info reg sp" becomes a "r30". |
77 | 77 | */ |
78 | 78 | |
79 | -static char *est_regnames[NUM_REGS] = | |
79 | +static const char * | |
80 | +est_regname (int index) | |
80 | 81 | { |
81 | - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
82 | - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
83 | - "SR", "PC", | |
84 | -}; | |
82 | + | |
83 | + static char *regnames[] = | |
84 | + { | |
85 | + "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
86 | + "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", | |
87 | + "SR", "PC", | |
88 | + }; | |
89 | + | |
90 | + | |
91 | + if ((index >= (sizeof (regnames) / sizeof (regnames[0]))) | |
92 | + || (index < 0) || (index >= NUM_REGS)) | |
93 | + return NULL; | |
94 | + else | |
95 | + return regnames[index]; | |
96 | +} | |
85 | 97 | |
86 | 98 | /* |
87 | 99 | * Define the monitor command strings. Since these are passed directly |
@@ -143,7 +155,8 @@ init_est_cmds (void) | ||
143 | 155 | est_cmds.cmd_end = NULL; /* optional command terminator */ |
144 | 156 | est_cmds.target = &est_ops; /* target operations */ |
145 | 157 | est_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */ |
146 | - est_cmds.regnames = est_regnames; /* registers names */ | |
158 | + est_cmds.regnames = NULL; | |
159 | + est_cmds.regname = est_regname; /*register names*/ | |
147 | 160 | est_cmds.magic = MONITOR_OPS_MAGIC; /* magic */ |
148 | 161 | } /* init_est_cmds */ |
149 | 162 |
@@ -157,11 +157,24 @@ rom68k_supply_register (char *regname, int regnamelen, char *val, int vallen) | ||
157 | 157 | than does GDB, and don't necessarily support all the registers |
158 | 158 | either. So, typing "info reg sp" becomes a "r30". */ |
159 | 159 | |
160 | -static char *rom68k_regnames[NUM_REGS] = | |
160 | +static const char * | |
161 | +rom68k_regname (int index) | |
161 | 162 | { |
162 | - "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
163 | - "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP", | |
164 | - "SR", "PC"}; | |
163 | + | |
164 | + static char *regnames[] = | |
165 | + { | |
166 | + "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
167 | + "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP", | |
168 | + "SR", "PC" | |
169 | + }; | |
170 | + | |
171 | + if ((index >= (sizeof (regnames) / sizeof(regnames[0]))) | |
172 | + || (index < 0) || (index >= NUM_REGS)) | |
173 | + return NULL; | |
174 | + else | |
175 | + return regnames[index]; | |
176 | + | |
177 | +} | |
165 | 178 | |
166 | 179 | /* Define the monitor command strings. Since these are passed directly |
167 | 180 | through to a printf style function, we may include formatting |
@@ -220,7 +233,8 @@ init_rom68k_cmds (void) | ||
220 | 233 | rom68k_cmds.cmd_end = ".\r"; |
221 | 234 | rom68k_cmds.target = &rom68k_ops; |
222 | 235 | rom68k_cmds.stopbits = SERIAL_1_STOPBITS; |
223 | - rom68k_cmds.regnames = rom68k_regnames; | |
236 | + rom68k_cmds.regnames = NULL; | |
237 | + rom68k_cmds.regname = rom68k_regname; | |
224 | 238 | rom68k_cmds.magic = MONITOR_OPS_MAGIC; |
225 | 239 | } /* init_rom68k_cmds */ |
226 | 240 |
@@ -46,8 +46,6 @@ | ||
46 | 46 | #include "solib-svr4.h" |
47 | 47 | #include "ppc-tdep.h" |
48 | 48 | |
49 | -#include "regcache.h" /* For grub_around_regcache_for_registers. */ | |
50 | - | |
51 | 49 | /* If the kernel has to deliver a signal, it pushes a sigcontext |
52 | 50 | structure on the stack and then calls the signal handler, passing |
53 | 51 | the address of the sigcontext in an argument register. Usually |
@@ -1145,12 +1143,10 @@ ppc_push_return_address (CORE_ADDR pc, CORE_ADDR sp) | ||
1145 | 1143 | REGBUF, and copy that return value into VALBUF in virtual format. */ |
1146 | 1144 | |
1147 | 1145 | static void |
1148 | -rs6000_extract_return_value (struct type *valtype, struct regcache *regs, | |
1149 | - char *valbuf) | |
1146 | +rs6000_extract_return_value (struct type *valtype, char *regbuf, char *valbuf) | |
1150 | 1147 | { |
1151 | 1148 | int offset = 0; |
1152 | 1149 | struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); |
1153 | - char *regbuf = deprecated_grub_regcache_for_registers (regs); | |
1154 | 1150 | |
1155 | 1151 | if (TYPE_CODE (valtype) == TYPE_CODE_FLT) |
1156 | 1152 | { |
@@ -1948,9 +1944,8 @@ rs6000_store_return_value (struct type *type, char *valbuf) | ||
1948 | 1944 | as a CORE_ADDR (or an expression that can be used as one). */ |
1949 | 1945 | |
1950 | 1946 | static CORE_ADDR |
1951 | -rs6000_extract_struct_value_address (struct regcache *regs) | |
1947 | +rs6000_extract_struct_value_address (char *regbuf) | |
1952 | 1948 | { |
1953 | - /* FIXME: cagney/2002-05-11: This global variable is just a hack! */ | |
1954 | 1949 | return rs6000_struct_return_address; |
1955 | 1950 | } |
1956 | 1951 |
@@ -2611,7 +2606,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
2611 | 2606 | set_gdbarch_pc_in_call_dummy (gdbarch, generic_pc_in_call_dummy); |
2612 | 2607 | set_gdbarch_call_dummy_p (gdbarch, 1); |
2613 | 2608 | set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); |
2614 | - set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); | |
2609 | + set_gdbarch_get_saved_register (gdbarch, generic_unwind_get_saved_register); | |
2615 | 2610 | set_gdbarch_fix_call_dummy (gdbarch, rs6000_fix_call_dummy); |
2616 | 2611 | set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); |
2617 | 2612 | set_gdbarch_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos); |
@@ -955,7 +955,7 @@ s390_frame_saved_pc_nofix (struct frame_info *fi) | ||
955 | 955 | if (fi->extra_info && fi->extra_info->saved_pc_valid) |
956 | 956 | return fi->extra_info->saved_pc; |
957 | 957 | |
958 | - if (generic_find_dummy_frame (fi->pc, fi->frame)) | |
958 | + if (deprecated_generic_find_dummy_frame (fi->pc, fi->frame)) | |
959 | 959 | return generic_read_register_dummy (fi->pc, fi->frame, S390_PC_REGNUM); |
960 | 960 | |
961 | 961 | s390_frame_init_saved_regs (fi); |
@@ -1009,7 +1009,7 @@ s390_frame_chain (struct frame_info *thisframe) | ||
1009 | 1009 | { |
1010 | 1010 | CORE_ADDR prev_fp = 0; |
1011 | 1011 | |
1012 | - if (generic_find_dummy_frame (thisframe->pc, thisframe->frame)) | |
1012 | + if (deprecated_generic_find_dummy_frame (thisframe->pc, thisframe->frame)) | |
1013 | 1013 | return generic_read_register_dummy (thisframe->pc, thisframe->frame, |
1014 | 1014 | S390_SP_REGNUM); |
1015 | 1015 | else |
@@ -1046,7 +1046,7 @@ sh_nofp_frame_init_saved_regs (struct frame_info *fi) | ||
1046 | 1046 | int opc; |
1047 | 1047 | int insn; |
1048 | 1048 | int r3_val = 0; |
1049 | - char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame); | |
1049 | + char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame); | |
1050 | 1050 | |
1051 | 1051 | if (fi->saved_regs == NULL) |
1052 | 1052 | frame_saved_regs_zalloc (fi); |
@@ -1385,7 +1385,7 @@ sh64_nofp_frame_init_saved_regs (struct frame_info *fi) | ||
1385 | 1385 | int insn_size; |
1386 | 1386 | int gdb_register_number; |
1387 | 1387 | int register_number; |
1388 | - char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame); | |
1388 | + char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame); | |
1389 | 1389 | struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); |
1390 | 1390 | |
1391 | 1391 | if (fi->saved_regs == NULL) |
@@ -1586,7 +1586,7 @@ sh_fp_frame_init_saved_regs (struct frame_info *fi) | ||
1586 | 1586 | int opc; |
1587 | 1587 | int insn; |
1588 | 1588 | int r3_val = 0; |
1589 | - char *dummy_regs = generic_find_dummy_frame (fi->pc, fi->frame); | |
1589 | + char *dummy_regs = deprecated_generic_find_dummy_frame (fi->pc, fi->frame); | |
1590 | 1590 | struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); |
1591 | 1591 | |
1592 | 1592 | if (fi->saved_regs == NULL) |
@@ -1814,8 +1814,8 @@ sh64_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp, | ||
1814 | 1814 | *lval = not_lval; |
1815 | 1815 | if (raw_buffer) |
1816 | 1816 | memcpy (raw_buffer, |
1817 | - generic_find_dummy_frame (frame->pc, frame->frame) + | |
1818 | - REGISTER_BYTE (regnum), | |
1817 | + (deprecated_generic_find_dummy_frame (frame->pc, frame->frame) | |
1818 | + + REGISTER_BYTE (regnum)), | |
1819 | 1819 | REGISTER_RAW_SIZE (regnum)); |
1820 | 1820 | return; |
1821 | 1821 | } |
@@ -28,7 +28,6 @@ | ||
28 | 28 | #include "obstack.h" |
29 | 29 | #define obstack_chunk_alloc xmalloc |
30 | 30 | #define obstack_chunk_free xfree |
31 | -#include "bcache.h" | |
32 | 31 | |
33 | 32 | /* Don't do this; it means that if some .o's are compiled with GNU C |
34 | 33 | and some are not (easy to do accidentally the way we configure |
@@ -186,7 +186,7 @@ vax_frame_init_saved_regs (struct frame_info *frame) | ||
186 | 186 | |
187 | 187 | /* regmask's low bit is for register 0, which is the first one |
188 | 188 | what would be pushed. */ |
189 | - for (regnum = 0; regnum < AP_REGNUM; regnum++) | |
189 | + for (regnum = 0; regnum < VAX_AP_REGNUM; regnum++) | |
190 | 190 | { |
191 | 191 | if (regmask & (1 << regnum)) |
192 | 192 | frame->saved_regs[regnum] = next_addr += 4; |
@@ -199,7 +199,7 @@ vax_frame_init_saved_regs (struct frame_info *frame) | ||
199 | 199 | |
200 | 200 | frame->saved_regs[PC_REGNUM] = frame->frame + 16; |
201 | 201 | frame->saved_regs[FP_REGNUM] = frame->frame + 12; |
202 | - frame->saved_regs[AP_REGNUM] = frame->frame + 8; | |
202 | + frame->saved_regs[VAX_AP_REGNUM] = frame->frame + 8; | |
203 | 203 | frame->saved_regs[PS_REGNUM] = frame->frame + 4; |
204 | 204 | } |
205 | 205 |
@@ -239,7 +239,7 @@ vax_frame_args_address (struct frame_info *frame) | ||
239 | 239 | if (frame->next) |
240 | 240 | return (read_memory_integer (frame->next->frame + 8, 4)); |
241 | 241 | |
242 | - return (read_register (AP_REGNUM)); | |
242 | + return (read_register (VAX_AP_REGNUM)); | |
243 | 243 | } |
244 | 244 | |
245 | 245 | static CORE_ADDR |
@@ -276,12 +276,12 @@ vax_push_dummy_frame (void) | ||
276 | 276 | sp = push_word (sp, read_register (regnum)); |
277 | 277 | sp = push_word (sp, read_register (PC_REGNUM)); |
278 | 278 | sp = push_word (sp, read_register (FP_REGNUM)); |
279 | - sp = push_word (sp, read_register (AP_REGNUM)); | |
279 | + sp = push_word (sp, read_register (VAX_AP_REGNUM)); | |
280 | 280 | sp = push_word (sp, (read_register (PS_REGNUM) & 0xffef) + 0x2fff0000); |
281 | 281 | sp = push_word (sp, 0); |
282 | 282 | write_register (SP_REGNUM, sp); |
283 | 283 | write_register (FP_REGNUM, sp); |
284 | - write_register (AP_REGNUM, sp + (17 * 4)); | |
284 | + write_register (VAX_AP_REGNUM, sp + (17 * 4)); | |
285 | 285 | } |
286 | 286 | |
287 | 287 | static void |
@@ -296,7 +296,7 @@ vax_pop_frame (void) | ||
296 | 296 | | (read_register (PS_REGNUM) & 0xffff0000)); |
297 | 297 | write_register (PC_REGNUM, read_memory_integer (fp + 16, 4)); |
298 | 298 | write_register (FP_REGNUM, read_memory_integer (fp + 12, 4)); |
299 | - write_register (AP_REGNUM, read_memory_integer (fp + 8, 4)); | |
299 | + write_register (VAX_AP_REGNUM, read_memory_integer (fp + 8, 4)); | |
300 | 300 | fp += 16; |
301 | 301 | for (regnum = 0; regnum < 12; regnum++) |
302 | 302 | if (regmask & (0x10000 << regnum)) |
@@ -353,6 +353,15 @@ vax_extract_struct_value_address (char *regbuf) | ||
353 | 353 | return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0))); |
354 | 354 | } |
355 | 355 | |
356 | +static const unsigned char * | |
357 | +vax_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) | |
358 | +{ | |
359 | + static const unsigned char vax_breakpoint[] = { 3 }; | |
360 | + | |
361 | + *lenptr = sizeof(vax_breakpoint); | |
362 | + return (vax_breakpoint); | |
363 | +} | |
364 | + | |
356 | 365 | /* Advance PC across any function entry prologue instructions |
357 | 366 | to reach some "real" code. */ |
358 | 367 |
@@ -620,13 +629,30 @@ print_insn_arg (char *d, register char *p, CORE_ADDR addr, | ||
620 | 629 | static struct gdbarch * |
621 | 630 | vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) |
622 | 631 | { |
632 | + struct gdbarch_tdep *tdep; | |
623 | 633 | struct gdbarch *gdbarch; |
634 | + enum gdb_osabi osabi = GDB_OSABI_UNKNOWN; | |
635 | + | |
636 | + /* Try to determine the ABI of the object we are loading. */ | |
637 | + | |
638 | + if (info.abfd != NULL) | |
639 | + osabi = gdbarch_lookup_osabi (info.abfd); | |
640 | + | |
641 | + /* Find a candidate among extant architectures. */ | |
642 | + for (arches = gdbarch_list_lookup_by_info (arches, &info); | |
643 | + arches != NULL; | |
644 | + arches = gdbarch_list_lookup_by_info (arches->next, &info)) | |
645 | + { | |
646 | + /* Make sure the ABI selection matches. */ | |
647 | + tdep = gdbarch_tdep (arches->gdbarch); | |
648 | + if (tdep && tdep->osabi == osabi) | |
649 | + return arches->gdbarch; | |
650 | + } | |
624 | 651 | |
625 | - /* Right now there is only one VAX architecture variant. */ | |
626 | - if (arches != NULL) | |
627 | - return (arches->gdbarch); | |
652 | + tdep = xmalloc (sizeof (struct gdbarch_tdep)); | |
653 | + gdbarch = gdbarch_alloc (&info, tdep); | |
628 | 654 | |
629 | - gdbarch = gdbarch_alloc (&info, NULL); | |
655 | + tdep->osabi = osabi; | |
630 | 656 | |
631 | 657 | /* Register info */ |
632 | 658 | set_gdbarch_num_regs (gdbarch, VAX_NUM_REGS); |
@@ -691,18 +717,35 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
691 | 717 | set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); |
692 | 718 | |
693 | 719 | /* Breakpoint info */ |
720 | + set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc); | |
694 | 721 | set_gdbarch_decr_pc_after_break (gdbarch, 0); |
695 | 722 | |
696 | 723 | /* Misc info */ |
697 | 724 | set_gdbarch_function_start_offset (gdbarch, 2); |
725 | + set_gdbarch_believe_pcc_promotion (gdbarch, 1); | |
726 | + | |
727 | + /* Hook in ABI-specific overrides, if they have been registered. */ | |
728 | + gdbarch_init_osabi (info, gdbarch, osabi); | |
698 | 729 | |
699 | 730 | return (gdbarch); |
700 | 731 | } |
701 | 732 | |
733 | +static void | |
734 | +vax_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file) | |
735 | +{ | |
736 | + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); | |
737 | + | |
738 | + if (tdep == NULL) | |
739 | + return; | |
740 | + | |
741 | + fprintf_unfiltered (file, "vax_dump_tdep: OS ABI = %s\n", | |
742 | + gdbarch_osabi_name (tdep->osabi)); | |
743 | +} | |
744 | + | |
702 | 745 | void |
703 | 746 | _initialize_vax_tdep (void) |
704 | 747 | { |
705 | - gdbarch_register (bfd_arch_vax, vax_gdbarch_init, NULL); | |
748 | + gdbarch_register (bfd_arch_vax, vax_gdbarch_init, vax_dump_tdep); | |
706 | 749 | |
707 | 750 | tm_print_insn = vax_print_insn; |
708 | 751 | } |
@@ -21,6 +21,8 @@ | ||
21 | 21 | #ifndef VAX_TDEP_H |
22 | 22 | #define VAX_TDEP_H |
23 | 23 | |
24 | +#include "osabi.h" | |
25 | + | |
24 | 26 | /* Say how long (ordinary) registers are. This is a piece of bogosity |
25 | 27 | used in push_word and a few other places; REGISTER_RAW_SIZE is the |
26 | 28 | real way to know how big a register is. */ |
@@ -52,4 +54,10 @@ | ||
52 | 54 | #define VAX_PC_REGNUM 15 /* Contains program counter */ |
53 | 55 | #define VAX_PS_REGNUM 16 /* Contains processor status */ |
54 | 56 | |
57 | +/* Target-dependent structure in gdbarch. */ | |
58 | +struct gdbarch_tdep | |
59 | +{ | |
60 | + enum gdb_osabi osabi; /* OS/ABI of inferior. */ | |
61 | +}; | |
62 | + | |
55 | 63 | #endif /* VAX_TDEP_H */ |
@@ -1 +1 @@ | ||
1 | -2002-06-25-cvs | |
1 | +2002-06-28-cvs |