public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/15990] New: linespecs of the form *EXPR fail when EXPR contains a path with a ':'
@ 2013-10-01 18:05 palves at redhat dot com
  2013-10-24 15:37 ` [Bug gdb/15990] " keiths at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: palves at redhat dot com @ 2013-10-01 18:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15990

            Bug ID: 15990
           Summary: linespecs of the form *EXPR fail when EXPR contains a
                    path with a ':'
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: palves at redhat dot com

I tried this in the dw2-dos-drive.exp test:

-gdb_test "break 'z:file.c':func" {Breakpoint [0-9]+ at .*}
+gdb_test "break *'z:file.c'::func" {Breakpoint [0-9]+ at .*}

But, that didn't work:

  (gdb) break *'z:file.c'::func
  Unmatched single quote.

The issue is that the tokenizer returns "*'z" as first token instead of
the whole linespec, which is what you'd get without the colon.

(top-gdb) p token
$1 = {type = LSTOKEN_STRING, data = {string = {ptr = 0x1f3a166
"*'z:file.c'::func", length = 3}, keyword = 0x1f3a166 "*'z:file.c'::func"}}

Then this:

  /* Get the first token.  */
  token = linespec_lexer_lex_one (parser);

  /* It must be either LSTOKEN_STRING or LSTOKEN_NUMBER.  */
  if (token.type == LSTOKEN_STRING && *LS_TOKEN_STOKEN (token).ptr == '*')
    {
      char *expr;
      const char *copy;

      /* User specified an expression, *EXPR.  Ignore the token's
     length, we want to parse everything beyond the '*'.  */
      copy = expr = xstrdup (LS_TOKEN_STOKEN (token).ptr);
      cleanup = make_cleanup (xfree, expr);
      PARSER_RESULT (parser)->expr_pc = linespec_expression_to_pc (&copy);

parses just a chunk of the expression it should parse.

Everything after the '*' is an expression (the syntax is *EXPR),
so I think it's wrong to even try to tokenize anything within EXPR to begin
with.

IMO, we could either handle *EXPR before lexing, or add a LSTOKEN_STAR, but
then we'd also need something like a struct ls_parser->want_start, as
we only want LSTOKEN_STAR the first time we lex.

There's also the parser->is_quote_enclosed business.  IOW:

 (gdb) break "*'z:file.c'::func"

Which probably means we need to strip the last double-quote before calling into
the expression machinery.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gdb/15990] linespecs of the form *EXPR fail when EXPR contains a path with a ':'
  2013-10-01 18:05 [Bug gdb/15990] New: linespecs of the form *EXPR fail when EXPR contains a path with a ':' palves at redhat dot com
@ 2013-10-24 15:37 ` keiths at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: keiths at redhat dot com @ 2013-10-24 15:37 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15990

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com

--- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
The non-quote-enclosed case (break *'z:file.c'::func) is fixed by my explicit
locations patchset, where the '*' case is effectively done instead of linespec
parsing. Not altogether unlike your pre-lexing suggestion.

The quote-enclosed case is still broken, though.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-24 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-01 18:05 [Bug gdb/15990] New: linespecs of the form *EXPR fail when EXPR contains a path with a ':' palves at redhat dot com
2013-10-24 15:37 ` [Bug gdb/15990] " keiths at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).