Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: cgd@broadcom.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: gdb tx39-elf configuration doesn't compile, multi-arch lossage?
Date: Tue, 17 Dec 2002 15:28:00 -0000	[thread overview]
Message-ID: <1021217231601.ZM18295@localhost.localdomain> (raw)
In-Reply-To: cgd@broadcom.com "gdb tx39-elf configuration doesn't compile, multi-arch lossage?" (Dec 17, 10:52am)

On Dec 17, 10:52am, cgd@broadcom.com wrote:

> multi-arch lossage?

Yes.  (My fault, sorry.)

I've just committed the patch below.  Please let me know if you have
any problems with it.

Kevin

2002-12-17  Kevin Buettner  <kevinb@redhat.com>

	* dve3900-rom.c (r3900_regnames): Don't use NUM_REGS to determine
	size.
	(fetch_bitmapped_register, store_bitmapped_register): Add bounds
	checks for r3900_regnames[].

Index: dve3900-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/dve3900-rom.c,v
retrieving revision 1.8
diff -u -p -r1.8 dve3900-rom.c
--- dve3900-rom.c	4 May 2001 04:15:24 -0000	1.8
+++ dve3900-rom.c	17 Dec 2002 23:07:55 -0000
@@ -113,7 +113,7 @@ static int ethernet = 0;
    different names than GDB does, and don't support all the registers
    either.  */
 
-static char *r3900_regnames[NUM_REGS] =
+static char *r3900_regnames[] =
 {
   "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
   "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
@@ -456,8 +456,15 @@ fetch_bitmapped_register (int regno, str
 {
   unsigned long val;
   unsigned char regbuf[MAX_REGISTER_RAW_SIZE];
+  char *regname = NULL;
 
-  monitor_printf ("x%s\r", r3900_regnames[regno]);
+  if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
+    internal_error (__FILE__, __LINE__,
+                    "fetch_bitmapped_register: regno out of bounds");
+  else
+    regname = r3900_regnames[regno];
+
+  monitor_printf ("x%s\r", regname);
   val = fetch_fields (bf);
   monitor_printf (".\r");
   monitor_expect_prompt (NULL, 0);
@@ -501,9 +508,16 @@ static void
 store_bitmapped_register (int regno, struct bit_field *bf)
 {
   unsigned long oldval, newval;
+  char *regname = NULL;
+
+  if (regno >= sizeof (r3900_regnames) / sizeof (r3900_regnames[0]))
+    internal_error (__FILE__, __LINE__,
+                    "fetch_bitmapped_register: regno out of bounds");
+  else
+    regname = r3900_regnames[regno];
 
   /* Fetch the current value of the register.  */
-  monitor_printf ("x%s\r", r3900_regnames[regno]);
+  monitor_printf ("x%s\r", regname);
   oldval = fetch_fields (bf);
   newval = read_register (regno);
 


           reply	other threads:[~2002-12-17 23:16 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <yov58yyoeavd.fsf@broadcom.com>]

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=1021217231601.ZM18295@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=cgd@broadcom.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