Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Paul Pluzhnikov" <ppluzhnikov@google.com>
To: "Paul Pluzhnikov" <ppluzhnikov@google.com>,
	gdb-patches@sourceware.org,         "Doug Evans" <dje@google.com>,
	"Michael Snyder" <msnyder@specifix.com>
Subject: Re: [RFC] Fix for mishandling of "break 'pthread_create@GLIBC_2.2.5'"
Date: Fri, 06 Jun 2008 02:14:00 -0000	[thread overview]
Message-ID: <8ac60eac0806051914w6f5ddc6ex3f9a74c9fee198c8@mail.gmail.com> (raw)
In-Reply-To: <20080605191340.GB25085@caradoc.them.org>

On Thu, Jun 5, 2008 at 12:13 PM, Daniel Jacobowitz <drow@false.org> wrote:
> On Tue, May 13, 2008 at 06:05:05PM -0700, Paul Pluzhnikov wrote:
>> So the expression evaluation and the breakpoint evaluation go
>> completely separate routes:
>
> Ah, right.  I tried nested functions in GCC, which have the same
> problem.

Yes, and the same fix should fix that as well :)

>>    set_flags (*argptr, &is_quoted, &paren_pointer);
>>
>> -  /* Check to see if it's a multipart linespec (with colons or
>> -     periods).  */
>> +  if ((*argptr)[0] == '\'')
>
> I believe this is the same as is_quoted.

You are correct.

> If I'm right, that implies that this breaks:
>
> (gdb) break 'foo.c':13

But that is *already* broken:

(gdb) b t.c:8
Breakpoint 1 at 0x400308: file t.c, line 8.
(gdb) b "t.c":8
Breakpoint 2 at 0x400308: file t.c, line 8.
(gdb) b 't.c':8
No source file named t.c'.
(gdb)

I can fix that (and I believe it should be fixed), but it appears
that single and double quotes are treated quite differently in
linespec.c

Is there maybe a reason for this?

> We need to call locate_first_half to separate the filename from the
> line number.  There's also the 'foo.c'::staticvar form to worry about.

That case already works correctly (remember -- variables go through
totally different path).

> I think locate_first_half is going to have to know whether is_quoted,
> and if so, only look for the matching quote.

Something like this:

@@ -1003,7 +1003,9 @@ locate_first_half (char **argptr, int *i

   /* Maybe arg is FILE : LINENUM or FILE : FUNCTION.  May also be
      CLASS::MEMBER, or NAMESPACE::NAME.  Look for ':', but ignore
-     inside of <>.  */
+     inside of <>.
+     May also be 'FILE' : LINENUM, or 'symbol@VERSION'. Ignore
+     any ':' or '.' inside single qoutes.  */

   p = *argptr;
   if (p[0] == '"')
@@ -1014,6 +1016,17 @@ locate_first_half (char **argptr, int *i
     }
   else
     *is_quote_enclosed = 0;
+
+  if (p[0] == '\'')
+    {
+      char *q = p + 1;
+      for (; *q && q[0] != '\''; q++) { }
+      if (q[0] == '\'')
+        q++;
+      else
+        error (_("missing closing quote in command"));
+      p = q;
+    }
   for (; *p; p++)
     {
       if (p[0] == '<')



-- 
Paul Pluzhnikov


  reply	other threads:[~2008-06-06  2:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-13 19:11 Paul Pluzhnikov
2008-05-13 19:21 ` Daniel Jacobowitz
2008-05-13 22:16   ` Michael Snyder
2008-05-13 23:02   ` Paul Pluzhnikov
2008-05-13 23:16     ` Daniel Jacobowitz
2008-05-14  1:05       ` Paul Pluzhnikov
2008-05-14  8:16         ` Paul Pluzhnikov
2008-06-05 19:14           ` Daniel Jacobowitz
2008-06-06  2:14             ` Paul Pluzhnikov [this message]
2008-06-06  2:35               ` Daniel Jacobowitz
2008-05-14  4:26     ` David Miller
2008-05-14  4:30       ` Daniel Jacobowitz
2008-05-14 11:51         ` David Miller
2008-05-14 14:48           ` Daniel Jacobowitz
2008-05-14 17:33             ` David Miller
2008-05-14 18:05               ` Andreas Schwab
2008-05-14 18:09                 ` David Miller

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=8ac60eac0806051914w6f5ddc6ex3f9a74c9fee198c8@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --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