Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: fnf@redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: Patch for SIGSEGV in evaluate_subexp_standard
Date: Mon, 10 Dec 2001 11:44:00 -0000	[thread overview]
Message-ID: <20011210144331.A7991@nevyn.them.org> (raw)
In-Reply-To: <200112101744.fBAHiMe20084@fishpond.ninemoons.com>

On Mon, Dec 10, 2001 at 10:44:21AM -0700, Fred Fish wrote:
> This example demonstrates a bug that is triggered when a C++ file is
> not compiled with -g.  Attached is a proposed patch to fix the
> problem.  I've regression tested the patch with the gdb testsuite and
> there are no regressions on an i686-pc-linux-gnu host.
> 
> ========================= Begin example =========================

> (gdb) ptype x2.asString()
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x08079937 in evaluate_subexp_standard (expect_type=0x0, exp=0x860d330, pos=0xbfffed04, noside=EVAL_AVOID_SIDE_EFFECTS) at /src/sourceware/gdb/src/gdb/eval.c:929
> 929		  struct type *ftype =
> (top-gdb) list
> 924		     a function call. This is here because people often want to
> 925		     call, eg, strcmp, which gdb doesn't know is a function.  If
> 926		     gdb isn't asked for it's opinion (ie. through "whatis"),
> 927		     it won't offer it. */
> 928	
> 929		  struct type *ftype =
> 930		  TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0]));
> 931	
> 932		  if (ftype)
> 933		    return allocate_value (TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0])));
> (top-gdb) p argvec[0]
> $1 = (struct value *) 0x0
> (top-gdb) bt

> Here is the patch that fixes the bug.
> 
> 2001-12-10  Fred Fish  <fnf@redhat.com>
> 
> 	* values.c (value_fn_field): Add physname variable.  Use a minimal
> 	symbol if we don't find a full symbol.  Remove setting of the new
> 	value's type since that was already done by allocate_value().
> 	Remove obsolete commented out error call.

I think that the patch itself is fine (though I can not approve it). 
But could you either add a check for NULL at the call site, or perhaps
better add an error() like the commented out one in value_fn_field,
unless it is ever useful for value_fn_field to return NULL?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2001-12-10 19:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-10  9:51 Fred Fish
2001-12-10 11:44 ` Daniel Jacobowitz [this message]
2001-12-10 12:49 ` Jim Blandy
2001-12-10 14:58   ` Fred Fish
2001-12-11 10:56     ` Jim Blandy

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=20011210144331.A7991@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=fnf@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