[2/4] Remove trailing '-' from the last QTDP action packet

Message ID 20180620210855.6385-3-pedromfc@linux.vnet.ibm.com
State New
Headers show
Series
  • Allow larger sizes for tracepoint register masks
Related show

Commit Message

Pedro Franco de Carvalho June 20, 2018, 9:08 p.m.
The has_more predicate in remote_target::download_tracepoint always
evaluates to true, so the last action packet will be sent with a
trailing '-'. This patch changes the predicate to remove the last
trailing '-'.

gdb/ChangeLog:
YYYY-MM-DD  Pedro Franco de Carvalho  <pedromfc@linux.vnet.ibm.com>

	* remote.c (remote_target::download_tracepoint): Fix the has_more
	predicate in the QTDP action list iteration.
---
 gdb/remote.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.13.6

Patch

diff --git a/gdb/remote.c b/gdb/remote.c
index ff6280a47d..04dc67fdc0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -12893,7 +12893,7 @@  remote_target::download_tracepoint (struct bp_location *loc)
     {
       QUIT;	/* Allow user to bail out with ^C.  */
 
-      bool has_more = (action_it != tdp_actions.end ()
+      bool has_more = ((action_it + 1) != tdp_actions.end ()
 		       || !stepping_actions.empty ());
 
       xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c",
@@ -12912,7 +12912,7 @@  remote_target::download_tracepoint (struct bp_location *loc)
       QUIT;	/* Allow user to bail out with ^C.  */
 
       bool is_first = action_it == stepping_actions.begin ();
-      bool has_more = action_it != stepping_actions.end ();
+      bool has_more = (action_it + 1) != stepping_actions.end ();
 
       xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s",
 		 b->number, addrbuf, /* address */