OLD | NEW |
1 /* Target-dependent code for Renesas Super-H, for GDB. | 1 /* Target-dependent code for Renesas Super-H, for GDB. |
2 | 2 |
3 Copyright (C) 1993-2005, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 1993-2005, 2007-2012 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "osabi.h" | 39 #include "osabi.h" |
40 #include "valprint.h" | 40 #include "valprint.h" |
41 | 41 |
42 #include "elf-bfd.h" | 42 #include "elf-bfd.h" |
43 | 43 |
44 /* sh flags */ | 44 /* sh flags */ |
45 #include "elf/sh.h" | 45 #include "elf/sh.h" |
46 /* Register numbers shared with the simulator. */ | 46 /* Register numbers shared with the simulator. */ |
47 #include "gdb/sim-sh.h" | 47 #include "gdb/sim-sh.h" |
48 #include "language.h" | 48 #include "language.h" |
| 49 #include "sh64-tdep.h" |
49 | 50 |
50 /* Information that is dependent on the processor variant. */ | 51 /* Information that is dependent on the processor variant. */ |
51 enum sh_abi | 52 enum sh_abi |
52 { | 53 { |
53 SH_ABI_UNKNOWN, | 54 SH_ABI_UNKNOWN, |
54 SH_ABI_32, | 55 SH_ABI_32, |
55 SH_ABI_64 | 56 SH_ABI_64 |
56 }; | 57 }; |
57 | 58 |
58 struct gdbarch_tdep | 59 struct gdbarch_tdep |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 ? value | (~((1 << bits) - 1)) | 851 ? value | (~((1 << bits) - 1)) |
851 : value); | 852 : value); |
852 } | 853 } |
853 | 854 |
854 static void | 855 static void |
855 sh64_analyze_prologue (struct gdbarch *gdbarch, | 856 sh64_analyze_prologue (struct gdbarch *gdbarch, |
856 struct sh64_frame_cache *cache, | 857 struct sh64_frame_cache *cache, |
857 CORE_ADDR func_pc, | 858 CORE_ADDR func_pc, |
858 CORE_ADDR current_pc) | 859 CORE_ADDR current_pc) |
859 { | 860 { |
860 int reg_nr; | |
861 int pc; | 861 int pc; |
862 int opc; | 862 int opc; |
863 int insn; | 863 int insn; |
864 int r0_val = 0; | 864 int r0_val = 0; |
865 int insn_size; | 865 int insn_size; |
866 int gdb_register_number; | 866 int gdb_register_number; |
867 int register_number; | 867 int register_number; |
868 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 868 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
869 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 869 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
870 | 870 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 int int_argreg; | 1062 int int_argreg; |
1063 int float_argreg; | 1063 int float_argreg; |
1064 int double_argreg; | 1064 int double_argreg; |
1065 int float_arg_index = 0; | 1065 int float_arg_index = 0; |
1066 int double_arg_index = 0; | 1066 int double_arg_index = 0; |
1067 int argnum; | 1067 int argnum; |
1068 struct type *type; | 1068 struct type *type; |
1069 CORE_ADDR regval; | 1069 CORE_ADDR regval; |
1070 char *val; | 1070 char *val; |
1071 char valbuf[8]; | 1071 char valbuf[8]; |
1072 char valbuf_tmp[8]; | |
1073 int len; | 1072 int len; |
1074 int argreg_size; | 1073 int argreg_size; |
1075 int fp_args[12]; | 1074 int fp_args[12]; |
1076 | 1075 |
1077 memset (fp_args, 0, sizeof (fp_args)); | 1076 memset (fp_args, 0, sizeof (fp_args)); |
1078 | 1077 |
1079 /* First force sp to a 8-byte alignment. */ | 1078 /* First force sp to a 8-byte alignment. */ |
1080 sp = sh64_frame_align (gdbarch, sp); | 1079 sp = sh64_frame_align (gdbarch, sp); |
1081 | 1080 |
1082 /* The "struct return pointer" pseudo-argument has its own dedicated | 1081 /* The "struct return pointer" pseudo-argument has its own dedicated |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 | 1319 |
1321 memcpy (buf + offset, valbuf, len); | 1320 memcpy (buf + offset, valbuf, len); |
1322 regcache_raw_write (regcache, return_register, buf); | 1321 regcache_raw_write (regcache, return_register, buf); |
1323 } | 1322 } |
1324 else | 1323 else |
1325 regcache_raw_write (regcache, return_register, valbuf); | 1324 regcache_raw_write (regcache, return_register, valbuf); |
1326 } | 1325 } |
1327 } | 1326 } |
1328 | 1327 |
1329 static enum return_value_convention | 1328 static enum return_value_convention |
1330 sh64_return_value (struct gdbarch *gdbarch, struct type *func_type, | 1329 sh64_return_value (struct gdbarch *gdbarch, struct value *function, |
1331 struct type *type, struct regcache *regcache, | 1330 struct type *type, struct regcache *regcache, |
1332 gdb_byte *readbuf, const gdb_byte *writebuf) | 1331 gdb_byte *readbuf, const gdb_byte *writebuf) |
1333 { | 1332 { |
1334 if (sh64_use_struct_convention (type)) | 1333 if (sh64_use_struct_convention (type)) |
1335 return RETURN_VALUE_STRUCT_CONVENTION; | 1334 return RETURN_VALUE_STRUCT_CONVENTION; |
1336 if (writebuf) | 1335 if (writebuf) |
1337 sh64_store_return_value (type, regcache, writebuf); | 1336 sh64_store_return_value (type, regcache, writebuf); |
1338 else if (readbuf) | 1337 else if (readbuf) |
1339 sh64_extract_return_value (type, regcache, readbuf); | 1338 sh64_extract_return_value (type, regcache, readbuf); |
1340 return RETURN_VALUE_REGISTER_CONVENTION; | 1339 return RETURN_VALUE_REGISTER_CONVENTION; |
1341 } | 1340 } |
1342 | 1341 |
1343 static void | |
1344 sh64_show_media_regs (struct frame_info *frame) | |
1345 { | |
1346 struct gdbarch *gdbarch = get_frame_arch (frame); | |
1347 int i; | |
1348 | |
1349 printf_filtered | |
1350 ("PC=%s SR=%s\n", | |
1351 phex (get_frame_register_unsigned (frame, | |
1352 gdbarch_pc_regnum (gdbarch)), 8), | |
1353 phex (get_frame_register_unsigned (frame, SR_REGNUM), 8)); | |
1354 | |
1355 printf_filtered | |
1356 ("SSR=%s SPC=%s\n", | |
1357 phex (get_frame_register_unsigned (frame, SSR_REGNUM), 8), | |
1358 phex (get_frame_register_unsigned (frame, SPC_REGNUM), 8)); | |
1359 printf_filtered | |
1360 ("FPSCR=%s\n ", | |
1361 phex (get_frame_register_unsigned (frame, FPSCR_REGNUM), 8)); | |
1362 | |
1363 for (i = 0; i < 64; i = i + 4) | |
1364 printf_filtered | |
1365 ("\nR%d-R%d %s %s %s %s\n", | |
1366 i, i + 3, | |
1367 phex (get_frame_register_unsigned (frame, i + 0), 8), | |
1368 phex (get_frame_register_unsigned (frame, i + 1), 8), | |
1369 phex (get_frame_register_unsigned (frame, i + 2), 8), | |
1370 phex (get_frame_register_unsigned (frame, i + 3), 8)); | |
1371 | |
1372 printf_filtered ("\n"); | |
1373 | |
1374 for (i = 0; i < 64; i = i + 8) | |
1375 printf_filtered | |
1376 ("FR%d-FR%d %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", | |
1377 i, i + 7, | |
1378 (long) get_frame_register_unsigned | |
1379 (frame, gdbarch_fp0_regnum (gdbarch) + i + 0), | |
1380 (long) get_frame_register_unsigned | |
1381 (frame, gdbarch_fp0_regnum (gdbarch) + i + 1), | |
1382 (long) get_frame_register_unsigned | |
1383 (frame, gdbarch_fp0_regnum (gdbarch) + i + 2), | |
1384 (long) get_frame_register_unsigned | |
1385 (frame, gdbarch_fp0_regnum (gdbarch) + i + 3), | |
1386 (long) get_frame_register_unsigned | |
1387 (frame, gdbarch_fp0_regnum (gdbarch) + i + 4), | |
1388 (long) get_frame_register_unsigned | |
1389 (frame, gdbarch_fp0_regnum (gdbarch) + i + 5), | |
1390 (long) get_frame_register_unsigned | |
1391 (frame, gdbarch_fp0_regnum (gdbarch) + i + 6), | |
1392 (long) get_frame_register_unsigned | |
1393 (frame, gdbarch_fp0_regnum (gdbarch) + i + 7)); | |
1394 } | |
1395 | |
1396 static void | |
1397 sh64_show_compact_regs (struct frame_info *frame) | |
1398 { | |
1399 struct gdbarch *gdbarch = get_frame_arch (frame); | |
1400 int i; | |
1401 | |
1402 printf_filtered | |
1403 ("PC=%s\n", | |
1404 phex (get_frame_register_unsigned (frame, PC_C_REGNUM), 8)); | |
1405 | |
1406 printf_filtered | |
1407 ("GBR=%08lx MACH=%08lx MACL=%08lx PR=%08lx T=%08lx\n", | |
1408 (long) get_frame_register_unsigned (frame, GBR_C_REGNUM), | |
1409 (long) get_frame_register_unsigned (frame, MACH_C_REGNUM), | |
1410 (long) get_frame_register_unsigned (frame, MACL_C_REGNUM), | |
1411 (long) get_frame_register_unsigned (frame, PR_C_REGNUM), | |
1412 (long) get_frame_register_unsigned (frame, T_C_REGNUM)); | |
1413 printf_filtered | |
1414 ("FPSCR=%08lx FPUL=%08lx\n", | |
1415 (long) get_frame_register_unsigned (frame, FPSCR_C_REGNUM), | |
1416 (long) get_frame_register_unsigned (frame, FPUL_C_REGNUM)); | |
1417 | |
1418 for (i = 0; i < 16; i = i + 4) | |
1419 printf_filtered | |
1420 ("\nR%d-R%d %08lx %08lx %08lx %08lx\n", | |
1421 i, i + 3, | |
1422 (long) get_frame_register_unsigned (frame, i + 0), | |
1423 (long) get_frame_register_unsigned (frame, i + 1), | |
1424 (long) get_frame_register_unsigned (frame, i + 2), | |
1425 (long) get_frame_register_unsigned (frame, i + 3)); | |
1426 | |
1427 printf_filtered ("\n"); | |
1428 | |
1429 for (i = 0; i < 16; i = i + 8) | |
1430 printf_filtered | |
1431 ("FR%d-FR%d %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n", | |
1432 i, i + 7, | |
1433 (long) get_frame_register_unsigned | |
1434 (frame, gdbarch_fp0_regnum (gdbarch) + i + 0), | |
1435 (long) get_frame_register_unsigned | |
1436 (frame, gdbarch_fp0_regnum (gdbarch) + i + 1), | |
1437 (long) get_frame_register_unsigned | |
1438 (frame, gdbarch_fp0_regnum (gdbarch) + i + 2), | |
1439 (long) get_frame_register_unsigned | |
1440 (frame, gdbarch_fp0_regnum (gdbarch) + i + 3), | |
1441 (long) get_frame_register_unsigned | |
1442 (frame, gdbarch_fp0_regnum (gdbarch) + i + 4), | |
1443 (long) get_frame_register_unsigned | |
1444 (frame, gdbarch_fp0_regnum (gdbarch) + i + 5), | |
1445 (long) get_frame_register_unsigned | |
1446 (frame, gdbarch_fp0_regnum (gdbarch) + i + 6), | |
1447 (long) get_frame_register_unsigned | |
1448 (frame, gdbarch_fp0_regnum (gdbarch) + i + 7)); | |
1449 } | |
1450 | |
1451 /* FIXME!!! This only shows the registers for shmedia, excluding the | |
1452 pseudo registers. */ | |
1453 void | |
1454 sh64_show_regs (struct frame_info *frame) | |
1455 { | |
1456 if (pc_is_isa32 (get_frame_pc (frame))) | |
1457 sh64_show_media_regs (frame); | |
1458 else | |
1459 sh64_show_compact_regs (frame); | |
1460 } | |
1461 | |
1462 /* *INDENT-OFF* */ | 1342 /* *INDENT-OFF* */ |
1463 /* | 1343 /* |
1464 SH MEDIA MODE (ISA 32) | 1344 SH MEDIA MODE (ISA 32) |
1465 general registers (64-bit) 0-63 | 1345 general registers (64-bit) 0-63 |
1466 0 r0, r1, r2, r3, r4, r5, r6, r7, | 1346 0 r0, r1, r2, r3, r4, r5, r6, r7, |
1467 64 r8, r9, r10, r11, r12, r13, r14, r15, | 1347 64 r8, r9, r10, r11, r12, r13, r14, r15, |
1468 128 r16, r17, r18, r19, r20, r21, r22, r23, | 1348 128 r16, r17, r18, r19, r20, r21, r22, r23, |
1469 192 r24, r25, r26, r27, r28, r29, r30, r31, | 1349 192 r24, r25, r26, r27, r28, r29, r30, r31, |
1470 256 r32, r33, r34, r35, r36, r37, r38, r39, | 1350 256 r32, r33, r34, r35, r36, r37, r38, r39, |
1471 320 r40, r41, r42, r43, r44, r45, r46, r47, | 1351 320 r40, r41, r42, r43, r44, r45, r46, r47, |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 sh64_elf_make_msymbol_special); | 2442 sh64_elf_make_msymbol_special); |
2563 | 2443 |
2564 /* Hook in ABI-specific overrides, if they have been registered. */ | 2444 /* Hook in ABI-specific overrides, if they have been registered. */ |
2565 gdbarch_init_osabi (info, gdbarch); | 2445 gdbarch_init_osabi (info, gdbarch); |
2566 | 2446 |
2567 dwarf2_append_unwinders (gdbarch); | 2447 dwarf2_append_unwinders (gdbarch); |
2568 frame_unwind_append_unwinder (gdbarch, &sh64_frame_unwind); | 2448 frame_unwind_append_unwinder (gdbarch, &sh64_frame_unwind); |
2569 | 2449 |
2570 return gdbarch; | 2450 return gdbarch; |
2571 } | 2451 } |
OLD | NEW |