This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/15990] New: linespecs of the form *EXPR fail when EXPR contains a path with a ':'


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]