From: "Rob Quill" <rob.quill@gmail.com>
To: "Jim Blandy" <jimb@codesourcery.com>
Cc: msnyder@specifix.com, gdb-patches@sourceware.org
Subject: Re: New scope checking patch
Date: Fri, 18 Jan 2008 22:43:00 -0000 [thread overview]
Message-ID: <baf6008d0801181443s5321e5d5ud1c935aa8487a549@mail.gmail.com> (raw)
In-Reply-To: <m3r6gf6kcz.fsf@codesourcery.com>
On 18/01/2008, Jim Blandy <jimb@codesourcery.com> wrote:
>
> "Rob Quill" <rob.quill at gmail.com> writes:
> >> > + if (!have_full_symbols () && !have_partial_symbols ())
> >> > + error ("No symbol table is loaded. Use the \"file\" command.");
> >>
> >> Too much indentation?
> >
> > Well, you would think so, but I've changed the tab spacing in vim to 8
> > and the way I have formatted it matches how everything else is
> > formatted.
>
> I swear I'm not harrassing you. :) Once we can get these minor things
> taken care of, the patch looks ready to me.
Sorry about that. I was just frustrated because it feels like every
time I submit this wrong it makes me look bad :)
> The error should be indented two columns within the 'if'. Here's what
> I see in most every other use of 'error' in the grammar section of the
> file.
>
> if (new_type == NULL)
> error ("No type \"%s\" within class or namespace \"%s\".",
> ncopy, TYPE_NAME (type));
>
> >> Closing brace should get its own line, since the opening brace did.
> >
> > This is what I thought too, but if you look at the rest of the file
> > (for example the case for "exp : exp ARROW name") the open brace
> > always starts on a new line and always ends on the same line.
>
> Right you are.
>
> >> When I view this (again, with 8-column tab stops), the 'case' is not
> >> lined up with the other cases, and the 'return' is not indented two
> >> spaces within the 'if'.
> >
> > Sorry, missed that. I've attached the fixed copy. I believe that the
> > amount of indentation matches the layout of the current file, and that
> > even though it looks like a lot in the context of the patch, all the
> > other grammar rules in the file use the same large amount of
> > indentation.
>
> This code block looks fine to me in your latest patch.
>
> The only other point left is the ChangeLog entry. The one you posted
> was:
>
> 2008-01-17 Rob Quill <rob.quill@gmail.com>
> * c-exp.y : Add $in_scope as a type of expression.
>
> This needs a little rearrangement, and a bit more detail. A model to
> follow might be:
>
> 2008-01-07 Vladimir Prus <vladimir@codesourcery.com>
>
> Ignore change in name of dynamic linker during
> execution on Solaris. This also unbreaks pending breakpoints.
>
> * solist.h (struct target_so_ops): New field same.
> * solib-svr4.c (svr4_same): New.
> (_initialize_svr4_solib): Register svr4_same.
> * solib.c (update_solib_list): Use ops->same, if available.
>
> If the change merits it, it's nice to have a (brief) summary sentence
> at the top (substantial explanation belongs in comments in the code).
> Your "Add $in_scope ..." might go there. Then, each change is
> attributed to a particular function, top-level declaration, or
> whatever grouping makes sense (in documentation, we put the section
> name in the parens).
>
> So your ChangeLog entry would need to mention IN_SCOPE as a new token
> you're defining, 'exp' (I guess) as the non-terminal symbol to which
> you're adding a grammar rule, and 'yylex' as the function to which
> you're adding a bit of code.
Ok, here we go.
Rob
2008-01-18 Rob Quill <rob.quill@gmail.com>
Add $in_scope as a type of expression.
* c-exp.y (IN_SCOPE): New token.
(exp): IN_SCOPE (name): evaluates to 1 if name is in scope, 0
otherwise.
(yylex): Match "$in_scope" as IN_SCOPE token
Index: gdb/c-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/c-exp.y,v
retrieving revision 1.42
diff -u -p -r1.42 c-exp.y
--- gdb/c-exp.y 9 Jan 2008 19:27:15 -0000 1.42
+++ gdb/c-exp.y 18 Jan 2008 22:41:05 -0000
@@ -208,6 +208,8 @@ static int parse_number (char *, int, in
%token TRUEKEYWORD
%token FALSEKEYWORD
+/* $in_scope opperator */
+%token IN_SCOPE
%left ','
%left ABOVE_COMMA
@@ -251,6 +253,30 @@ exp1 : exp
;
/* Expressions, not including the comma operator. */
+exp : IN_SCOPE '(' name_not_typename ')'
+ {
+ struct type *int_type;
+ struct minimal_symbol *min_symbol;
+
+ /* If there are no symbols then just stop right away */
+ if (!have_full_symbols () && !have_partial_symbols ())
+ error ("No symbol table is loaded. Use the \"file\" command.");
+
+ /* Otherwise, prepare to write out the value */
+ int_type = builtin_type (current_gdbarch)->builtin_int;
+ write_exp_elt_opcode (OP_LONG);
+ write_exp_elt_type (int_type);
+
+ min_symbol =
+ lookup_minimal_symbol (copy_name($3.stoken), NULL, NULL);
+ if ($3.sym || min_symbol)
+ write_exp_elt_longcst ((LONGEST) 1);
+ else
+ write_exp_elt_longcst ((LONGEST) 0);
+
+ write_exp_elt_opcode (OP_LONG); }
+ ;
+
exp : '*' exp %prec UNARY
{ write_exp_elt_opcode (UNOP_IND); }
;
@@ -1678,6 +1704,9 @@ yylex ()
/* Catch specific keywords. Should be done with a data structure. */
switch (namelen)
{
+ case 9:
+ if (strncmp (tokstart, "$in_scope", 9) == 0)
+ return IN_SCOPE;
case 8:
if (strncmp (tokstart, "unsigned", 8) == 0)
return UNSIGNED;
next prev parent reply other threads:[~2008-01-18 22:43 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 16:29 Rob Quill
2007-11-12 23:26 ` Michael Snyder
2008-01-10 1:00 ` Jim Blandy
2008-01-11 0:52 ` Rob Quill
2008-01-11 22:51 ` Jim Blandy
2008-01-14 23:07 ` Michael Snyder
2008-01-15 17:06 ` Jim Blandy
2008-01-17 19:32 ` Rob Quill
2008-01-17 20:15 ` Jim Blandy
2008-01-17 21:11 ` Rob Quill
2008-01-17 21:58 ` Jim Blandy
2008-01-17 23:40 ` Doug Evans
2008-01-18 1:31 ` Daniel Jacobowitz
2008-01-18 3:35 ` Rob Quill
2008-01-18 18:48 ` Jim Blandy
2008-01-18 22:43 ` Rob Quill [this message]
2008-01-19 0:38 ` Jim Blandy
2008-01-30 13:11 ` Rob Quill
2008-01-30 18:14 ` Jim Blandy
2008-01-30 18:31 ` Eli Zaretskii
2008-01-31 4:11 ` Jim Blandy
2008-01-31 7:26 ` Eli Zaretskii
2008-07-27 23:45 ` Rob Quill
2008-07-28 3:18 ` Eli Zaretskii
2008-07-28 10:31 ` Rob Quill
2008-07-28 18:27 ` Eli Zaretskii
2008-07-29 20:31 ` Tom Tromey
2008-07-29 21:04 ` Rob Quill
2008-07-29 21:45 ` Tom Tromey
2008-07-29 22:53 ` Rob Quill
2008-07-30 3:34 ` Tom Tromey
2008-10-23 13:42 ` Convenience functions (was: Re: New scope checking patch) Daniel Jacobowitz
2008-10-23 15:17 ` Convenience functions Tom Tromey
2008-10-23 15:22 ` Daniel Jacobowitz
2008-10-23 15:26 ` Tom Tromey
2008-10-23 19:14 ` Tom Tromey
2008-10-24 12:53 ` Eli Zaretskii
2008-11-04 21:37 ` Convenience functions (was: Re: New scope checking patch) Thiago Jung Bauermann
2008-11-04 22:23 ` Daniel Jacobowitz
2008-11-04 22:43 ` Convenience functions Tom Tromey
2008-01-31 7:52 ` New scope checking patch Michael Snyder
2008-01-19 1:35 ` 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=baf6008d0801181443s5321e5d5ud1c935aa8487a549@mail.gmail.com \
--to=rob.quill@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=jimb@codesourcery.com \
--cc=msnyder@specifix.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