public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: archer@sourceware.org
Subject: Re: [expr] [patch] Fix "break expr if (cond)" regression
Date: Thu, 21 Jan 2010 17:36:00 -0000	[thread overview]
Message-ID: <4B589095.50303@redhat.com> (raw)
In-Reply-To: <20100121164053.GA12326@host0.dyn.jankratochvil.net>

On 01/21/2010 08:40 AM, Jan Kratochvil wrote:
> commit 97a9a53e60460dd246de6a1d5ce50bf3497a1eb8
> Author: keiths<keiths@redhat.com>
> Date:   Thu Jan 14 18:51:45 2010 -0800
>
>          * linespec.c (decode_line_1): Keep overload information for the
>          non-compound case.

Grr... Linespecs again. Once you get into them, they never let you go.

>   (gdb) break marker1 if (1==1)
> -Breakpoint 4 at 0x80485eb: file gdb/testsuite/gdb.base/break1.c, line 45.
> -PASS: gdb.base/condbreak.exp: break marker1 if (1==1)
> +Function "marker1 if (1==1)" not defined.
> +Make breakpoint pending on future shared library load? (y or [n]) n
> +FAIL: gdb.base/condbreak.exp: break marker1 if (1==1) (got interactive prompt)

Ugh! My bad. On my last commit, I checked in something dubious: the call 
to strrchr -- I originally wrote something a little more elaborate to do 
that job. Now I remember why I originally did that. I reverted that bit 
of the change locally, and that fixes all the regressions.

Here's the patch that I pulled from the history:

diff --git a/gdb/linespec.c b/gdb/linespec.c
index d6f0ed8..fdd7b5a 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -820,9 +820,25 @@ decode_line_1 (char **argptr, int funfirstline, 
struct symtab *default_symtab,
      p = find_template_name_end (p);

    /* Keep method overload information.  */
-  q = strchr (p, '(');
-  if (q != NULL)
-    p = strrchr (q, ')') + 1;
+  if (*p == '(')
+    {
+      int depth = 0;
+
+      while (*p)
+	{
+	  if (*p == '(')
+	    ++depth;
+	  else if (*p == ')')
+	    {
+	      if (--depth == 0)
+		{
+		  ++p;
+		  break;
+		}
+	    }
+	  ++p;
+	}
+    }

    /* Make sure we keep important kewords like "const" */
    if (strncmp (p, " const", 6) == 0)

> I do not fully agree with my patch but I also do not fully agree with the
> former patch, maybe bison should be used to parse the expression, but rather
> someone (Tom? unaware) said that "break E [thread T] [if C]" should be rather
> changed to the more parseable+standardized "break [-thread T] [-if C] E" so
> that these expression parsing difficulties would be present only as a backward
> compatibility and do not need to supersede the former functionality.

Yeah, it would be wonderful, in general, to get rid of linespecs 
entirely. They suck big time.

Sorry about that.

Keith

  reply	other threads:[~2010-01-21 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 16:41 Jan Kratochvil
2010-01-21 17:36 ` Keith Seitz [this message]
2010-01-21 21:05 ` Tom Tromey

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=4B589095.50303@redhat.com \
    --to=keiths@redhat.com \
    --cc=archer@sourceware.org \
    --cc=jan.kratochvil@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).