Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Kei Sakamoto" <sakamoto.kei@renesas.com>
To: "Andrew Cagney" <ac131313@redhat.com>
Cc: <gdb-patches@sources.redhat.com>
Subject: Re: [PATCH] revised m32r target
Date: Tue, 22 Jul 2003 05:00:00 -0000	[thread overview]
Message-ID: <01fc01c3500e$7800d2f0$5169910a@KEI> (raw)
In-Reply-To: <3F1C35C6.4010603@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

> Kei,
> 
> I've checked in the .c files, as posted.  Not bad, not bad at all.
> Can you just see how many of the attached can also be fixed?  I'll then
> look at enabling it and pulling it into the 6 branch.
> 
> Andrew

Thank you for checking in. I revised m32r-tdep.c and m32r-rom.c.
I think all warnings in your e-mail are fixed now. I attached the
patch file. 

By the way, would you tell me how to get these warning messages?
I built gdb with --enable-build-warnings, but gcc didn't show them.

Kei

===

2003-07-22  Kei Sakamoto  <sakamoto.kei@renesas.com>

        * m32r-rom.c, m32r-tdep.c: Update.

[-- Attachment #2: diffs --]
[-- Type: application/octet-stream, Size: 9356 bytes --]

diff -Naur src.orig/gdb/m32r-rom.c src/gdb/m32r-rom.c
--- src.orig/gdb/m32r-rom.c	Tue Jul 22 08:07:28 2003
+++ src/gdb/m32r-rom.c	Tue Jul 22 12:10:13 2003
@@ -40,8 +40,6 @@
 #include <ctype.h>
 #include "regcache.h"
 
-extern void report_transfer_performance (unsigned long, time_t, time_t);
-
 /*
  * All this stuff just to get my host computer's IP address!
  */
@@ -165,7 +163,8 @@
 #endif
   end_time = time (NULL);
   printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
-  report_transfer_performance (data_count, start_time, end_time);
+  print_transfer_performance (gdb_stdout, data_count, 0,
+			      end_time - start_time);
 
   /* Finally, make the PC point at the start address */
   if (exec_bfd)
@@ -264,7 +263,9 @@
 
       if (regno == SPI_REGNUM || regno == SPU_REGNUM)
 	{			/* special handling for stack pointer (spu or spi) */
-	  unsigned long stackmode = read_register (PSW_REGNUM) & 0x80;
+	  ULONGEST stackmode, psw;
+	  regcache_cooked_read_unsigned (current_regcache, PSW_REGNUM, &psw);
+	  stackmode = psw & 0x80;
 
 	  if (regno == SPI_REGNUM && !stackmode)	/* SP == SPI */
 	    monitor_supply_register (SP_REGNUM, val);
@@ -568,8 +569,9 @@
 	  }
       /* Finally, make the PC point at the start address */
       write_pc (bfd_get_start_address (abfd));
-      report_transfer_performance (data_count, start_time, end_time);
       printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
+      print_transfer_performance (gdb_stdout, data_count, 0,
+				  end_time - start_time);
     }
   inferior_ptid = null_ptid;	/* No process now */
 
@@ -610,23 +612,23 @@
   mon2000_ops.to_open = mon2000_open;
   add_target (&mon2000_ops);
 
-  add_show_from_set
-    (add_set_cmd ("download-path", class_obscure, var_string,
-		  (char *) &download_path,
-		  "Set the default path for downloadable SREC files.",
-		  &setlist), &showlist);
-
-  add_show_from_set
-    (add_set_cmd ("board-address", class_obscure, var_string,
-		  (char *) &board_addr,
-		  "Set IP address for M32R-EVA target board.",
-		  &setlist), &showlist);
-
-  add_show_from_set
-    (add_set_cmd ("server-address", class_obscure, var_string,
-		  (char *) &server_addr,
-		  "Set IP address for download server (GDB's host computer).",
-		  &setlist), &showlist);
+  add_setshow_cmd ("download-path", class_obscure,
+		   var_string, &download_path,
+		   "Set the default path for downloadable SREC files.",
+		   "Show the default path for downloadable SREC files.",
+		   NULL, NULL, &setlist, &showlist);
+
+  add_setshow_cmd ("board-address", class_obscure,
+		   var_string, &board_addr,
+		   "Set IP address for M32R-EVA target board.",
+		   "Show IP address for M32R-EVA target board.",
+		   NULL, NULL, &setlist, &showlist);
+
+  add_setshow_cmd ("server-address", class_obscure,
+		   var_string, &server_addr,
+		   "Set IP address for download server (GDB's host computer).",
+		   "Show IP address for download server (GDB's host computer).",
+		   NULL, NULL, &setlist, &showlist);
 
   add_com ("upload", class_obscure, m32r_upload_command,
 	   "Upload the srec file via the monitor's Ethernet upload capability.");
diff -Naur src.orig/gdb/m32r-tdep.c src/gdb/m32r-tdep.c
--- src.orig/gdb/m32r-tdep.c	Tue Jul 22 08:07:29 2003
+++ src/gdb/m32r-tdep.c	Tue Jul 22 13:38:11 2003
@@ -111,8 +111,8 @@
   /* Determine appropriate breakpoint contents and size for this address.  */
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
-      if (((addr & 3) == 0) &&
-	  ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))
+      if (((addr & 3) == 0)
+	  && ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))
 	{
 	  static unsigned char insn[] = M32R_BE_BREAKPOINT32;
 	  bp = insn;
@@ -127,8 +127,8 @@
     }
   else
     {				/* little-endian */
-      if (((addr & 3) == 0) &&
-	  ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))
+      if (((addr & 3) == 0)
+	  && ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))
 	{
 	  static unsigned char insn[] = M32R_LE_BREAKPOINT32;
 	  bp = insn;
@@ -156,8 +156,8 @@
   /* Determine appropriate breakpoint contents and size for this address.  */
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
-      if (((addr & 3) == 0) &&
-	  ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))
+      if (((addr & 3) == 0)
+	  && ((contents_cache[0] & 0x80) || (contents_cache[2] & 0x80)))
 	{
 	  static unsigned char insn[] = M32R_BE_BREAKPOINT32;
 	  bplen = sizeof (insn);
@@ -171,8 +171,8 @@
   else
     {
       /* little-endian */
-      if (((addr & 3) == 0) &&
-	  ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))
+      if (((addr & 3) == 0)
+	  && ((contents_cache[1] & 0x80) || (contents_cache[3] & 0x80)))
 	{
 	  static unsigned char insn[] = M32R_BE_BREAKPOINT32;
 	  bplen = sizeof (insn);
@@ -362,9 +362,9 @@
 		}
 	      else
 		{
-		  if (((insn >> 8) == 0xe4) &&	/* ld24 r4, xxxxxx; sub sp, r4 */
-		      read_memory_unsigned_integer (current_pc + 2,
-						    2) == 0x0f24)
+		  if (((insn >> 8) == 0xe4)	/* ld24 r4, xxxxxx; sub sp, r4 */
+		      && read_memory_unsigned_integer (current_pc + 2,
+						       2) == 0x0f24)
 		    /* subtract 24 bit sign-extended negative-offset */
 		    {
 		      insn = read_memory_unsigned_integer (current_pc - 2, 4);
@@ -564,9 +564,9 @@
 		  short n = op & 0xffff;
 		  info->sp_offset += n;
 		}
-	      else if (((op >> 8) == 0xe4) &&	/* ld24 r4, xxxxxx; sub sp, r4 */
-		       get_frame_memory_unsigned (next_frame, pc + 4,
-						  2) == 0x0f24)
+	      else if (((op >> 8) == 0xe4)	/* ld24 r4, xxxxxx; sub sp, r4 */
+		       && get_frame_memory_unsigned (next_frame, pc + 4,
+						     2) == 0x0f24)
 		{
 		  unsigned long n = op & 0xffffff;
 		  info->sp_offset += n;
@@ -617,7 +617,7 @@
       /* The SP was moved to the FP.  This indicates that a new frame
          was created.  Get THIS frame's FP value by unwinding it from
          the next frame.  */
-      frame_unwind_unsigned_register (next_frame, M32R_FP_REGNUM, &this_base);
+      this_base = frame_unwind_register_unsigned (next_frame, M32R_FP_REGNUM);
       /* The FP points at the last saved register.  Adjust the FP back
          to before the first saved register giving the SP.  */
       prev_sp = this_base + info->size;
@@ -626,7 +626,7 @@
     {
       /* Assume that the FP is this frame's SP but with that pushed
          stack space added back.  */
-      frame_unwind_unsigned_register (next_frame, M32R_SP_REGNUM, &this_base);
+      this_base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
       prev_sp = this_base + info->size;
     }
 
@@ -657,11 +657,11 @@
 m32r_read_pc (ptid_t ptid)
 {
   ptid_t save_ptid;
-  CORE_ADDR pc;
+  ULONGEST pc;
 
   save_ptid = inferior_ptid;
   inferior_ptid = ptid;
-  pc = (int) read_register (M32R_PC_REGNUM);
+  regcache_cooked_read_unsigned (current_regcache, M32R_PC_REGNUM, &pc);
   inferior_ptid = save_ptid;
   return pc;
 }
@@ -680,9 +680,7 @@
 static CORE_ADDR
 m32r_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
-  ULONGEST sp;
-  frame_unwind_unsigned_register (next_frame, M32R_SP_REGNUM, &sp);
-  return sp;
+  return frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
 }
 
 
@@ -744,7 +742,7 @@
       else if (len < 4)
 	{
 	  /* value gets right-justified in the register or stack word */
-	  memcpy (valbuf + (REGISTER_RAW_SIZE (argreg) - len),
+	  memcpy (valbuf + (register_size (gdbarch, argreg) - len),
 		  (char *) VALUE_CONTENTS (args[argnum]), len);
 	  val = valbuf;
 	}
@@ -763,15 +761,16 @@
 	    {
 	      /* there's room in a register */
 	      regval =
-		extract_unsigned_integer (val, REGISTER_RAW_SIZE (argreg));
+		extract_unsigned_integer (val,
+					  register_size (gdbarch, argreg));
 	      regcache_cooked_write_unsigned (regcache, argreg++, regval);
 	    }
 
 	  /* Store the value 4 bytes at a time.  This means that things
 	     larger than 4 bytes may go partly in registers and partly
 	     on the stack.  */
-	  len -= REGISTER_RAW_SIZE (argreg);
-	  val += REGISTER_RAW_SIZE (argreg);
+	  len -= register_size (gdbarch, argreg);
+	  val += register_size (gdbarch, argreg);
 	}
     }
 
@@ -811,9 +810,7 @@
 static CORE_ADDR
 m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
-  ULONGEST pc;
-  frame_unwind_unsigned_register (next_frame, M32R_PC_REGNUM, &pc);
-  return pc;
+  return frame_unwind_register_unsigned (next_frame, M32R_PC_REGNUM);
 }
 
 /* Given a GDB frame, determine the address of the calling function's
@@ -884,7 +881,7 @@
 };
 
 static const struct frame_unwind *
-m32r_frame_p (CORE_ADDR pc)
+m32r_frame_sniffer (struct frame_info *next_frame)
 {
   return &m32r_frame_unwind;
 }
@@ -966,7 +963,7 @@
 
   set_gdbarch_frame_align (gdbarch, m32r_frame_align);
 
-  frame_unwind_append_predicate (gdbarch, m32r_frame_p);
+  frame_unwind_append_sniffer (gdbarch, m32r_frame_sniffer);
   frame_base_set_default (gdbarch, &m32r_frame_base);
 
   /* Methods for saving / extracting a dummy frame's ID.  The ID's

  reply	other threads:[~2003-07-22  5:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-04  2:00 Kei Sakamoto
2003-07-11  7:15 ` Kei Sakamoto
2003-07-11 13:31   ` Andrew Cagney
2003-07-21 18:49   ` Andrew Cagney
2003-07-22  5:00     ` Kei Sakamoto [this message]
2003-07-27 16:24       ` Andrew Cagney
2003-07-28  6:45         ` Kei Sakamoto
2003-08-01 21:12           ` Andrew Cagney

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='01fc01c3500e$7800d2f0$5169910a@KEI' \
    --to=sakamoto.kei@renesas.com \
    --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