Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: gdb/sh-tdep.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/sh-tdep.h ('k') | gdb/sh64-tdep.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
None
OLDNEW
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 23 matching lines...) Expand all
34 #include "inferior.h" 34 #include "inferior.h"
35 #include "gdb_string.h" 35 #include "gdb_string.h"
36 #include "gdb_assert.h" 36 #include "gdb_assert.h"
37 #include "arch-utils.h" 37 #include "arch-utils.h"
38 #include "floatformat.h" 38 #include "floatformat.h"
39 #include "regcache.h" 39 #include "regcache.h"
40 #include "doublest.h" 40 #include "doublest.h"
41 #include "osabi.h" 41 #include "osabi.h"
42 #include "reggroups.h" 42 #include "reggroups.h"
43 #include "regset.h" 43 #include "regset.h"
44 #include "objfiles.h"
44 45
45 #include "sh-tdep.h" 46 #include "sh-tdep.h"
47 #include "sh64-tdep.h"
46 48
47 #include "elf-bfd.h" 49 #include "elf-bfd.h"
48 #include "solib-svr4.h" 50 #include "solib-svr4.h"
49 51
50 /* sh flags */ 52 /* sh flags */
51 #include "elf/sh.h" 53 #include "elf/sh.h"
52 #include "dwarf2.h" 54 #include "dwarf2.h"
53 /* registers numbers shared with the simulator. */ 55 /* registers numbers shared with the simulator. */
54 #include "gdb/sim-sh.h" 56 #include "gdb/sim-sh.h"
55 57
56 /* List of "set sh ..." and "show sh ..." commands. */ 58 /* List of "set sh ..." and "show sh ..." commands. */
57 static struct cmd_list_element *setshcmdlist = NULL; 59 static struct cmd_list_element *setshcmdlist = NULL;
58 static struct cmd_list_element *showshcmdlist = NULL; 60 static struct cmd_list_element *showshcmdlist = NULL;
59 61
60 static const char sh_cc_gcc[] = "gcc"; 62 static const char sh_cc_gcc[] = "gcc";
61 static const char sh_cc_renesas[] = "renesas"; 63 static const char sh_cc_renesas[] = "renesas";
62 static const char *sh_cc_enum[] = { 64 static const char *const sh_cc_enum[] = {
63 sh_cc_gcc, 65 sh_cc_gcc,
64 sh_cc_renesas, 66 sh_cc_renesas,
65 NULL 67 NULL
66 }; 68 };
67 69
68 static const char *sh_active_calling_convention = sh_cc_gcc; 70 static const char *sh_active_calling_convention = sh_cc_gcc;
69 71
70 static void (*sh_show_regs) (struct frame_info *);
71
72 #define SH_NUM_REGS 67 72 #define SH_NUM_REGS 67
73 73
74 struct sh_frame_cache 74 struct sh_frame_cache
75 { 75 {
76 /* Base address. */ 76 /* Base address. */
77 CORE_ADDR base; 77 CORE_ADDR base;
78 LONGEST sp_offset; 78 LONGEST sp_offset;
79 CORE_ADDR pc; 79 CORE_ADDR pc;
80 80
81 /* Flag showing that a frame has been created in the prologue code. */ 81 /* Flag showing that a frame has been created in the prologue code. */
82 int uses_fp; 82 int uses_fp;
83 83
84 /* Saved registers. */ 84 /* Saved registers. */
85 CORE_ADDR saved_regs[SH_NUM_REGS]; 85 CORE_ADDR saved_regs[SH_NUM_REGS];
86 CORE_ADDR saved_sp; 86 CORE_ADDR saved_sp;
87 }; 87 };
88 88
89 static int 89 static int
90 sh_is_renesas_calling_convention (struct type *func_type) 90 sh_is_renesas_calling_convention (struct type *func_type)
91 { 91 {
92 return ((func_type 92 int val = 0;
93 » && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh) 93
94 » || sh_active_calling_convention == sh_cc_renesas); 94 if (func_type)
95 {
96 func_type = check_typedef (func_type);
97
98 if (TYPE_CODE (func_type) == TYPE_CODE_PTR)
99 func_type = check_typedef (TYPE_TARGET_TYPE (func_type));
100
101 if (TYPE_CODE (func_type) == TYPE_CODE_FUNC
102 && TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh)
103 val = 1;
104 }
105
106 if (sh_active_calling_convention == sh_cc_renesas)
107 val = 1;
108
109 return val;
95 } 110 }
96 111
97 static const char * 112 static const char *
98 sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr) 113 sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr)
99 { 114 {
100 static char *register_names[] = { 115 static char *register_names[] = {
101 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", 116 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
102 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", 117 "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
103 "pc", "pr", "gbr", "vbr", "mach", "macl", "sr", 118 "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
104 "", "", 119 "", "",
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 #define IS_RESTORE_FP(x) ((x) == 0x6ef6) 526 #define IS_RESTORE_FP(x) ((x) == 0x6ef6)
512 #define IS_RTS(x) ((x) == 0x000b) 527 #define IS_RTS(x) ((x) == 0x000b)
513 #define IS_LDS(x) ((x) == 0x4f26) 528 #define IS_LDS(x) ((x) == 0x4f26)
514 #define IS_MACL_LDS(x) ((x) == 0x4f16) 529 #define IS_MACL_LDS(x) ((x) == 0x4f16)
515 #define IS_MOV_FP_SP(x) ((x) == 0x6fe3) 530 #define IS_MOV_FP_SP(x) ((x) == 0x6fe3)
516 #define IS_ADD_REG_TO_FP(x) (((x) & 0xff0f) == 0x3e0c) 531 #define IS_ADD_REG_TO_FP(x) (((x) & 0xff0f) == 0x3e0c)
517 #define IS_ADD_IMM_FP(x) (((x) & 0xff00) == 0x7e00) 532 #define IS_ADD_IMM_FP(x) (((x) & 0xff00) == 0x7e00)
518 533
519 static CORE_ADDR 534 static CORE_ADDR
520 sh_analyze_prologue (struct gdbarch *gdbarch, 535 sh_analyze_prologue (struct gdbarch *gdbarch,
521 » » CORE_ADDR pc, CORE_ADDR current_pc, 536 » » CORE_ADDR pc, CORE_ADDR limit_pc,
522 struct sh_frame_cache *cache, ULONGEST fpscr) 537 struct sh_frame_cache *cache, ULONGEST fpscr)
523 { 538 {
524 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); 539 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
525 ULONGEST inst; 540 ULONGEST inst;
526 CORE_ADDR opc;
527 int offset; 541 int offset;
528 int sav_offset = 0; 542 int sav_offset = 0;
529 int r3_val = 0; 543 int r3_val = 0;
530 int reg, sav_reg = -1; 544 int reg, sav_reg = -1;
531 545
532 if (pc >= current_pc)
533 return current_pc;
534
535 cache->uses_fp = 0; 546 cache->uses_fp = 0;
536 for (opc = pc + (2 * 28); pc < opc; pc += 2) 547 for (; pc < limit_pc; pc += 2)
537 { 548 {
538 inst = read_memory_unsigned_integer (pc, 2, byte_order); 549 inst = read_memory_unsigned_integer (pc, 2, byte_order);
539 /* See where the registers will be saved to. */ 550 /* See where the registers will be saved to. */
540 if (IS_PUSH (inst)) 551 if (IS_PUSH (inst))
541 { 552 {
542 cache->saved_regs[GET_SOURCE_REG (inst)] = cache->sp_offset; 553 cache->saved_regs[GET_SOURCE_REG (inst)] = cache->sp_offset;
543 cache->sp_offset += 4; 554 cache->sp_offset += 4;
544 } 555 }
545 else if (IS_STS (inst)) 556 else if (IS_STS (inst))
546 { 557 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (reg < 14) 602 if (reg < 14)
592 { 603 {
593 sav_reg = reg; 604 sav_reg = reg;
594 offset = (inst & 0xff) << 2; 605 offset = (inst & 0xff) << 2;
595 sav_offset = 606 sav_offset =
596 read_memory_integer (((pc & 0xfffffffc) + 4) + offset, 607 read_memory_integer (((pc & 0xfffffffc) + 4) + offset,
597 4, byte_order); 608 4, byte_order);
598 } 609 }
599 } 610 }
600 } 611 }
601 else if (IS_MOVI20 (inst)) 612 else if (IS_MOVI20 (inst)
613 » && (pc + 2 < limit_pc))
602 { 614 {
603 if (sav_reg < 0) 615 if (sav_reg < 0)
604 { 616 {
605 reg = GET_TARGET_REG (inst); 617 reg = GET_TARGET_REG (inst);
606 if (reg < 14) 618 if (reg < 14)
607 { 619 {
608 sav_reg = reg; 620 sav_reg = reg;
609 sav_offset = GET_SOURCE_REG (inst) << 16; 621 sav_offset = GET_SOURCE_REG (inst) << 16;
610 /* MOVI20 is a 32 bit instruction! */ 622 /* MOVI20 is a 32 bit instruction! */
611 pc += 2; 623 pc += 2;
(...skipping 21 matching lines...) Expand all
633 { 645 {
634 cache->sp_offset += 8; 646 cache->sp_offset += 8;
635 } 647 }
636 else 648 else
637 { 649 {
638 cache->sp_offset += 4; 650 cache->sp_offset += 4;
639 } 651 }
640 } 652 }
641 else if (IS_MOV_SP_FP (inst)) 653 else if (IS_MOV_SP_FP (inst))
642 { 654 {
655 pc += 2;
656 /* Don't go any further than six more instructions. */
657 limit_pc = min (limit_pc, pc + (2 * 6));
658
643 cache->uses_fp = 1; 659 cache->uses_fp = 1;
644 /* At this point, only allow argument register moves to other 660 /* At this point, only allow argument register moves to other
645 registers or argument register moves to @(X,fp) which are 661 registers or argument register moves to @(X,fp) which are
646 moving the register arguments onto the stack area allocated 662 moving the register arguments onto the stack area allocated
647 by a former add somenumber to SP call. Don't allow moving 663 by a former add somenumber to SP call. Don't allow moving
648 to an fp indirect address above fp + cache->sp_offset. */ 664 to an fp indirect address above fp + cache->sp_offset. */
649 » pc += 2; 665 » for (; pc < limit_pc; pc += 2)
650 » for (opc = pc + 12; pc < opc; pc += 2)
651 { 666 {
652 inst = read_memory_integer (pc, 2, byte_order); 667 inst = read_memory_integer (pc, 2, byte_order);
653 if (IS_MOV_ARG_TO_IND_R14 (inst)) 668 if (IS_MOV_ARG_TO_IND_R14 (inst))
654 { 669 {
655 reg = GET_SOURCE_REG (inst); 670 reg = GET_SOURCE_REG (inst);
656 if (cache->sp_offset > 0) 671 if (cache->sp_offset > 0)
657 cache->saved_regs[reg] = cache->sp_offset; 672 cache->saved_regs[reg] = cache->sp_offset;
658 } 673 }
659 else if (IS_MOV_ARG_TO_IND_R14_WITH_DISP (inst)) 674 else if (IS_MOV_ARG_TO_IND_R14_WITH_DISP (inst))
660 { 675 {
(...skipping 11 matching lines...) Expand all
672 } 687 }
673 else if (IS_JSR (inst)) 688 else if (IS_JSR (inst))
674 { 689 {
675 /* We have found a jsr that has been scheduled into the prologue. 690 /* We have found a jsr that has been scheduled into the prologue.
676 If we continue the scan and return a pc someplace after this, 691 If we continue the scan and return a pc someplace after this,
677 then setting a breakpoint on this function will cause it to 692 then setting a breakpoint on this function will cause it to
678 appear to be called after the function it is calling via the 693 appear to be called after the function it is calling via the
679 jsr, which will be very confusing. Most likely the next 694 jsr, which will be very confusing. Most likely the next
680 instruction is going to be IS_MOV_SP_FP in the delay slot. If 695 instruction is going to be IS_MOV_SP_FP in the delay slot. If
681 so, note that before returning the current pc. */ 696 so, note that before returning the current pc. */
682 » inst = read_memory_integer (pc + 2, 2, byte_order); 697 » if (pc + 2 < limit_pc)
683 » if (IS_MOV_SP_FP (inst)) 698 » {
684 » cache->uses_fp = 1; 699 » inst = read_memory_integer (pc + 2, 2, byte_order);
700 » if (IS_MOV_SP_FP (inst))
701 » » cache->uses_fp = 1;
702 » }
685 break; 703 break;
686 } 704 }
687 #if 0 /* This used to just stop when it found an instruction 705 #if 0 /* This used to just stop when it found an instruction
688 that was not considered part of the prologue. Now, 706 that was not considered part of the prologue. Now,
689 we just keep going looking for likely 707 we just keep going looking for likely
690 instructions. */ 708 instructions. */
691 else 709 else
692 break; 710 break;
693 #endif 711 #endif
694 } 712 }
695 713
696 return pc; 714 return pc;
697 } 715 }
698 716
699 /* Skip any prologue before the guts of a function. */ 717 /* Skip any prologue before the guts of a function. */
700
701 /* Skip the prologue using the debug information. If this fails we'll
702 fall back on the 'guess' method below. */
703 static CORE_ADDR 718 static CORE_ADDR
704 after_prologue (CORE_ADDR pc) 719 sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
705 { 720 {
706 struct symtab_and_line sal; 721 CORE_ADDR post_prologue_pc, func_addr, func_end_addr, limit_pc;
707 CORE_ADDR func_addr, func_end;
708
709 /* If we can not find the symbol in the partial symbol table, then
710 there is no hope we can determine the function's start address
711 with this code. */
712 if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
713 return 0;
714
715 /* Get the line associated with FUNC_ADDR. */
716 sal = find_pc_line (func_addr, 0);
717
718 /* There are only two cases to consider. First, the end of the source line
719 is within the function bounds. In that case we return the end of the
720 source line. Second is the end of the source line extends beyond the
721 bounds of the current function. We need to use the slow code to
722 examine instructions in that case. */
723 if (sal.end < func_end)
724 return sal.end;
725 else
726 return 0;
727 }
728
729 static CORE_ADDR
730 sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
731 {
732 CORE_ADDR pc;
733 struct sh_frame_cache cache; 722 struct sh_frame_cache cache;
734 723
735 /* See if we can determine the end of the prologue via the symbol table. 724 /* See if we can determine the end of the prologue via the symbol table.
736 If so, then return either PC, or the PC after the prologue, whichever 725 If so, then return either PC, or the PC after the prologue, whichever
737 is greater. */ 726 is greater. */
738 pc = after_prologue (start_pc); 727 if (find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr))
728 {
729 post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
730 if (post_prologue_pc != 0)
731 return max (pc, post_prologue_pc);
732 }
739 733
740 /* If after_prologue returned a useful address, then use it. Else 734 /* Can't determine prologue from the symbol table, need to examine
741 fall back on the instruction skipping code. */ 735 instructions. */
742 if (pc) 736
743 return max (pc, start_pc); 737 /* Find an upper limit on the function prologue using the debug
738 information. If the debug information could not be used to provide
739 that bound, then use an arbitrary large number as the upper bound. */
740 limit_pc = skip_prologue_using_sal (gdbarch, pc);
741 if (limit_pc == 0)
742 /* Don't go any further than 28 instructions. */
743 limit_pc = pc + (2 * 28);
744
745 /* Do not allow limit_pc to be past the function end, if we know
746 where that end is... */
747 if (func_end_addr != 0)
748 limit_pc = min (limit_pc, func_end_addr);
744 749
745 cache.sp_offset = -4; 750 cache.sp_offset = -4;
746 pc = sh_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, 0); 751 post_prologue_pc = sh_analyze_prologue (gdbarch, pc, limit_pc, &cache, 0);
747 if (!cache.uses_fp) 752 if (cache.uses_fp)
748 return start_pc; 753 pc = post_prologue_pc;
749 754
750 return pc; 755 return pc;
751 } 756 }
752 757
753 /* The ABI says: 758 /* The ABI says:
754 759
755 Aggregate types not bigger than 8 bytes that have the same size and 760 Aggregate types not bigger than 8 bytes that have the same size and
756 alignment as one of the integer scalar types are returned in the 761 alignment as one of the integer scalar types are returned in the
757 same registers as the integer type they match. 762 same registers as the integer type they match.
758 763
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 regcache_raw_write (regcache, regnum++, 1389 regcache_raw_write (regcache, regnum++,
1385 (char *) valbuf + len - 4 - i); 1390 (char *) valbuf + len - 4 - i);
1386 else 1391 else
1387 regcache_raw_write (regcache, regnum++, (char *) valbuf + i); 1392 regcache_raw_write (regcache, regnum++, (char *) valbuf + i);
1388 } 1393 }
1389 else 1394 else
1390 sh_store_return_value_nofpu (type, regcache, valbuf); 1395 sh_store_return_value_nofpu (type, regcache, valbuf);
1391 } 1396 }
1392 1397
1393 static enum return_value_convention 1398 static enum return_value_convention
1394 sh_return_value_nofpu (struct gdbarch *gdbarch, struct type *func_type, 1399 sh_return_value_nofpu (struct gdbarch *gdbarch, struct value *function,
1395 struct type *type, struct regcache *regcache, 1400 struct type *type, struct regcache *regcache,
1396 gdb_byte *readbuf, const gdb_byte *writebuf) 1401 gdb_byte *readbuf, const gdb_byte *writebuf)
1397 { 1402 {
1403 struct type *func_type = function ? value_type (function) : NULL;
1404
1398 if (sh_use_struct_convention_nofpu ( 1405 if (sh_use_struct_convention_nofpu (
1399 sh_is_renesas_calling_convention (func_type), type)) 1406 sh_is_renesas_calling_convention (func_type), type))
1400 return RETURN_VALUE_STRUCT_CONVENTION; 1407 return RETURN_VALUE_STRUCT_CONVENTION;
1401 if (writebuf) 1408 if (writebuf)
1402 sh_store_return_value_nofpu (type, regcache, writebuf); 1409 sh_store_return_value_nofpu (type, regcache, writebuf);
1403 else if (readbuf) 1410 else if (readbuf)
1404 sh_extract_return_value_nofpu (type, regcache, readbuf); 1411 sh_extract_return_value_nofpu (type, regcache, readbuf);
1405 return RETURN_VALUE_REGISTER_CONVENTION; 1412 return RETURN_VALUE_REGISTER_CONVENTION;
1406 } 1413 }
1407 1414
1408 static enum return_value_convention 1415 static enum return_value_convention
1409 sh_return_value_fpu (struct gdbarch *gdbarch, struct type *func_type, 1416 sh_return_value_fpu (struct gdbarch *gdbarch, struct value *function,
1410 struct type *type, struct regcache *regcache, 1417 struct type *type, struct regcache *regcache,
1411 gdb_byte *readbuf, const gdb_byte *writebuf) 1418 gdb_byte *readbuf, const gdb_byte *writebuf)
1412 { 1419 {
1420 struct type *func_type = function ? value_type (function) : NULL;
1421
1413 if (sh_use_struct_convention ( 1422 if (sh_use_struct_convention (
1414 sh_is_renesas_calling_convention (func_type), type)) 1423 sh_is_renesas_calling_convention (func_type), type))
1415 return RETURN_VALUE_STRUCT_CONVENTION; 1424 return RETURN_VALUE_STRUCT_CONVENTION;
1416 if (writebuf) 1425 if (writebuf)
1417 sh_store_return_value_fpu (type, regcache, writebuf); 1426 sh_store_return_value_fpu (type, regcache, writebuf);
1418 else if (readbuf) 1427 else if (readbuf)
1419 sh_extract_return_value_fpu (type, regcache, readbuf); 1428 sh_extract_return_value_fpu (type, regcache, readbuf);
1420 return RETURN_VALUE_REGISTER_CONVENTION; 1429 return RETURN_VALUE_REGISTER_CONVENTION;
1421 } 1430 }
1422 1431
1423 /* Print the registers in a form similar to the E7000. */
1424
1425 static void
1426 sh_generic_show_regs (struct frame_info *frame)
1427 {
1428 printf_filtered
1429 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1430 phex (get_frame_register_unsigned (frame,
1431 gdbarch_pc_regnum
1432 (get_frame_arch (frame))), 4),
1433 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1434 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1435 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1436
1437 printf_filtered
1438 (" GBR %08lx VBR %08lx MACL %08lx\n",
1439 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1440 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1441 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1442
1443 printf_filtered
1444 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1445 (long) get_frame_register_unsigned (frame, 0),
1446 (long) get_frame_register_unsigned (frame, 1),
1447 (long) get_frame_register_unsigned (frame, 2),
1448 (long) get_frame_register_unsigned (frame, 3),
1449 (long) get_frame_register_unsigned (frame, 4),
1450 (long) get_frame_register_unsigned (frame, 5),
1451 (long) get_frame_register_unsigned (frame, 6),
1452 (long) get_frame_register_unsigned (frame, 7));
1453 printf_filtered
1454 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1455 (long) get_frame_register_unsigned (frame, 8),
1456 (long) get_frame_register_unsigned (frame, 9),
1457 (long) get_frame_register_unsigned (frame, 10),
1458 (long) get_frame_register_unsigned (frame, 11),
1459 (long) get_frame_register_unsigned (frame, 12),
1460 (long) get_frame_register_unsigned (frame, 13),
1461 (long) get_frame_register_unsigned (frame, 14),
1462 (long) get_frame_register_unsigned (frame, 15));
1463 }
1464
1465 static void
1466 sh3_show_regs (struct frame_info *frame)
1467 {
1468 printf_filtered
1469 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1470 phex (get_frame_register_unsigned (frame,
1471 gdbarch_pc_regnum
1472 (get_frame_arch (frame))), 4),
1473 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1474 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1475 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1476
1477 printf_filtered
1478 (" GBR %08lx VBR %08lx MACL %08lx\n",
1479 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1480 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1481 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1482 printf_filtered
1483 (" SSR %08lx SPC %08lx\n",
1484 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1485 (long) get_frame_register_unsigned (frame, SPC_REGNUM));
1486
1487 printf_filtered
1488 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1489 (long) get_frame_register_unsigned (frame, 0),
1490 (long) get_frame_register_unsigned (frame, 1),
1491 (long) get_frame_register_unsigned (frame, 2),
1492 (long) get_frame_register_unsigned (frame, 3),
1493 (long) get_frame_register_unsigned (frame, 4),
1494 (long) get_frame_register_unsigned (frame, 5),
1495 (long) get_frame_register_unsigned (frame, 6),
1496 (long) get_frame_register_unsigned (frame, 7));
1497 printf_filtered
1498 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1499 (long) get_frame_register_unsigned (frame, 8),
1500 (long) get_frame_register_unsigned (frame, 9),
1501 (long) get_frame_register_unsigned (frame, 10),
1502 (long) get_frame_register_unsigned (frame, 11),
1503 (long) get_frame_register_unsigned (frame, 12),
1504 (long) get_frame_register_unsigned (frame, 13),
1505 (long) get_frame_register_unsigned (frame, 14),
1506 (long) get_frame_register_unsigned (frame, 15));
1507 }
1508
1509 static void
1510 sh2e_show_regs (struct frame_info *frame)
1511 {
1512 struct gdbarch *gdbarch = get_frame_arch (frame);
1513 printf_filtered
1514 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1515 phex (get_frame_register_unsigned (frame,
1516 gdbarch_pc_regnum (gdbarch)), 4),
1517 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1518 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1519 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1520
1521 printf_filtered
1522 (" GBR %08lx VBR %08lx MACL %08lx\n",
1523 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1524 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1525 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1526 printf_filtered
1527 (" SSR %08lx SPC %08lx FPUL %08lx FPSCR %08lx\n",
1528 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1529 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
1530 (long) get_frame_register_unsigned (frame, FPUL_REGNUM),
1531 (long) get_frame_register_unsigned (frame, FPSCR_REGNUM));
1532
1533 printf_filtered
1534 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1535 (long) get_frame_register_unsigned (frame, 0),
1536 (long) get_frame_register_unsigned (frame, 1),
1537 (long) get_frame_register_unsigned (frame, 2),
1538 (long) get_frame_register_unsigned (frame, 3),
1539 (long) get_frame_register_unsigned (frame, 4),
1540 (long) get_frame_register_unsigned (frame, 5),
1541 (long) get_frame_register_unsigned (frame, 6),
1542 (long) get_frame_register_unsigned (frame, 7));
1543 printf_filtered
1544 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1545 (long) get_frame_register_unsigned (frame, 8),
1546 (long) get_frame_register_unsigned (frame, 9),
1547 (long) get_frame_register_unsigned (frame, 10),
1548 (long) get_frame_register_unsigned (frame, 11),
1549 (long) get_frame_register_unsigned (frame, 12),
1550 (long) get_frame_register_unsigned (frame, 13),
1551 (long) get_frame_register_unsigned (frame, 14),
1552 (long) get_frame_register_unsigned (frame, 15));
1553
1554 printf_filtered
1555 ("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1556 (long) get_frame_register_unsigned
1557 (frame, gdbarch_fp0_regnum (gdbarch) + 0),
1558 (long) get_frame_register_unsigned
1559 (frame, gdbarch_fp0_regnum (gdbarch) + 1),
1560 (long) get_frame_register_unsigned
1561 (frame, gdbarch_fp0_regnum (gdbarch) + 2),
1562 (long) get_frame_register_unsigned
1563 (frame, gdbarch_fp0_regnum (gdbarch) + 3),
1564 (long) get_frame_register_unsigned
1565 (frame, gdbarch_fp0_regnum (gdbarch) + 4),
1566 (long) get_frame_register_unsigned
1567 (frame, gdbarch_fp0_regnum (gdbarch) + 5),
1568 (long) get_frame_register_unsigned
1569 (frame, gdbarch_fp0_regnum (gdbarch) + 6),
1570 (long) get_frame_register_unsigned
1571 (frame, gdbarch_fp0_regnum (gdbarch) + 7));
1572 printf_filtered
1573 ("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1574 (long) get_frame_register_unsigned
1575 (frame, gdbarch_fp0_regnum (gdbarch) + 8),
1576 (long) get_frame_register_unsigned
1577 (frame, gdbarch_fp0_regnum (gdbarch) + 9),
1578 (long) get_frame_register_unsigned
1579 (frame, gdbarch_fp0_regnum (gdbarch) + 10),
1580 (long) get_frame_register_unsigned
1581 (frame, gdbarch_fp0_regnum (gdbarch) + 11),
1582 (long) get_frame_register_unsigned
1583 (frame, gdbarch_fp0_regnum (gdbarch) + 12),
1584 (long) get_frame_register_unsigned
1585 (frame, gdbarch_fp0_regnum (gdbarch) + 13),
1586 (long) get_frame_register_unsigned
1587 (frame, gdbarch_fp0_regnum (gdbarch) + 14),
1588 (long) get_frame_register_unsigned
1589 (frame, gdbarch_fp0_regnum (gdbarch) + 15));
1590 }
1591
1592 static void
1593 sh2a_show_regs (struct frame_info *frame)
1594 {
1595 struct gdbarch *gdbarch = get_frame_arch (frame);
1596 int pr = get_frame_register_unsigned (frame, FPSCR_REGNUM) & 0x80000;
1597
1598 printf_filtered
1599 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1600 phex (get_frame_register_unsigned (frame,
1601 gdbarch_pc_regnum (gdbarch)), 4),
1602 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1603 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1604 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1605
1606 printf_filtered
1607 (" GBR %08lx VBR %08lx TBR %08lx MACL %08lx\n",
1608 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1609 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1610 (long) get_frame_register_unsigned (frame, TBR_REGNUM),
1611 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1612 printf_filtered
1613 (" SSR %08lx SPC %08lx FPUL %08lx FPSCR %08lx\n",
1614 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1615 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
1616 (long) get_frame_register_unsigned (frame, FPUL_REGNUM),
1617 (long) get_frame_register_unsigned (frame, FPSCR_REGNUM));
1618
1619 printf_filtered
1620 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1621 (long) get_frame_register_unsigned (frame, 0),
1622 (long) get_frame_register_unsigned (frame, 1),
1623 (long) get_frame_register_unsigned (frame, 2),
1624 (long) get_frame_register_unsigned (frame, 3),
1625 (long) get_frame_register_unsigned (frame, 4),
1626 (long) get_frame_register_unsigned (frame, 5),
1627 (long) get_frame_register_unsigned (frame, 6),
1628 (long) get_frame_register_unsigned (frame, 7));
1629 printf_filtered
1630 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1631 (long) get_frame_register_unsigned (frame, 8),
1632 (long) get_frame_register_unsigned (frame, 9),
1633 (long) get_frame_register_unsigned (frame, 10),
1634 (long) get_frame_register_unsigned (frame, 11),
1635 (long) get_frame_register_unsigned (frame, 12),
1636 (long) get_frame_register_unsigned (frame, 13),
1637 (long) get_frame_register_unsigned (frame, 14),
1638 (long) get_frame_register_unsigned (frame, 15));
1639
1640 printf_filtered
1641 (pr ? "DR0-DR6 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n"
1642 : "FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1643 (long) get_frame_register_unsigned
1644 (frame, gdbarch_fp0_regnum (gdbarch) + 0),
1645 (long) get_frame_register_unsigned
1646 (frame, gdbarch_fp0_regnum (gdbarch) + 1),
1647 (long) get_frame_register_unsigned
1648 (frame, gdbarch_fp0_regnum (gdbarch) + 2),
1649 (long) get_frame_register_unsigned
1650 (frame, gdbarch_fp0_regnum (gdbarch) + 3),
1651 (long) get_frame_register_unsigned
1652 (frame, gdbarch_fp0_regnum (gdbarch) + 4),
1653 (long) get_frame_register_unsigned
1654 (frame, gdbarch_fp0_regnum (gdbarch) + 5),
1655 (long) get_frame_register_unsigned
1656 (frame, gdbarch_fp0_regnum (gdbarch) + 6),
1657 (long) get_frame_register_unsigned
1658 (frame, gdbarch_fp0_regnum (gdbarch) + 7));
1659 printf_filtered
1660 (pr ? "DR8-DR14 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n"
1661 : "FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1662 (long) get_frame_register_unsigned
1663 (frame, gdbarch_fp0_regnum (gdbarch) + 8),
1664 (long) get_frame_register_unsigned
1665 (frame, gdbarch_fp0_regnum (gdbarch) + 9),
1666 (long) get_frame_register_unsigned
1667 (frame, gdbarch_fp0_regnum (gdbarch) + 10),
1668 (long) get_frame_register_unsigned
1669 (frame, gdbarch_fp0_regnum (gdbarch) + 11),
1670 (long) get_frame_register_unsigned
1671 (frame, gdbarch_fp0_regnum (gdbarch) + 12),
1672 (long) get_frame_register_unsigned
1673 (frame, gdbarch_fp0_regnum (gdbarch) + 13),
1674 (long) get_frame_register_unsigned
1675 (frame, gdbarch_fp0_regnum (gdbarch) + 14),
1676 (long) get_frame_register_unsigned
1677 (frame, gdbarch_fp0_regnum (gdbarch) + 15));
1678 printf_filtered
1679 ("BANK=%-3d\n", (int) get_frame_register_unsigned (frame, BANK_REGNUM));
1680 printf_filtered
1681 ("R0b-R7b %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1682 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 0),
1683 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 1),
1684 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 2),
1685 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 3),
1686 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 4),
1687 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 5),
1688 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 6),
1689 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 7));
1690 printf_filtered
1691 ("R8b-R14b %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1692 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 8),
1693 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 9),
1694 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 10),
1695 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 11),
1696 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 12),
1697 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 13),
1698 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 14));
1699 printf_filtered
1700 ("MACHb=%08lx IVNb=%08lx PRb=%08lx GBRb=%08lx MACLb=%08lx\n",
1701 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 15),
1702 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 16),
1703 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 17),
1704 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 18),
1705 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 19));
1706 }
1707
1708 static void
1709 sh2a_nofpu_show_regs (struct frame_info *frame)
1710 {
1711 int pr = get_frame_register_unsigned (frame, FPSCR_REGNUM) & 0x80000;
1712
1713 printf_filtered
1714 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1715 phex (get_frame_register_unsigned (frame,
1716 gdbarch_pc_regnum
1717 (get_frame_arch (frame))), 4),
1718 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1719 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1720 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1721
1722 printf_filtered
1723 (" GBR %08lx VBR %08lx TBR %08lx MACL %08lx\n",
1724 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1725 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1726 (long) get_frame_register_unsigned (frame, TBR_REGNUM),
1727 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1728 printf_filtered
1729 (" SSR %08lx SPC %08lx FPUL %08lx FPSCR %08lx\n",
1730 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1731 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
1732 (long) get_frame_register_unsigned (frame, FPUL_REGNUM),
1733 (long) get_frame_register_unsigned (frame, FPSCR_REGNUM));
1734
1735 printf_filtered
1736 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1737 (long) get_frame_register_unsigned (frame, 0),
1738 (long) get_frame_register_unsigned (frame, 1),
1739 (long) get_frame_register_unsigned (frame, 2),
1740 (long) get_frame_register_unsigned (frame, 3),
1741 (long) get_frame_register_unsigned (frame, 4),
1742 (long) get_frame_register_unsigned (frame, 5),
1743 (long) get_frame_register_unsigned (frame, 6),
1744 (long) get_frame_register_unsigned (frame, 7));
1745 printf_filtered
1746 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1747 (long) get_frame_register_unsigned (frame, 8),
1748 (long) get_frame_register_unsigned (frame, 9),
1749 (long) get_frame_register_unsigned (frame, 10),
1750 (long) get_frame_register_unsigned (frame, 11),
1751 (long) get_frame_register_unsigned (frame, 12),
1752 (long) get_frame_register_unsigned (frame, 13),
1753 (long) get_frame_register_unsigned (frame, 14),
1754 (long) get_frame_register_unsigned (frame, 15));
1755
1756 printf_filtered
1757 ("BANK=%-3d\n", (int) get_frame_register_unsigned (frame, BANK_REGNUM));
1758 printf_filtered
1759 ("R0b-R7b %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1760 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 0),
1761 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 1),
1762 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 2),
1763 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 3),
1764 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 4),
1765 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 5),
1766 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 6),
1767 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 7));
1768 printf_filtered
1769 ("R8b-R14b %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1770 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 8),
1771 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 9),
1772 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 10),
1773 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 11),
1774 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 12),
1775 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 13),
1776 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 14));
1777 printf_filtered
1778 ("MACHb=%08lx IVNb=%08lx PRb=%08lx GBRb=%08lx MACLb=%08lx\n",
1779 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 15),
1780 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 16),
1781 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 17),
1782 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 18),
1783 (long) get_frame_register_unsigned (frame, R0_BANK0_REGNUM + 19));
1784 }
1785
1786 static void
1787 sh3e_show_regs (struct frame_info *frame)
1788 {
1789 struct gdbarch *gdbarch = get_frame_arch (frame);
1790 printf_filtered
1791 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1792 phex (get_frame_register_unsigned (frame,
1793 gdbarch_pc_regnum (gdbarch)), 4),
1794 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1795 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1796 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1797
1798 printf_filtered
1799 (" GBR %08lx VBR %08lx MACL %08lx\n",
1800 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1801 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1802 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1803 printf_filtered
1804 (" SSR %08lx SPC %08lx FPUL %08lx FPSCR %08lx\n",
1805 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1806 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
1807 (long) get_frame_register_unsigned (frame, FPUL_REGNUM),
1808 (long) get_frame_register_unsigned (frame, FPSCR_REGNUM));
1809
1810 printf_filtered
1811 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1812 (long) get_frame_register_unsigned (frame, 0),
1813 (long) get_frame_register_unsigned (frame, 1),
1814 (long) get_frame_register_unsigned (frame, 2),
1815 (long) get_frame_register_unsigned (frame, 3),
1816 (long) get_frame_register_unsigned (frame, 4),
1817 (long) get_frame_register_unsigned (frame, 5),
1818 (long) get_frame_register_unsigned (frame, 6),
1819 (long) get_frame_register_unsigned (frame, 7));
1820 printf_filtered
1821 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1822 (long) get_frame_register_unsigned (frame, 8),
1823 (long) get_frame_register_unsigned (frame, 9),
1824 (long) get_frame_register_unsigned (frame, 10),
1825 (long) get_frame_register_unsigned (frame, 11),
1826 (long) get_frame_register_unsigned (frame, 12),
1827 (long) get_frame_register_unsigned (frame, 13),
1828 (long) get_frame_register_unsigned (frame, 14),
1829 (long) get_frame_register_unsigned (frame, 15));
1830
1831 printf_filtered
1832 ("FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1833 (long) get_frame_register_unsigned
1834 (frame, gdbarch_fp0_regnum (gdbarch) + 0),
1835 (long) get_frame_register_unsigned
1836 (frame, gdbarch_fp0_regnum (gdbarch) + 1),
1837 (long) get_frame_register_unsigned
1838 (frame, gdbarch_fp0_regnum (gdbarch) + 2),
1839 (long) get_frame_register_unsigned
1840 (frame, gdbarch_fp0_regnum (gdbarch) + 3),
1841 (long) get_frame_register_unsigned
1842 (frame, gdbarch_fp0_regnum (gdbarch) + 4),
1843 (long) get_frame_register_unsigned
1844 (frame, gdbarch_fp0_regnum (gdbarch) + 5),
1845 (long) get_frame_register_unsigned
1846 (frame, gdbarch_fp0_regnum (gdbarch) + 6),
1847 (long) get_frame_register_unsigned
1848 (frame, gdbarch_fp0_regnum (gdbarch) + 7));
1849 printf_filtered
1850 ("FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1851 (long) get_frame_register_unsigned
1852 (frame, gdbarch_fp0_regnum (gdbarch) + 8),
1853 (long) get_frame_register_unsigned
1854 (frame, gdbarch_fp0_regnum (gdbarch) + 9),
1855 (long) get_frame_register_unsigned
1856 (frame, gdbarch_fp0_regnum (gdbarch) + 10),
1857 (long) get_frame_register_unsigned
1858 (frame, gdbarch_fp0_regnum (gdbarch) + 11),
1859 (long) get_frame_register_unsigned
1860 (frame, gdbarch_fp0_regnum (gdbarch) + 12),
1861 (long) get_frame_register_unsigned
1862 (frame, gdbarch_fp0_regnum (gdbarch) + 13),
1863 (long) get_frame_register_unsigned
1864 (frame, gdbarch_fp0_regnum (gdbarch) + 14),
1865 (long) get_frame_register_unsigned
1866 (frame, gdbarch_fp0_regnum (gdbarch) + 15));
1867 }
1868
1869 static void
1870 sh3_dsp_show_regs (struct frame_info *frame)
1871 {
1872 printf_filtered
1873 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1874 phex (get_frame_register_unsigned (frame,
1875 gdbarch_pc_regnum
1876 (get_frame_arch (frame))), 4),
1877 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1878 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1879 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1880
1881 printf_filtered
1882 (" GBR %08lx VBR %08lx MACL %08lx\n",
1883 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1884 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1885 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1886
1887 printf_filtered
1888 (" SSR %08lx SPC %08lx DSR %08lx\n",
1889 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1890 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
1891 (long) get_frame_register_unsigned (frame, DSR_REGNUM));
1892
1893 printf_filtered
1894 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1895 (long) get_frame_register_unsigned (frame, 0),
1896 (long) get_frame_register_unsigned (frame, 1),
1897 (long) get_frame_register_unsigned (frame, 2),
1898 (long) get_frame_register_unsigned (frame, 3),
1899 (long) get_frame_register_unsigned (frame, 4),
1900 (long) get_frame_register_unsigned (frame, 5),
1901 (long) get_frame_register_unsigned (frame, 6),
1902 (long) get_frame_register_unsigned (frame, 7));
1903 printf_filtered
1904 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1905 (long) get_frame_register_unsigned (frame, 8),
1906 (long) get_frame_register_unsigned (frame, 9),
1907 (long) get_frame_register_unsigned (frame, 10),
1908 (long) get_frame_register_unsigned (frame, 11),
1909 (long) get_frame_register_unsigned (frame, 12),
1910 (long) get_frame_register_unsigned (frame, 13),
1911 (long) get_frame_register_unsigned (frame, 14),
1912 (long) get_frame_register_unsigned (frame, 15));
1913
1914 printf_filtered
1915 ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n",
1916 (long) get_frame_register_unsigned (frame, A0G_REGNUM) & 0xff,
1917 (long) get_frame_register_unsigned (frame, A0_REGNUM),
1918 (long) get_frame_register_unsigned (frame, M0_REGNUM),
1919 (long) get_frame_register_unsigned (frame, X0_REGNUM),
1920 (long) get_frame_register_unsigned (frame, Y0_REGNUM),
1921 (long) get_frame_register_unsigned (frame, RS_REGNUM),
1922 (long) get_frame_register_unsigned (frame, MOD_REGNUM));
1923 printf_filtered
1924 ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n",
1925 (long) get_frame_register_unsigned (frame, A1G_REGNUM) & 0xff,
1926 (long) get_frame_register_unsigned (frame, A1_REGNUM),
1927 (long) get_frame_register_unsigned (frame, M1_REGNUM),
1928 (long) get_frame_register_unsigned (frame, X1_REGNUM),
1929 (long) get_frame_register_unsigned (frame, Y1_REGNUM),
1930 (long) get_frame_register_unsigned (frame, RE_REGNUM));
1931 }
1932
1933 static void
1934 sh4_show_regs (struct frame_info *frame)
1935 {
1936 struct gdbarch *gdbarch = get_frame_arch (frame);
1937 int pr = get_frame_register_unsigned (frame, FPSCR_REGNUM) & 0x80000;
1938
1939 printf_filtered
1940 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
1941 phex (get_frame_register_unsigned (frame,
1942 gdbarch_pc_regnum (gdbarch)), 4),
1943 (long) get_frame_register_unsigned (frame, SR_REGNUM),
1944 (long) get_frame_register_unsigned (frame, PR_REGNUM),
1945 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
1946
1947 printf_filtered
1948 (" GBR %08lx VBR %08lx MACL %08lx\n",
1949 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
1950 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
1951 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
1952 printf_filtered
1953 (" SSR %08lx SPC %08lx FPUL %08lx FPSCR %08lx\n",
1954 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
1955 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
1956 (long) get_frame_register_unsigned (frame, FPUL_REGNUM),
1957 (long) get_frame_register_unsigned (frame, FPSCR_REGNUM));
1958
1959 printf_filtered
1960 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1961 (long) get_frame_register_unsigned (frame, 0),
1962 (long) get_frame_register_unsigned (frame, 1),
1963 (long) get_frame_register_unsigned (frame, 2),
1964 (long) get_frame_register_unsigned (frame, 3),
1965 (long) get_frame_register_unsigned (frame, 4),
1966 (long) get_frame_register_unsigned (frame, 5),
1967 (long) get_frame_register_unsigned (frame, 6),
1968 (long) get_frame_register_unsigned (frame, 7));
1969 printf_filtered
1970 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1971 (long) get_frame_register_unsigned (frame, 8),
1972 (long) get_frame_register_unsigned (frame, 9),
1973 (long) get_frame_register_unsigned (frame, 10),
1974 (long) get_frame_register_unsigned (frame, 11),
1975 (long) get_frame_register_unsigned (frame, 12),
1976 (long) get_frame_register_unsigned (frame, 13),
1977 (long) get_frame_register_unsigned (frame, 14),
1978 (long) get_frame_register_unsigned (frame, 15));
1979
1980 printf_filtered
1981 (pr ? "DR0-DR6 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n"
1982 : "FP0-FP7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
1983 (long) get_frame_register_unsigned
1984 (frame, gdbarch_fp0_regnum (gdbarch) + 0),
1985 (long) get_frame_register_unsigned
1986 (frame, gdbarch_fp0_regnum (gdbarch) + 1),
1987 (long) get_frame_register_unsigned
1988 (frame, gdbarch_fp0_regnum (gdbarch) + 2),
1989 (long) get_frame_register_unsigned
1990 (frame, gdbarch_fp0_regnum (gdbarch) + 3),
1991 (long) get_frame_register_unsigned
1992 (frame, gdbarch_fp0_regnum (gdbarch) + 4),
1993 (long) get_frame_register_unsigned
1994 (frame, gdbarch_fp0_regnum (gdbarch) + 5),
1995 (long) get_frame_register_unsigned
1996 (frame, gdbarch_fp0_regnum (gdbarch) + 6),
1997 (long) get_frame_register_unsigned
1998 (frame, gdbarch_fp0_regnum (gdbarch) + 7));
1999 printf_filtered
2000 (pr ? "DR8-DR14 %08lx%08lx %08lx%08lx %08lx%08lx %08lx%08lx\n"
2001 : "FP8-FP15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
2002 (long) get_frame_register_unsigned
2003 (frame, gdbarch_fp0_regnum (gdbarch) + 8),
2004 (long) get_frame_register_unsigned
2005 (frame, gdbarch_fp0_regnum (gdbarch) + 9),
2006 (long) get_frame_register_unsigned
2007 (frame, gdbarch_fp0_regnum (gdbarch) + 10),
2008 (long) get_frame_register_unsigned
2009 (frame, gdbarch_fp0_regnum (gdbarch) + 11),
2010 (long) get_frame_register_unsigned
2011 (frame, gdbarch_fp0_regnum (gdbarch) + 12),
2012 (long) get_frame_register_unsigned
2013 (frame, gdbarch_fp0_regnum (gdbarch) + 13),
2014 (long) get_frame_register_unsigned
2015 (frame, gdbarch_fp0_regnum (gdbarch) + 14),
2016 (long) get_frame_register_unsigned
2017 (frame, gdbarch_fp0_regnum (gdbarch) + 15));
2018 }
2019
2020 static void
2021 sh4_nofpu_show_regs (struct frame_info *frame)
2022 {
2023 printf_filtered
2024 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
2025 phex (get_frame_register_unsigned (frame,
2026 gdbarch_pc_regnum
2027 (get_frame_arch (frame))), 4),
2028 (long) get_frame_register_unsigned (frame, SR_REGNUM),
2029 (long) get_frame_register_unsigned (frame, PR_REGNUM),
2030 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
2031
2032 printf_filtered
2033 (" GBR %08lx VBR %08lx MACL %08lx\n",
2034 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
2035 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
2036 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
2037 printf_filtered
2038 (" SSR %08lx SPC %08lx FPUL %08lx FPSCR %08lx\n",
2039 (long) get_frame_register_unsigned (frame, SSR_REGNUM),
2040 (long) get_frame_register_unsigned (frame, SPC_REGNUM),
2041 (long) get_frame_register_unsigned (frame, FPUL_REGNUM),
2042 (long) get_frame_register_unsigned (frame, FPSCR_REGNUM));
2043
2044 printf_filtered
2045 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
2046 (long) get_frame_register_unsigned (frame, 0),
2047 (long) get_frame_register_unsigned (frame, 1),
2048 (long) get_frame_register_unsigned (frame, 2),
2049 (long) get_frame_register_unsigned (frame, 3),
2050 (long) get_frame_register_unsigned (frame, 4),
2051 (long) get_frame_register_unsigned (frame, 5),
2052 (long) get_frame_register_unsigned (frame, 6),
2053 (long) get_frame_register_unsigned (frame, 7));
2054 printf_filtered
2055 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
2056 (long) get_frame_register_unsigned (frame, 8),
2057 (long) get_frame_register_unsigned (frame, 9),
2058 (long) get_frame_register_unsigned (frame, 10),
2059 (long) get_frame_register_unsigned (frame, 11),
2060 (long) get_frame_register_unsigned (frame, 12),
2061 (long) get_frame_register_unsigned (frame, 13),
2062 (long) get_frame_register_unsigned (frame, 14),
2063 (long) get_frame_register_unsigned (frame, 15));
2064 }
2065
2066 static void
2067 sh_dsp_show_regs (struct frame_info *frame)
2068 {
2069 printf_filtered
2070 (" PC %s SR %08lx PR %08lx MACH %08lx\n",
2071 phex (get_frame_register_unsigned (frame,
2072 gdbarch_pc_regnum
2073 (get_frame_arch (frame))), 4),
2074 (long) get_frame_register_unsigned (frame, SR_REGNUM),
2075 (long) get_frame_register_unsigned (frame, PR_REGNUM),
2076 (long) get_frame_register_unsigned (frame, MACH_REGNUM));
2077
2078 printf_filtered
2079 (" GBR %08lx VBR %08lx DSR %08lx MACL %08lx\n",
2080 (long) get_frame_register_unsigned (frame, GBR_REGNUM),
2081 (long) get_frame_register_unsigned (frame, VBR_REGNUM),
2082 (long) get_frame_register_unsigned (frame, DSR_REGNUM),
2083 (long) get_frame_register_unsigned (frame, MACL_REGNUM));
2084
2085 printf_filtered
2086 ("R0-R7 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
2087 (long) get_frame_register_unsigned (frame, 0),
2088 (long) get_frame_register_unsigned (frame, 1),
2089 (long) get_frame_register_unsigned (frame, 2),
2090 (long) get_frame_register_unsigned (frame, 3),
2091 (long) get_frame_register_unsigned (frame, 4),
2092 (long) get_frame_register_unsigned (frame, 5),
2093 (long) get_frame_register_unsigned (frame, 6),
2094 (long) get_frame_register_unsigned (frame, 7));
2095 printf_filtered
2096 ("R8-R15 %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
2097 (long) get_frame_register_unsigned (frame, 8),
2098 (long) get_frame_register_unsigned (frame, 9),
2099 (long) get_frame_register_unsigned (frame, 10),
2100 (long) get_frame_register_unsigned (frame, 11),
2101 (long) get_frame_register_unsigned (frame, 12),
2102 (long) get_frame_register_unsigned (frame, 13),
2103 (long) get_frame_register_unsigned (frame, 14),
2104 (long) get_frame_register_unsigned (frame, 15));
2105
2106 printf_filtered
2107 ("A0G=%02lx A0=%08lx M0=%08lx X0=%08lx Y0=%08lx RS=%08lx MOD=%08lx\n",
2108 (long) get_frame_register_unsigned (frame, A0G_REGNUM) & 0xff,
2109 (long) get_frame_register_unsigned (frame, A0_REGNUM),
2110 (long) get_frame_register_unsigned (frame, M0_REGNUM),
2111 (long) get_frame_register_unsigned (frame, X0_REGNUM),
2112 (long) get_frame_register_unsigned (frame, Y0_REGNUM),
2113 (long) get_frame_register_unsigned (frame, RS_REGNUM),
2114 (long) get_frame_register_unsigned (frame, MOD_REGNUM));
2115 printf_filtered ("A1G=%02lx A1=%08lx M1=%08lx X1=%08lx Y1=%08lx RE=%08lx\n",
2116 (long) get_frame_register_unsigned (frame, A1G_REGNUM) & 0xff,
2117 (long) get_frame_register_unsigned (frame, A1_REGNUM),
2118 (long) get_frame_register_unsigned (frame, M1_REGNUM),
2119 (long) get_frame_register_unsigned (frame, X1_REGNUM),
2120 (long) get_frame_register_unsigned (frame, Y1_REGNUM),
2121 (long) get_frame_register_unsigned (frame, RE_REGNUM));
2122 }
2123
2124 static void
2125 sh_show_regs_command (char *args, int from_tty)
2126 {
2127 if (sh_show_regs)
2128 (*sh_show_regs) (get_current_frame ());
2129 }
2130
2131 static struct type * 1432 static struct type *
2132 sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr) 1433 sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr)
2133 { 1434 {
2134 if ((reg_nr >= gdbarch_fp0_regnum (gdbarch) 1435 if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
2135 && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM)) 1436 && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
2136 return builtin_type (gdbarch)->builtin_float; 1437 return builtin_type (gdbarch)->builtin_float;
2137 else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM) 1438 else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
2138 return builtin_type (gdbarch)->builtin_double; 1439 return builtin_type (gdbarch)->builtin_double;
2139 else 1440 else
2140 return builtin_type (gdbarch)->builtin_int; 1441 return builtin_type (gdbarch)->builtin_int;
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 actually the frame pointer of the calling frame. */ 1857 actually the frame pointer of the calling frame. */
2557 cache->base = get_frame_register_unsigned (this_frame, FP_REGNUM); 1858 cache->base = get_frame_register_unsigned (this_frame, FP_REGNUM);
2558 if (cache->base == 0) 1859 if (cache->base == 0)
2559 return cache; 1860 return cache;
2560 1861
2561 cache->pc = get_frame_func (this_frame); 1862 cache->pc = get_frame_func (this_frame);
2562 current_pc = get_frame_pc (this_frame); 1863 current_pc = get_frame_pc (this_frame);
2563 if (cache->pc != 0) 1864 if (cache->pc != 0)
2564 { 1865 {
2565 ULONGEST fpscr; 1866 ULONGEST fpscr;
2566 fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM); 1867
1868 /* Check for the existence of the FPSCR register.» If it exists,
1869 » fetch its value for use in prologue analysis.» Passing a zero
1870 » value is the best choice for architecture variants upon which
1871 » there's no FPSCR register. */
1872 if (gdbarch_register_reggroup_p (gdbarch, FPSCR_REGNUM, all_reggroup))
1873 » fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM);
1874 else
1875 » fpscr = 0;
1876
2567 sh_analyze_prologue (gdbarch, cache->pc, current_pc, cache, fpscr); 1877 sh_analyze_prologue (gdbarch, cache->pc, current_pc, cache, fpscr);
2568 } 1878 }
2569 1879
2570 if (!cache->uses_fp) 1880 if (!cache->uses_fp)
2571 { 1881 {
2572 /* We didn't find a valid frame, which means that CACHE->base 1882 /* We didn't find a valid frame, which means that CACHE->base
2573 currently holds the frame pointer for our calling frame. If 1883 currently holds the frame pointer for our calling frame. If
2574 we're at the start of a function, or somewhere half-way its 1884 we're at the start of a function, or somewhere half-way its
2575 prologue, the function's frame probably hasn't been fully 1885 prologue, the function's frame probably hasn't been fully
2576 setup yet. Try to reconstruct the base address for the stack 1886 setup yet. Try to reconstruct the base address for the stack
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 return cache->base; 1980 return cache->base;
2671 } 1981 }
2672 1982
2673 static const struct frame_base sh_frame_base = { 1983 static const struct frame_base sh_frame_base = {
2674 &sh_frame_unwind, 1984 &sh_frame_unwind,
2675 sh_frame_base_address, 1985 sh_frame_base_address,
2676 sh_frame_base_address, 1986 sh_frame_base_address,
2677 sh_frame_base_address 1987 sh_frame_base_address
2678 }; 1988 };
2679 1989
1990 static struct sh_frame_cache *
1991 sh_make_stub_cache (struct frame_info *this_frame)
1992 {
1993 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1994 struct sh_frame_cache *cache;
1995
1996 cache = sh_alloc_frame_cache ();
1997
1998 cache->saved_sp
1999 = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
2000
2001 return cache;
2002 }
2003
2004 static void
2005 sh_stub_this_id (struct frame_info *this_frame, void **this_cache,
2006 struct frame_id *this_id)
2007 {
2008 struct sh_frame_cache *cache;
2009
2010 if (*this_cache == NULL)
2011 *this_cache = sh_make_stub_cache (this_frame);
2012 cache = *this_cache;
2013
2014 *this_id = frame_id_build (cache->saved_sp, get_frame_pc (this_frame));
2015 }
2016
2017 static int
2018 sh_stub_unwind_sniffer (const struct frame_unwind *self,
2019 struct frame_info *this_frame,
2020 void **this_prologue_cache)
2021 {
2022 CORE_ADDR addr_in_block;
2023
2024 addr_in_block = get_frame_address_in_block (this_frame);
2025 if (in_plt_section (addr_in_block, NULL))
2026 return 1;
2027
2028 return 0;
2029 }
2030
2031 static const struct frame_unwind sh_stub_unwind =
2032 {
2033 NORMAL_FRAME,
2034 default_frame_unwind_stop_reason,
2035 sh_stub_this_id,
2036 sh_frame_prev_register,
2037 NULL,
2038 sh_stub_unwind_sniffer
2039 };
2040
2680 /* The epilogue is defined here as the area at the end of a function, 2041 /* The epilogue is defined here as the area at the end of a function,
2681 either on the `ret' instruction itself or after an instruction which 2042 either on the `ret' instruction itself or after an instruction which
2682 destroys the function's stack frame. */ 2043 destroys the function's stack frame. */
2683 static int 2044 static int
2684 sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) 2045 sh_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
2685 { 2046 {
2686 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); 2047 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
2687 CORE_ADDR func_addr = 0, func_end = 0; 2048 CORE_ADDR func_addr = 0, func_end = 0;
2688 2049
2689 if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) 2050 if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2838 sh_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, 2199 sh_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name,
2839 size_t sect_size) 2200 size_t sect_size)
2840 { 2201 {
2841 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 2202 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2842 2203
2843 if (tdep->core_gregmap && strcmp (sect_name, ".reg") == 0) 2204 if (tdep->core_gregmap && strcmp (sect_name, ".reg") == 0)
2844 return &sh_corefile_gregset; 2205 return &sh_corefile_gregset;
2845 2206
2846 if (tdep->core_fpregmap && strcmp (sect_name, ".reg2") == 0) 2207 if (tdep->core_fpregmap && strcmp (sect_name, ".reg2") == 0)
2847 return &sh_corefile_fpregset; 2208 return &sh_corefile_fpregset;

error: old chunk mismatch

OLDNEW
« no previous file with comments | « gdb/sh-tdep.h ('k') | gdb/sh64-tdep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698