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

On 02/13/2013 04:58 PM, Abid, Hafiz wrote:
> 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.

Ah, that's it.  Thanks for digging it out.

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

-- 
Pedro Alves


  reply	other threads:[~2013-02-13 17:01 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
2013-02-13 17:01     ` Pedro Alves [this message]
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=511BC6E3.6060405@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hafiz_abid@mentor.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