GNU Binutils with patches for OS216
修订版 | 51362d059d4d2814bcf02ba08ab543da56467f7a (tree) |
---|---|
时间 | 2003-01-13 05:07:36 |
作者 | Andrew Cagney <cagney@redh...> |
Commiter | Andrew Cagney |
Import latest changes from mainline.
@@ -1,3 +1,18 @@ | ||
1 | +2003-01-12 Andrew Cagney <ac131313@redhat.com> | |
2 | + | |
3 | + * d10v-tdep.c (d10v_init_extra_frame_info): Remove checks for a | |
4 | + dummy frame. | |
5 | + (d10v_frame_saved_pc, d10v_frame_chain): Ditto. | |
6 | + | |
7 | +2003-01-12 Andrew Cagney <ac131313@redhat.com> | |
8 | + | |
9 | + * d10v-tdep.c: Include "gdb_assert.h". | |
10 | + (d10v_store_return_value): Rewrite to match current interface. | |
11 | + (d10v_extract_struct_value_address): Ditto. | |
12 | + (d10v_extract_return_value): Ditto. | |
13 | + (d10v_gdbarch_init): Set store_restore_value, | |
14 | + extract_struct_value_address and extract_return_value. | |
15 | + | |
1 | 16 | 2003-01-11 Andrew Cagney <ac131313@redhat.com> |
2 | 17 | |
3 | 18 | * frame.c (deprecated_update_frame_pc_hack) |
@@ -42,6 +42,8 @@ | ||
42 | 42 | #include "gdb/sim-d10v.h" |
43 | 43 | #include "sim-regno.h" |
44 | 44 | |
45 | +#include "gdb_assert.h" | |
46 | + | |
45 | 47 | struct frame_extra_info |
46 | 48 | { |
47 | 49 | CORE_ADDR return_pc; |
@@ -472,22 +474,36 @@ d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) | ||
472 | 474 | Things always get returned in RET1_REGNUM, RET2_REGNUM, ... */ |
473 | 475 | |
474 | 476 | static void |
475 | -d10v_store_return_value (struct type *type, char *valbuf) | |
477 | +d10v_store_return_value (struct type *type, struct regcache *regcache, | |
478 | + const void *valbuf) | |
476 | 479 | { |
477 | - char tmp = 0; | |
478 | - /* Only char return values need to be shifted right within R0. */ | |
480 | + /* Only char return values need to be shifted right within the first | |
481 | + regnum. */ | |
479 | 482 | if (TYPE_LENGTH (type) == 1 |
480 | 483 | && TYPE_CODE (type) == TYPE_CODE_INT) |
481 | 484 | { |
482 | - /* zero the high byte */ | |
483 | - deprecated_write_register_bytes (REGISTER_BYTE (RET1_REGNUM), &tmp, 1); | |
484 | - /* copy the low byte */ | |
485 | - deprecated_write_register_bytes (REGISTER_BYTE (RET1_REGNUM) + 1, | |
486 | - valbuf, 1); | |
485 | + bfd_byte tmp[2]; | |
486 | + tmp[1] = *(bfd_byte *)valbuf; | |
487 | + regcache_cooked_write (regcache, RET1_REGNUM, tmp); | |
487 | 488 | } |
488 | 489 | else |
489 | - deprecated_write_register_bytes (REGISTER_BYTE (RET1_REGNUM), | |
490 | - valbuf, TYPE_LENGTH (type)); | |
490 | + { | |
491 | + int reg; | |
492 | + /* A structure is never more than 8 bytes long. See | |
493 | + use_struct_convention(). */ | |
494 | + gdb_assert (TYPE_LENGTH (type) <= 8); | |
495 | + /* Write out most registers, stop loop before trying to write | |
496 | + out any dangling byte at the end of the buffer. */ | |
497 | + for (reg = 0; (reg * 2) + 1 < TYPE_LENGTH (type); reg++) | |
498 | + { | |
499 | + regcache_cooked_write (regcache, RET1_REGNUM + reg, | |
500 | + (bfd_byte *) valbuf + reg * 2); | |
501 | + } | |
502 | + /* Write out any dangling byte at the end of the buffer. */ | |
503 | + if ((reg * 2) + 1 == TYPE_LENGTH (type)) | |
504 | + regcache_cooked_write_part (regcache, reg, 0, 1, | |
505 | + (bfd_byte *) valbuf + reg * 2); | |
506 | + } | |
491 | 507 | } |
492 | 508 | |
493 | 509 | /* Extract from an array REGBUF containing the (raw) register state |
@@ -495,24 +511,17 @@ d10v_store_return_value (struct type *type, char *valbuf) | ||
495 | 511 | as a CORE_ADDR (or an expression that can be used as one). */ |
496 | 512 | |
497 | 513 | static CORE_ADDR |
498 | -d10v_extract_struct_value_address (char *regbuf) | |
514 | +d10v_extract_struct_value_address (struct regcache *regcache) | |
499 | 515 | { |
500 | - return (extract_address ((regbuf) + REGISTER_BYTE (ARG1_REGNUM), | |
501 | - REGISTER_RAW_SIZE (ARG1_REGNUM)) | |
502 | - | DMEM_START); | |
516 | + ULONGEST addr; | |
517 | + regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &addr); | |
518 | + return (addr | DMEM_START); | |
503 | 519 | } |
504 | 520 | |
505 | 521 | static CORE_ADDR |
506 | 522 | d10v_frame_saved_pc (struct frame_info *frame) |
507 | 523 | { |
508 | - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame), | |
509 | - get_frame_base (frame), | |
510 | - get_frame_base (frame))) | |
511 | - return d10v_make_iaddr (deprecated_read_register_dummy (get_frame_pc (frame), | |
512 | - get_frame_base (frame), | |
513 | - PC_REGNUM)); | |
514 | - else | |
515 | - return (get_frame_extra_info (frame)->return_pc); | |
524 | + return (get_frame_extra_info (frame)->return_pc); | |
516 | 525 | } |
517 | 526 | |
518 | 527 | /* Immediately after a function call, return the saved pc. We can't |
@@ -683,10 +692,6 @@ d10v_frame_chain (struct frame_info *fi) | ||
683 | 692 | CORE_ADDR addr; |
684 | 693 | |
685 | 694 | /* A generic call dummy's frame is the same as caller's. */ |
686 | - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), | |
687 | - get_frame_base (fi))) | |
688 | - return get_frame_base (fi); | |
689 | - | |
690 | 695 | d10v_frame_init_saved_regs (fi); |
691 | 696 | |
692 | 697 |
@@ -695,8 +700,7 @@ d10v_frame_chain (struct frame_info *fi) | ||
695 | 700 | { |
696 | 701 | /* This is meant to halt the backtrace at "_start". |
697 | 702 | Make sure we don't halt it at a generic dummy frame. */ |
698 | - if (!DEPRECATED_PC_IN_CALL_DUMMY (get_frame_extra_info (fi)->return_pc, 0, 0)) | |
699 | - return (CORE_ADDR) 0; | |
703 | + return (CORE_ADDR) 0; | |
700 | 704 | } |
701 | 705 | |
702 | 706 | if (!get_frame_saved_regs (fi)[FP_REGNUM]) |
@@ -913,15 +917,7 @@ d10v_init_extra_frame_info (int fromleaf, struct frame_info *fi) | ||
913 | 917 | |
914 | 918 | /* The call dummy doesn't save any registers on the stack, so we can |
915 | 919 | return now. */ |
916 | - if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi), | |
917 | - get_frame_base (fi))) | |
918 | - { | |
919 | - return; | |
920 | - } | |
921 | - else | |
922 | - { | |
923 | - d10v_frame_init_saved_regs (fi); | |
924 | - } | |
920 | + d10v_frame_init_saved_regs (fi); | |
925 | 921 | } |
926 | 922 | |
927 | 923 | static void |
@@ -1149,8 +1145,8 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, | ||
1149 | 1145 | extract and copy its value into `valbuf'. */ |
1150 | 1146 | |
1151 | 1147 | static void |
1152 | -d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES], | |
1153 | - char *valbuf) | |
1148 | +d10v_extract_return_value (struct type *type, struct regcache *regcache, | |
1149 | + void *valbuf) | |
1154 | 1150 | { |
1155 | 1151 | int len; |
1156 | 1152 | #if 0 |
@@ -1159,25 +1155,34 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES], | ||
1159 | 1155 | (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), |
1160 | 1156 | REGISTER_RAW_SIZE (RET1_REGNUM))); |
1161 | 1157 | #endif |
1162 | - len = TYPE_LENGTH (type); | |
1163 | - if (len == 1) | |
1158 | + if (TYPE_LENGTH (type) == 1) | |
1164 | 1159 | { |
1165 | - unsigned short c; | |
1166 | - | |
1167 | - c = extract_unsigned_integer (regbuf + REGISTER_BYTE (RET1_REGNUM), | |
1168 | - REGISTER_RAW_SIZE (RET1_REGNUM)); | |
1160 | + ULONGEST c; | |
1161 | + regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &c); | |
1169 | 1162 | store_unsigned_integer (valbuf, 1, c); |
1170 | 1163 | } |
1171 | - else if ((len & 1) == 0) | |
1172 | - memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len); | |
1173 | 1164 | else |
1174 | 1165 | { |
1175 | 1166 | /* For return values of odd size, the first byte is in the |
1176 | 1167 | least significant part of the first register. The |
1177 | - remaining bytes in remaining registers. Interestingly, | |
1178 | - when such values are passed in, the last byte is in the | |
1179 | - most significant byte of that same register - wierd. */ | |
1180 | - memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM) + 1, len); | |
1168 | + remaining bytes in remaining registers. Interestingly, when | |
1169 | + such values are passed in, the last byte is in the most | |
1170 | + significant byte of that same register - wierd. */ | |
1171 | + int reg = RET1_REGNUM; | |
1172 | + int off = 0; | |
1173 | + if (TYPE_LENGTH (type) & 1) | |
1174 | + { | |
1175 | + regcache_cooked_read_part (regcache, RET1_REGNUM, 1, 1, | |
1176 | + (bfd_byte *)valbuf + off); | |
1177 | + off++; | |
1178 | + reg++; | |
1179 | + } | |
1180 | + /* Transfer the remaining registers. */ | |
1181 | + for (; off < TYPE_LENGTH (type); reg++, off += 2) | |
1182 | + { | |
1183 | + regcache_cooked_read (regcache, RET1_REGNUM + reg, | |
1184 | + (bfd_byte *) valbuf + off); | |
1185 | + } | |
1181 | 1186 | } |
1182 | 1187 | } |
1183 | 1188 |
@@ -1604,14 +1609,14 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
1604 | 1609 | set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0); |
1605 | 1610 | set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); |
1606 | 1611 | |
1607 | - set_gdbarch_deprecated_extract_return_value (gdbarch, d10v_extract_return_value); | |
1612 | + set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); | |
1608 | 1613 | set_gdbarch_push_arguments (gdbarch, d10v_push_arguments); |
1609 | 1614 | set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); |
1610 | 1615 | set_gdbarch_push_return_address (gdbarch, d10v_push_return_address); |
1611 | 1616 | |
1612 | 1617 | set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return); |
1613 | - set_gdbarch_deprecated_store_return_value (gdbarch, d10v_store_return_value); | |
1614 | - set_gdbarch_deprecated_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); | |
1618 | + set_gdbarch_store_return_value (gdbarch, d10v_store_return_value); | |
1619 | + set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); | |
1615 | 1620 | set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention); |
1616 | 1621 | |
1617 | 1622 | set_gdbarch_frame_init_saved_regs (gdbarch, d10v_frame_init_saved_regs); |