Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] MI: Error out on -var-create invalid FRAME-ADDR
Date: Wed, 26 Aug 2009 20:08:00 -0000	[thread overview]
Message-ID: <20090826200813.GA7815@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <200908130942.55574.vladimir@codesourcery.com>

On Thu, 13 Aug 2009 07:42:54 +0200, Vladimir Prus wrote:
> I'd prefer error for all new code. Thanks!

Attached, OK to check-in?

Regression-tested on {x86_64,i686}-fedora11-linux-gnu.


Thanks,
Jan


gdb/
2009-08-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* varobj.c (varobj_create): Error if the specified frame was not found
	and it is needed.

gdb/testsuite/
2009-08-26  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.mi/mi2-var-cmd.exp (create variable with invalid FRAME-ADDR): New.

--- ./gdb/varobj.c	14 Aug 2009 00:32:32 -0000	1.146
+++ ./gdb/varobj.c	25 Aug 2009 14:25:48 -0000
@@ -565,8 +565,15 @@ varobj_create (char *objname,
          we must select the appropriate frame before parsing
          the expression, otherwise the value will not be current.
          Since select_frame is so benign, just call it for all cases. */
-      if (innermost_block && fi != NULL)
+      if (innermost_block)
 	{
+	  /* User could specify explicit FRAME-ADDR which was not found but
+	     EXPRESSION is frame specific and we would not be able to evaluate
+	     it correctly next time.  With VALID_BLOCK set we must also set
+	     FRAME and THREAD_ID.  */
+	  if (fi == NULL)
+	    error (_("Failed to find the specified frame"));
+
 	  var->root->frame = get_frame_id (fi);
 	  var->root->thread_id = pid_to_thread_id (inferior_ptid);
 	  old_fi = get_selected_frame (NULL);
--- ./gdb/testsuite/gdb.mi/mi2-var-cmd.exp	7 Jul 2009 09:25:38 -0000	1.23
+++ ./gdb/testsuite/gdb.mi/mi2-var-cmd.exp	25 Aug 2009 14:25:50 -0000
@@ -126,6 +126,11 @@ mi_gdb_test "-var-create int * int" \
 	"&\"Attempt to use a type name as an expression.\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
 	"create int"
 
+# The number 0 must be an invalid frame address and linteger a local variable.
+mi_gdb_test "-var-create invalidframe 0 linteger" \
+	"\\^error,msg=\"Failed to find the specified frame\"" \
+	"create variable with invalid FRAME-ADDR"
+
 
 #####             #####
 #                     #


  reply	other threads:[~2009-08-26 20:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10 16:55 Jan Kratochvil
2009-08-10 17:00 ` Vladimir Prus
2009-08-10 17:47   ` Jan Kratochvil
2009-08-13 15:03     ` Vladimir Prus
2009-08-26 20:08       ` Jan Kratochvil [this message]
2009-08-27  5:35         ` Vladimir Prus
2009-08-27  7:37           ` Jan Kratochvil

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=20090826200813.GA7815@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=vladimir@codesourcery.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