Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sources.redhat.com
Subject: Re: Don't error out when variable not available
Date: Mon, 03 Jan 2005 13:41:00 -0000	[thread overview]
Message-ID: <jeu0pybpgp.fsf@sykes.suse.de> (raw)
In-Reply-To: <20050103004937.GA30858@nevyn.them.org> (Daniel Jacobowitz's message of "Sun, 2 Jan 2005 19:49:37 -0500")

How about this?

Andreas.

2005-01-03  Andreas Schwab  <schwab@suse.de>

	* stack.c (print_frame_args): Handle VALUE_OPTIMIZED_OUT.

	* dwarf2loc.c (loclist_read_variable): Return a value with
	VALUE_OPTIMIZED_OUT set instead of erring out when value not
	available.

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.18
diff -u -a -p -r1.18 dwarf2loc.c
--- dwarf2loc.c	9 Nov 2004 14:43:25 -0000	1.18
+++ dwarf2loc.c	3 Jan 2005 13:33:23 -0000
@@ -1,5 +1,5 @@
 /* DWARF 2 location expression support for GDB.
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright 2003, 2005 Free Software Foundation, Inc.
    Contributed by Daniel Jacobowitz, MontaVista Software, Inc.
 
    This file is part of GDB.
@@ -510,9 +510,14 @@ loclist_read_variable (struct symbol *sy
   data = find_location_expression (dlbaton, &size,
 				   frame ? get_frame_pc (frame) : 0);
   if (data == NULL)
-    error ("Variable \"%s\" is not available.", SYMBOL_NATURAL_NAME (symbol));
-
-  val = dwarf2_evaluate_loc_desc (symbol, frame, data, size, dlbaton->objfile);
+    {
+      val = allocate_value (SYMBOL_TYPE (symbol));
+      VALUE_LVAL (val) = not_lval;
+      VALUE_OPTIMIZED_OUT (val) = 1;
+    }
+  else
+    val = dwarf2_evaluate_loc_desc (symbol, frame, data, size,
+				    dlbaton->objfile);
 
   return val;
 }
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.119
diff -u -a -p -r1.119 stack.c
--- stack.c	12 Nov 2004 21:45:07 -0000	1.119
+++ stack.c	3 Jan 2005 13:33:56 -0000
@@ -1,7 +1,7 @@
 /* Print and select stack frames for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
    Software Foundation, Inc.
 
    This file is part of GDB.
@@ -353,10 +353,15 @@ print_frame_args (struct symbol *func, s
 
 	  if (val)
 	    {
-	      val_print (value_type (val), VALUE_CONTENTS (val), 0,
-			 VALUE_ADDRESS (val),
-			 stb->stream, 0, 0, 2, Val_no_prettyprint);
-	      ui_out_field_stream (uiout, "value", stb);
+	      if (VALUE_OPTIMIZED_OUT (val))
+		ui_out_text (uiout, "<value optimized out>");
+	      else
+		{
+		  val_print (value_type (val), VALUE_CONTENTS (val), 0,
+			     VALUE_ADDRESS (val),
+			     stb->stream, 0, 0, 2, Val_no_prettyprint);
+		  ui_out_field_stream (uiout, "value", stb);
+		}
 	    }
 	  else
 	    ui_out_text (uiout, "???");

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


  reply	other threads:[~2005-01-03 13:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-02 22:13 Andreas Schwab
2005-01-02 22:57 ` Daniel Jacobowitz
2005-01-02 23:49   ` Andreas Schwab
2005-01-03  0:49     ` Daniel Jacobowitz
2005-01-03 13:41       ` Andreas Schwab [this message]
2005-01-04 22:20 ` Andrew Cagney
2005-01-05 19:23   ` Andreas Schwab
2005-02-28 20:53     ` Daniel Jacobowitz

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=jeu0pybpgp.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --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