Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [commit] infcall.c cleanup - explict bp_addr variable
Date: Tue, 01 Jul 2003 17:44:00 -0000	[thread overview]
Message-ID: <jen0fydtv6.fsf@sykes.suse.de> (raw)
In-Reply-To: <3EFCBF6F.2050805@redhat.com> (Andrew Cagney's message of "Fri, 27 Jun 2003 18:04:31 -0400")

Andrew Cagney <ac131313@redhat.com> writes:

|> Does, instead, a s/push_arguments/push_dummy_call/ and move the above code
|> to push_dummy_call (PC -> FUNC_ADDR, CALL_DUMMY_ADDRESS -> BP_ADDR) work?

Here is a patch that does the renaming and modernizes it.  Fixes almost
all tests that do inferior calls.  One thing that's still broken is
backtraces from dummy frames (causing an infinite loop).  I'll try to fix
that too.

 		=== gdb Summary ===
 
-# of expected passes		8654
-# of unexpected failures	324
+# of expected passes		8781
+# of unexpected failures	195
 # of unexpected successes	3
 # of expected failures		45
 # of known failures		23
-# of unresolved testcases	38
+# of unresolved testcases	41
 # of untested testcases		6
 # of unsupported tests		2
 /cvs/test/branch/gdb/gdb/testsuite/../../gdb/gdb version  5.3.90_2003-07-01-cvs -nx

Andreas.

2003-07-01  Andreas Schwab  <schwab@suse.de>

	* ia64-tdep.c (ia64_push_dummy_call): Define as combination of
	former ia64_push_arguments and ia64_push_return_address, and use
	regcache functions instead of read/write_register.
	(ia64_gdbarch_init): Set push_dummy_call instead of
	deprecated_push_arguments and deprecated_push_return_address.

--- gdb/ia64-tdep.c.~1.89.~	2003-06-23 11:44:21.000000000 +0200
+++ gdb/ia64-tdep.c	2003-07-01 19:38:43.000000000 +0200
@@ -1520,7 +1520,7 @@ static void
 ia64_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
 {
   /* FIXME: See above. */
-  /* Note that most of the work was done in ia64_push_arguments() */
+  /* Note that most of the work was done in ia64_push_dummy_call() */
   struct_return_address = addr;
 }
 
@@ -1853,8 +1853,10 @@ find_func_descr (CORE_ADDR faddr, CORE_A
 }
 
 static CORE_ADDR
-ia64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
-		    int struct_return, CORE_ADDR struct_addr)
+ia64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+		      struct regcache *regcache, CORE_ADDR bp_addr,
+		      int nargs, struct value **args, CORE_ADDR sp,
+		      int struct_return, CORE_ADDR struct_addr)
 {
   int argno;
   struct value *arg;
@@ -1862,7 +1864,9 @@ ia64_push_arguments (int nargs, struct v
   int len, argoffset;
   int nslots, rseslots, memslots, slotnum, nfuncargs;
   int floatreg;
-  CORE_ADDR bsp, cfm, pfs, new_bsp, funcdescaddr;
+  ULONGEST bsp, cfm, pfs, new_bsp;
+  CORE_ADDR funcdescaddr;
+  ULONGEST global_pointer = FIND_GLOBAL_POINTER (func_addr);
 
   nslots = 0;
   nfuncargs = 0;
@@ -1887,21 +1891,21 @@ ia64_push_arguments (int nargs, struct v
   memslots = nslots - rseslots;
 
   /* Allocate a new RSE frame */
-  cfm = read_register (IA64_CFM_REGNUM);
+  regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
 
-  bsp = read_register (IA64_BSP_REGNUM);
+  regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
   bsp = rse_address_add (bsp, cfm & 0x7f);
   new_bsp = rse_address_add (bsp, rseslots);
-  write_register (IA64_BSP_REGNUM, new_bsp);
+  regcache_cooked_write_unsigned (regcache, IA64_BSP_REGNUM, new_bsp);
 
-  pfs = read_register (IA64_PFS_REGNUM);
+  regcache_cooked_read_unsigned (regcache, IA64_PFS_REGNUM, &pfs);
   pfs &= 0xc000000000000000LL;
   pfs |= (cfm & 0xffffffffffffLL);
-  write_register (IA64_PFS_REGNUM, pfs);
+  regcache_cooked_write_unsigned (regcache, IA64_PFS_REGNUM, pfs);
 
   cfm &= 0xc000000000000000LL;
   cfm |= rseslots;
-  write_register (IA64_CFM_REGNUM, cfm);
+  regcache_cooked_write_unsigned (regcache, IA64_CFM_REGNUM, cfm);
   
   /* We will attempt to find function descriptors in the .opd segment,
      but if we can't we'll construct them ourselves.  That being the
@@ -1979,11 +1983,12 @@ ia64_push_arguments (int nargs, struct v
 	  len = TYPE_LENGTH (type);
 	  while (len > 0 && floatreg < IA64_FR16_REGNUM)
 	    {
-	      ia64_register_convert_to_raw (
-		float_elt_type,
-		floatreg,
-	        VALUE_CONTENTS (arg) + argoffset,
-		&deprecated_registers[REGISTER_BYTE (floatreg)]);
+	      char buf[MAX_REGISTER_SIZE];
+	      ia64_register_convert_to_raw (float_elt_type,
+					    floatreg,
+					    VALUE_CONTENTS (arg) + argoffset,
+					    buf);
+	      regcache_raw_write (regcache, floatreg, buf);
 	      floatreg++;
 	      argoffset += TYPE_LENGTH (float_elt_type);
 	      len -= TYPE_LENGTH (float_elt_type);
@@ -1994,11 +1999,14 @@ ia64_push_arguments (int nargs, struct v
   /* Store the struct return value in r8 if necessary. */
   if (struct_return)
     {
-      store_unsigned_integer (&deprecated_registers[REGISTER_BYTE (IA64_GR8_REGNUM)],
-			      REGISTER_RAW_SIZE (IA64_GR8_REGNUM),
-			      struct_addr);
+      regcache_cooked_write_unsigned (regcache, IA64_GR8_REGNUM, struct_addr);
     }
 
+  if (global_pointer != 0)
+    regcache_cooked_write_unsigned (regcache, IA64_GR1_REGNUM, global_pointer);
+
+  regcache_cooked_write_unsigned (regcache, IA64_BR0_REGNUM, bp_addr);
+
   /* Sync gdb's idea of what the registers are with the target. */
   target_store_registers (-1);
 
@@ -2018,18 +2026,6 @@ ia64_push_arguments (int nargs, struct v
   return sp;
 }
 
-static CORE_ADDR
-ia64_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
-  CORE_ADDR global_pointer = FIND_GLOBAL_POINTER (pc);
-
-  if (global_pointer != 0)
-    write_register (IA64_GR1_REGNUM, global_pointer);
-
-  write_register (IA64_BR0_REGNUM, CALL_DUMMY_ADDRESS ());
-  return sp;
-}
-
 static void
 ia64_store_return_value (struct type *type, char *valbuf)
 {
@@ -2289,8 +2285,7 @@ ia64_gdbarch_init (struct gdbarch_info i
   set_gdbarch_write_pc (gdbarch, ia64_write_pc);
 
   /* Settings for calling functions in the inferior.  */
-  set_gdbarch_deprecated_push_arguments (gdbarch, ia64_push_arguments);
-  set_gdbarch_deprecated_push_return_address (gdbarch, ia64_push_return_address);
+  set_gdbarch_push_dummy_call (gdbarch, ia64_push_dummy_call);
   set_gdbarch_deprecated_pop_frame (gdbarch, ia64_pop_frame);
 
   set_gdbarch_deprecated_call_dummy_words (gdbarch, ia64_call_dummy_words);

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


  parent reply	other threads:[~2003-07-01 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-23 19:12 Andrew Cagney
2003-06-27 21:00 ` Andreas Schwab
2003-06-27 22:04   ` Andrew Cagney
2003-06-27 23:05     ` Andreas Schwab
2003-07-01 17:44     ` Andreas Schwab [this message]
2003-07-01 21:35       ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jen0fydtv6.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox