Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@redhat.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch
Date: Mon, 06 Jan 2003 14:24:00 -0000	[thread overview]
Message-ID: <3E199170.4030409@redhat.com> (raw)
In-Reply-To: <1021221063923.ZM27492@localhost.localdomain>

> I've just committed the patch below.  As noted in the subject, it fixes
> a bug that was introduced when I multiarched NUM_REGS a short time ago.
> 
> 	* mips-tdep.c (heuristic_proc_desc): Clear memory associated with
> 	``temp_saved_regs'', not the pointer or other storage contiguous
> 	to this pointer.
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.147
> diff -u -p -r1.147 mips-tdep.c
> --- mips-tdep.c	13 Dec 2002 18:09:30 -0000	1.147
> +++ mips-tdep.c	21 Dec 2002 06:31:58 -0000
> @@ -2142,7 +2142,7 @@ heuristic_proc_desc (CORE_ADDR start_pc,
>      return NULL;
>    memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
>    temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
> -  memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
> +  memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
>    PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
>    PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM;
>    PROC_PC_REG (&temp_proc_desc) = RA_REGNUM;

Outch!

BTW, it isn't as bad as:

	memcpy (&frame->saved_regs, new_regs, sizeof (frame->saved_regs));

which has been cloned a number of times and now appears in multiple 
targets.  (frame->saved_regs is a pointer to the buffer).

good catch,
Andrew



      reply	other threads:[~2003-01-06 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20 22:46 Kevin Buettner
2003-01-06 14:24 ` Andrew Cagney [this message]

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=3E199170.4030409@redhat.com \
    --to=ac131313@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@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