Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Joel Sherrill <joel.sherrill@oarcorp.com>,
	        "gdb@sourceware.org" <gdb@sourceware.org>,
	        Ralf Corsepius <ralf.corsepius@rtems.org>,
	gdb-patches@sourceware.org
Subject: Re: SPARC GDB Failure
Date: Mon, 07 Sep 2009 17:44:00 -0000	[thread overview]
Message-ID: <e394668d0909071044k421712b7q537b1a5170da1e0e@mail.gmail.com> (raw)
In-Reply-To: <20090907164528.GA6326@host0.dyn.jankratochvil.net>

On Mon, Sep 7, 2009 at 9:45 AM, Jan Kratochvil<jan.kratochvil@redhat.com> wrote:
> On Mon, 07 Sep 2009 16:18:05 +0200, Joel Sherrill wrote:
>> But sparc/sis core dumps in gdb instantly.
>
> It looks as the ia64 crash:
>        http://sourceware.org/ml/gdb-patches/2009-08/msg00221.html
>
> I grepped it before but not well enough, now used:
>        $ grep -il 'malloc.*tdep' *.c|xargs grep -il '! *tdep'
>        m68k-tdep.c
>        sparc-tdep.c
>
> I think the patch should go in nonetheless and I even hope it fixes it.
>
> No testing was made.
>
>
> Thanks,
> Jan
>
>
> gdb/
> 2009-09-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        Fix start crash on unitialized memory on m68k and sparc.
>        * m68k-tdep.c (m68k_gdbarch_init): Allocate TDEP as cleared.
>        * sparc-tdep.c (sparc32_gdbarch_init): Allocate TDEP as cleared.
>        Remove explicit clearing of TDEP fields.
>
> --- a/gdb/m68k-tdep.c
> +++ b/gdb/m68k-tdep.c
> @@ -1160,7 +1160,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>       break;
>     }
>
> -  tdep = xmalloc (sizeof (struct gdbarch_tdep));
> +  tdep = xzalloc (sizeof (struct gdbarch_tdep));
>   gdbarch = gdbarch_alloc (&info, tdep);
>   tdep->fpregs_present = has_fp;
>   tdep->flavour = flavour;
> --- a/gdb/sparc-tdep.c
> +++ b/gdb/sparc-tdep.c
> @@ -1377,16 +1377,11 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
>     return arches->gdbarch;
>
>   /* Allocate space for the new architecture.  */
> -  tdep = XMALLOC (struct gdbarch_tdep);
> +  tdep = XZALLOC (struct gdbarch_tdep);
>   gdbarch = gdbarch_alloc (&info, tdep);
>
>   tdep->pc_regnum = SPARC32_PC_REGNUM;
>   tdep->npc_regnum = SPARC32_NPC_REGNUM;
> -  tdep->gregset = NULL;
> -  tdep->sizeof_gregset = 0;
> -  tdep->fpregset = NULL;
> -  tdep->sizeof_fpregset = 0;
> -  tdep->plt_entry_size = 0;
>   tdep->step_trap = sparc_step_trap;
>
>   set_gdbarch_long_double_bit (gdbarch, 128);
>

It seems like all alloc's of gdbarch_tdep should be zalloc'd.
[But I wouldn't make that a requirement of this patch.]

The patch is fine with me.
I think, though, the changelog shouldn't claim it fixes something
unless that's been verified.


  reply	other threads:[~2009-09-07 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4AA5161D.1020102@oarcorp.com>
2009-09-07 16:45 ` Jan Kratochvil
2009-09-07 17:44   ` Doug Evans [this message]
2009-09-07 17:54     ` Jan Kratochvil
2009-09-07 18:16       ` Doug Evans
2009-09-07 18:24         ` Joel Brobecker
2009-09-07 18:35         ` Jan Kratochvil
2009-09-07 18:40         ` Joel Sherrill
2009-09-08  6:46           ` Ralf Corsepius

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=e394668d0909071044k421712b7q537b1a5170da1e0e@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gdb@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=joel.sherrill@oarcorp.com \
    --cc=ralf.corsepius@rtems.org \
    /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