Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Deuling <deuling@de.ibm.com>
To: gdb-patches@sourceware.org
Cc: Michael Snyder <msnyder@specifix.com>,
	        Mark Kettenis <mark.kettenis@xs4all.nl>,
	        Daniel Jacobowitz <drow@false.org>,
	uweigand@de.ibm.com
Subject: Re: [patch] Add proper error message instead of gdb_assert
Date: Mon, 03 Mar 2008 21:12:00 -0000	[thread overview]
Message-ID: <47CC6990.7080400@de.ibm.com> (raw)
In-Reply-To: <20080303203858.GA22316@caradoc.them.org>

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

Daniel Jacobowitz schrieb:
> On Mon, Mar 03, 2008 at 12:28:51PM -0800, Michael Snyder wrote:
>> On Mon, 2008-03-03 at 20:55 +0100, Mark Kettenis wrote:
>>
>>> Sorry, but I don't see why your error message is "proper".  The
>>> gdb_assert() should never fail; the fact that it does means that you
>>> have a bug elsewhere in gdb.
>> Isn't that what the "internal error" call is for?
> 
> gdb_assert calls internal_error anyway.
> 

What about the attached patch? It gives an error message in value_assign if you try to
access lval_register < 0. I guess this is much better for the user than a crashed GDB session.

What do you think ?



-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com


[-- Attachment #2: fix-fortran-2 --]
[-- Type: text/plain, Size: 697 bytes --]

diff -urpN gdb-6.7-orig/gdb/valops.c gdb-6.7/gdb/valops.c
--- gdb-6.7-orig/gdb/valops.c	2007-08-23 20:08:46.000000000 +0200
+++ gdb-6.7/gdb/valops.c	2008-03-03 22:05:59.000000000 +0100
@@ -623,10 +623,12 @@ value_assign (struct value *toval, struc
 	struct frame_info *frame;
 	int value_reg;
 
-	/* Figure out which frame this is in currently.  */
-	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
 	value_reg = VALUE_REGNUM (toval);
+	if (value_reg < 0)
+	  error (_("Invalid register %d"), value_reg);
 
+	/* Figure out which frame this is in currently.  */
+	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
 	if (!frame)
 	  error (_("Value being assigned to is no longer active."));
 	

  parent reply	other threads:[~2008-03-03 21:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03 19:37 Markus Deuling
2008-03-03 19:55 ` Mark Kettenis
2008-03-03 20:29   ` Michael Snyder
2008-03-03 20:37     ` Mark Kettenis
2008-03-04  4:09       ` Eli Zaretskii
2008-03-03 20:39     ` Daniel Jacobowitz
2008-03-03 20:46       ` Markus Deuling
2008-03-03 21:12       ` Markus Deuling [this message]
2008-03-03 21:17         ` Daniel Jacobowitz
2008-03-03 20:00 ` Ulrich Weigand
2008-03-03 20:30   ` Michael Snyder
2008-03-03 20:25 ` Michael Snyder

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=47CC6990.7080400@de.ibm.com \
    --to=deuling@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=msnyder@specifix.com \
    --cc=uweigand@de.ibm.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