• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


コミットメタ情報

リビジョン51362d059d4d2814bcf02ba08ab543da56467f7a (tree)
日時2003-01-13 05:07:36
作者Andrew Cagney <cagney@redh...>
コミッターAndrew Cagney

ログメッセージ

Import latest changes from mainline.

変更サマリ

差分

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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+
116 2003-01-11 Andrew Cagney <ac131313@redhat.com>
217
318 * frame.c (deprecated_update_frame_pc_hack)
--- a/gdb/d10v-tdep.c
+++ b/gdb/d10v-tdep.c
@@ -42,6 +42,8 @@
4242 #include "gdb/sim-d10v.h"
4343 #include "sim-regno.h"
4444
45+#include "gdb_assert.h"
46+
4547 struct frame_extra_info
4648 {
4749 CORE_ADDR return_pc;
@@ -472,22 +474,36 @@ d10v_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
472474 Things always get returned in RET1_REGNUM, RET2_REGNUM, ... */
473475
474476 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)
476479 {
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. */
479482 if (TYPE_LENGTH (type) == 1
480483 && TYPE_CODE (type) == TYPE_CODE_INT)
481484 {
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);
487488 }
488489 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+ }
491507 }
492508
493509 /* Extract from an array REGBUF containing the (raw) register state
@@ -495,24 +511,17 @@ d10v_store_return_value (struct type *type, char *valbuf)
495511 as a CORE_ADDR (or an expression that can be used as one). */
496512
497513 static CORE_ADDR
498-d10v_extract_struct_value_address (char *regbuf)
514+d10v_extract_struct_value_address (struct regcache *regcache)
499515 {
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);
503519 }
504520
505521 static CORE_ADDR
506522 d10v_frame_saved_pc (struct frame_info *frame)
507523 {
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);
516525 }
517526
518527 /* Immediately after a function call, return the saved pc. We can't
@@ -683,10 +692,6 @@ d10v_frame_chain (struct frame_info *fi)
683692 CORE_ADDR addr;
684693
685694 /* 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-
690695 d10v_frame_init_saved_regs (fi);
691696
692697
@@ -695,8 +700,7 @@ d10v_frame_chain (struct frame_info *fi)
695700 {
696701 /* This is meant to halt the backtrace at "_start".
697702 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;
700704 }
701705
702706 if (!get_frame_saved_regs (fi)[FP_REGNUM])
@@ -913,15 +917,7 @@ d10v_init_extra_frame_info (int fromleaf, struct frame_info *fi)
913917
914918 /* The call dummy doesn't save any registers on the stack, so we can
915919 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);
925921 }
926922
927923 static void
@@ -1149,8 +1145,8 @@ d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
11491145 extract and copy its value into `valbuf'. */
11501146
11511147 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)
11541150 {
11551151 int len;
11561152 #if 0
@@ -1159,25 +1155,34 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES],
11591155 (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM),
11601156 REGISTER_RAW_SIZE (RET1_REGNUM)));
11611157 #endif
1162- len = TYPE_LENGTH (type);
1163- if (len == 1)
1158+ if (TYPE_LENGTH (type) == 1)
11641159 {
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);
11691162 store_unsigned_integer (valbuf, 1, c);
11701163 }
1171- else if ((len & 1) == 0)
1172- memcpy (valbuf, regbuf + REGISTER_BYTE (RET1_REGNUM), len);
11731164 else
11741165 {
11751166 /* For return values of odd size, the first byte is in the
11761167 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+ }
11811186 }
11821187 }
11831188
@@ -1604,14 +1609,14 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
16041609 set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
16051610 set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
16061611
1607- set_gdbarch_deprecated_extract_return_value (gdbarch, d10v_extract_return_value);
1612+ set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
16081613 set_gdbarch_push_arguments (gdbarch, d10v_push_arguments);
16091614 set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame);
16101615 set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
16111616
16121617 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);
16151620 set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention);
16161621
16171622 set_gdbarch_frame_init_saved_regs (gdbarch, d10v_frame_init_saved_regs);