OLD | NEW |
1 /* Target-dependent code for Renesas M32R, for GDB. | 1 /* Target-dependent code for Renesas M32R, for GDB. |
2 | 2 |
3 Copyright (C) 1996, 1998-2005, 2007-2012 Free Software Foundation, | 3 Copyright (C) 1996, 1998-2005, 2007-2012 Free Software Foundation, |
4 Inc. | 4 Inc. |
5 | 5 |
6 This file is part of GDB. | 6 This file is part of GDB. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 The following functions take care of this behavior. */ | 79 The following functions take care of this behavior. */ |
80 | 80 |
81 static int | 81 static int |
82 m32r_memory_insert_breakpoint (struct gdbarch *gdbarch, | 82 m32r_memory_insert_breakpoint (struct gdbarch *gdbarch, |
83 struct bp_target_info *bp_tgt) | 83 struct bp_target_info *bp_tgt) |
84 { | 84 { |
85 CORE_ADDR addr = bp_tgt->placed_address; | 85 CORE_ADDR addr = bp_tgt->placed_address; |
86 int val; | 86 int val; |
87 gdb_byte buf[4]; | 87 gdb_byte buf[4]; |
88 gdb_byte *contents_cache = bp_tgt->shadow_contents; | 88 gdb_byte contents_cache[4]; |
89 gdb_byte bp_entry[] = { 0x10, 0xf1 }; /* dpt */ | 89 gdb_byte bp_entry[] = { 0x10, 0xf1 }; /* dpt */ |
90 | 90 |
91 /* Save the memory contents. */ | 91 /* Save the memory contents. */ |
92 val = target_read_memory (addr & 0xfffffffc, contents_cache, 4); | 92 val = target_read_memory (addr & 0xfffffffc, contents_cache, 4); |
93 if (val != 0) | 93 if (val != 0) |
94 return val; /* return error */ | 94 return val; /* return error */ |
95 | 95 |
| 96 memcpy (bp_tgt->shadow_contents, contents_cache, 4); |
96 bp_tgt->placed_size = bp_tgt->shadow_len = 4; | 97 bp_tgt->placed_size = bp_tgt->shadow_len = 4; |
97 | 98 |
98 /* Determine appropriate breakpoint contents and size for this address. */ | 99 /* Determine appropriate breakpoint contents and size for this address. */ |
99 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) | 100 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) |
100 { | 101 { |
101 if ((addr & 3) == 0) | 102 if ((addr & 3) == 0) |
102 { | 103 { |
103 buf[0] = bp_entry[0]; | 104 buf[0] = bp_entry[0]; |
104 buf[1] = bp_entry[1]; | 105 buf[1] = bp_entry[1]; |
105 buf[2] = contents_cache[2] & 0x7f; | 106 buf[2] = contents_cache[2] & 0x7f; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 in the stack frame. sp is even more special: the address we return | 530 in the stack frame. sp is even more special: the address we return |
530 for it IS the sp for the next frame. */ | 531 for it IS the sp for the next frame. */ |
531 | 532 |
532 static struct m32r_unwind_cache * | 533 static struct m32r_unwind_cache * |
533 m32r_frame_unwind_cache (struct frame_info *this_frame, | 534 m32r_frame_unwind_cache (struct frame_info *this_frame, |
534 void **this_prologue_cache) | 535 void **this_prologue_cache) |
535 { | 536 { |
536 CORE_ADDR pc, scan_limit; | 537 CORE_ADDR pc, scan_limit; |
537 ULONGEST prev_sp; | 538 ULONGEST prev_sp; |
538 ULONGEST this_base; | 539 ULONGEST this_base; |
539 unsigned long op, op2; | 540 unsigned long op; |
540 int i; | 541 int i; |
541 struct m32r_unwind_cache *info; | 542 struct m32r_unwind_cache *info; |
542 | 543 |
543 | 544 |
544 if ((*this_prologue_cache)) | 545 if ((*this_prologue_cache)) |
545 return (*this_prologue_cache); | 546 return (*this_prologue_cache); |
546 | 547 |
547 info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache); | 548 info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache); |
548 (*this_prologue_cache) = info; | 549 (*this_prologue_cache) = info; |
549 info->saved_regs = trad_frame_alloc_saved_regs (this_frame); | 550 info->saved_regs = trad_frame_alloc_saved_regs (this_frame); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 690 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
690 int stack_offset, stack_alloc; | 691 int stack_offset, stack_alloc; |
691 int argreg = ARG1_REGNUM; | 692 int argreg = ARG1_REGNUM; |
692 int argnum; | 693 int argnum; |
693 struct type *type; | 694 struct type *type; |
694 enum type_code typecode; | 695 enum type_code typecode; |
695 CORE_ADDR regval; | 696 CORE_ADDR regval; |
696 gdb_byte *val; | 697 gdb_byte *val; |
697 gdb_byte valbuf[MAX_REGISTER_SIZE]; | 698 gdb_byte valbuf[MAX_REGISTER_SIZE]; |
698 int len; | 699 int len; |
699 int odd_sized_struct; | |
700 | 700 |
701 /* First force sp to a 4-byte alignment. */ | 701 /* First force sp to a 4-byte alignment. */ |
702 sp = sp & ~3; | 702 sp = sp & ~3; |
703 | 703 |
704 /* Set the return address. For the m32r, the return breakpoint is | 704 /* Set the return address. For the m32r, the return breakpoint is |
705 always at BP_ADDR. */ | 705 always at BP_ADDR. */ |
706 regcache_cooked_write_unsigned (regcache, LR_REGNUM, bp_addr); | 706 regcache_cooked_write_unsigned (regcache, LR_REGNUM, bp_addr); |
707 | 707 |
708 /* If STRUCT_RETURN is true, then the struct return address (in | 708 /* If STRUCT_RETURN is true, then the struct return address (in |
709 STRUCT_ADDR) will consume the first argument-passing register. | 709 STRUCT_ADDR) will consume the first argument-passing register. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 /* Ignore return values more than 8 bytes in size because the m32r | 801 /* Ignore return values more than 8 bytes in size because the m32r |
802 returns anything more than 8 bytes in the stack. */ | 802 returns anything more than 8 bytes in the stack. */ |
803 if (len > 4) | 803 if (len > 4) |
804 { | 804 { |
805 regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp); | 805 regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp); |
806 store_unsigned_integer (valbuf + len - 4, 4, byte_order, tmp); | 806 store_unsigned_integer (valbuf + len - 4, 4, byte_order, tmp); |
807 } | 807 } |
808 } | 808 } |
809 | 809 |
810 static enum return_value_convention | 810 static enum return_value_convention |
811 m32r_return_value (struct gdbarch *gdbarch, struct type *func_type, | 811 m32r_return_value (struct gdbarch *gdbarch, struct value *function, |
812 struct type *valtype, struct regcache *regcache, | 812 struct type *valtype, struct regcache *regcache, |
813 gdb_byte *readbuf, const gdb_byte *writebuf) | 813 gdb_byte *readbuf, const gdb_byte *writebuf) |
814 { | 814 { |
815 if (TYPE_LENGTH (valtype) > 8) | 815 if (TYPE_LENGTH (valtype) > 8) |
816 return RETURN_VALUE_STRUCT_CONVENTION; | 816 return RETURN_VALUE_STRUCT_CONVENTION; |
817 else | 817 else |
818 { | 818 { |
819 if (readbuf != NULL) | 819 if (readbuf != NULL) |
820 m32r_extract_return_value (valtype, regcache, readbuf); | 820 m32r_extract_return_value (valtype, regcache, readbuf); |
821 if (writebuf != NULL) | 821 if (writebuf != NULL) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 set_gdbarch_overlay_update (gdbarch, simple_overlay_update); | 971 set_gdbarch_overlay_update (gdbarch, simple_overlay_update); |
972 | 972 |
973 return gdbarch; | 973 return gdbarch; |
974 } | 974 } |
975 | 975 |
976 void | 976 void |
977 _initialize_m32r_tdep (void) | 977 _initialize_m32r_tdep (void) |
978 { | 978 { |
979 register_gdbarch_init (bfd_arch_m32r, m32r_gdbarch_init); | 979 register_gdbarch_init (bfd_arch_m32r, m32r_gdbarch_init); |
980 } | 980 } |
OLD | NEW |