Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Abid, Hafiz" <hafiz_abid@mentor.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>, <palves@redhat.com>
Subject: Re: [patch[ Improve the error messages of tvariable command
Date: Wed, 13 Feb 2013 16:58:00 -0000	[thread overview]
Message-ID: <1360774697.2842.2@abidh-ubunto1104> (raw)
In-Reply-To: <511BC3AA.60708@redhat.com> (from palves@redhat.com on Wed Feb	13 16:47:38 2013)

On 13/02/13 16:47:38, Pedro Alves wrote:
> I somewhat remember investigating this, and writing a longer
> rationale for the change -- the gist of it being not
> handling tsv name as expressions.   Can you dig it out from
> the internal archives and repost including that info?  It'd
> be good for posterity.
> 
> --
> Pedro Alves
> 
> 

Here is what I found. Is it what you were expecting?

--

Here's a fix for issue #8161, which is about the "tvariable" returning
errors on invalid and tsv names.  E.g.,

  Temporary breakpoint 1, main () at a.cc:2
  2           int x = 1;
  (gdb) tvar x
  Syntax must be $NAME [ = EXPR ]
  (gdb) tvar y
  No symbol "y" in current context.

The problem is the use of parse_expression to parse the tvariable's
name.  We could merely always catch errors thrown from within
parse_expression, and issue a "usage" error, but it wouldn't cover
all cases correctly.  E.g.,

  (gdb) tvar x = nonexistingvariable

is an invalid expression, not invalid syntax.

I also noticed that

  (gdb) tvar x = 1 = 1

would be incorrectly accepted.

Given that the comand is documented to only take an expression
on the right side of the '=', it seems that whatever is on
the left side of the '=' should not be treated as an expression, but
literaly as "$NAME".  That's what the patch does.

MI now shares the same name validations as the CLI variant.

--

Regards,
Abid


  reply	other threads:[~2013-02-13 16:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 16:59 Hafiz Abid Qadeer
2013-02-13 16:47 ` Pedro Alves
2013-02-13 16:58   ` Abid, Hafiz [this message]
2013-02-13 17:01     ` Pedro Alves
2013-02-13 17:07 ` Pedro Alves

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=1360774697.2842.2@abidh-ubunto1104 \
    --to=hafiz_abid@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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