Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	Stan Shebs	<stanshebs@earthlink.net>,
	Tom Tromey <tromey@redhat.com>
Subject: Re: 7.4->7.5 Regression gdb.base/pending.exp with gdbserver  [Re: [PATCH] Dynamic printf for a target agent]
Date: Fri, 20 Jul 2012 02:28:00 -0000	[thread overview]
Message-ID: <2625393.59PdMiRRzQ@qiyao.dyndns.org> (raw)
In-Reply-To: <20120718191741.GA13886@host2.jankratochvil.net>

On Wednesday, July 18, 2012 09:17:41 PM Jan Kratochvil wrote:
> 2885fb01788703023acfeb2bade84c20d8723853 is the first bad commit
> commit 2885fb01788703023acfeb2bade84c20d8723853
> Author: Stan Shebs <shebs@apple.com>
> Date:   Mon Jul 2 15:29:29 2012 +0000
>         Add target-side support for dynamic printf.
> 
> Running ./gdb.base/pending.exp ...
> FAIL: gdb.base/pending.exp: continue to resolved breakpoint 2
> FAIL: gdb.base/pending.exp: continue to resolved breakpoint 1
> FAIL: gdb.base/pending.exp: continue to resolved breakpoint 3 (the program
> exited)
> 
> There is somehow missed a breakpoint, IIUC.

Hi,
This regression is caused by the following change,

On Monday, July 02, 2012 11:18:34 AM Stan Shebs wrote:
> @@ -2916,22 +2918,33 @@ process_point_options (CORE_ADDR point_a
>  
>    while (*dataptr)
>      {
> -      switch (*dataptr)
> +      if (*dataptr == ';')
> +       ++dataptr;
> +
> +      if (*dataptr == 'X')
>         {
> -         case 'X':
> -           /* Conditional expression.  */
> -           if (remote_debug)
> -             fprintf (stderr, "Found breakpoint condition.\n");
> -           add_breakpoint_condition (point_addr, &dataptr);
> -           break;
> -         default:
> -           /* Unrecognized token, just skip it.  */
> -           fprintf (stderr, "Unknown token %c, ignoring.\n",
> -                    *dataptr);
> +         /* Conditional expression.  */
> +         fprintf (stderr, "Found breakpoint condition.\n");
> +         add_breakpoint_condition (point_addr, &dataptr);
> +       }
> +      else if (strncmp (dataptr, "cmds:", strlen ("cmds:")) == 0)
> +       {
> +         dataptr += strlen ("cmds:");
> +         if (debug_threads)
> +           fprintf (stderr, "Found breakpoint commands %s.\n", dataptr);
> +         persist = (*dataptr == '1');
> +         dataptr += 2;
> +         add_breakpoint_commands (point_addr, &dataptr, persist);
> +       }
> +      else
> +       {
> +         /* Unrecognized token, just skip it.  */
> +         fprintf (stderr, "Unknown token %c, ignoring.\n",
> +                  *dataptr);
>         }
>  
>        /* Skip tokens until we find one that we recognize.  */
> -      while (*dataptr && *dataptr != 'X' && *dataptr != ';')
> +      while (*dataptr && *dataptr != ';')

It seems incorrect to remove "*dataptr != 'X'" out of this condition checking.

With the breakpoint commands added, the Z packet becomes

  "Z0xxxxXxxxx,Xxxxx;cmds:xxxxx"

When parsing this packet, in current (wrong) GDBserver, only the first
condition ('Xxxxx') in packet is added, and the rest of conditions are skipped,
which is a mistake.

The fix is just to revert this change.  Regression tested on x86_64/gdbserver,
and these fails are fixed.

-FAIL: gdb.base/pending.exp: continue to resolved breakpoint 2
-FAIL: gdb.base/pending.exp: continue to resolved breakpoint 1
+PASS: gdb.base/pending.exp: continue to resolved breakpoint 2
+PASS: gdb.base/pending.exp: continue to resolved breakpoint 1
-FAIL: gdb.base/pending.exp: continue to resolved breakpoint 3 (the program exited)
+PASS: gdb.base/pending.exp: continue to resolved breakpoint 3

Regression tested on x86_64/native, no changes.

-- 
Yao (齐尧)

gdb/gdbserver:

2012-07-20  Yao Qi  <yao@codesourcery.com>

	* server.c (process_point_options): Stop at 'X' when parsing.

---
 gdb/gdbserver/server.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 963d575..4e15b3c 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2944,7 +2944,7 @@ process_point_options (CORE_ADDR point_addr, char **packet)
 	}
 
       /* Skip tokens until we find one that we recognize.  */
-      while (*dataptr && *dataptr != ';')
+      while (*dataptr && *dataptr != 'X' && *dataptr != ';')
 	dataptr++;
     }
   *packet = dataptr;
-- 
1.7.7.6


  reply	other threads:[~2012-07-20  2:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  1:10 [PATCH] Dynamic printf for a target agent Stan Shebs
2012-05-31  6:02 ` Yao Qi
2012-06-25 15:31   ` Stan Shebs
2012-06-27 20:45     ` Tom Tromey
2012-07-02 18:19       ` Stan Shebs
2012-07-18 19:18         ` 7.4->7.5 Regression gdb.base/pending.exp with gdbserver [Re: [PATCH] Dynamic printf for a target agent] Jan Kratochvil
2012-07-20  2:28           ` Yao Qi [this message]
2012-07-25 19:50             ` Jan Kratochvil
2012-07-27  2:32               ` [committed]: " Yao Qi
2012-07-27 16:36             ` Pedro Alves
2012-07-28 10:24               ` Yao Qi
2012-07-28 11:41                 ` Yao Qi
2012-07-02 16:41     ` Build regression on 64-bit hosts " Jan Kratochvil

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=2625393.59PdMiRRzQ@qiyao.dyndns.org \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=stanshebs@earthlink.net \
    --cc=tromey@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