Remove trailing '-' from the last QTDP action packet
authorPedro Franco de Carvalho <pedromfc@linux.ibm.com>
Mon, 6 Aug 2018 19:24:55 +0000 (16:24 -0300)
committerPedro Franco de Carvalho <pedromfc@linux.ibm.com>
Mon, 6 Aug 2018 19:30:17 +0000 (16:30 -0300)
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:
2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* remote.c (remote_target::download_tracepoint): Fix the has_more
predicate in the QTDP action list iteration.

gdb/ChangeLog
gdb/remote.c

index fda8d5f3ab3fe3cb3ab347b5f7e0d8831c3014e4..9ec56690736606ff80b01c6c39e33be8a91b977c 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
+
+       * remote.c (remote_target::download_tracepoint): Fix the has_more
+       predicate in the QTDP action list iteration.
+
 2018-08-06  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>
 
        * remote.c (remote_target::download_tracepoint): Fix indentation
index 088efaad12ca4d3411ce9407640a4331f1d9ba38..e3180923ee6dc49d7763cf2419efcf96d82dcda6 100644 (file)
@@ -12932,7 +12932,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",
@@ -12951,7 +12951,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 */