]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix inverted logic bug
authorLuis Machado <luis.machado@linaro.org>
Mon, 29 Mar 2021 16:48:43 +0000 (13:48 -0300)
committerLuis Machado <luis.machado@linaro.org>
Tue, 30 Mar 2021 12:23:11 +0000 (09:23 -0300)
During reviews, I changed the success/failure variables from int to bool, but
missed updating the code in a couple spots.  Given the logic inversion, the
gdbserver code fails instead of succeeding.

Fixed with the following patch. Seems fairly obvious, so I'll push it soon.

gdbserver/ChangeLog:

2021-03-30  Luis Machado  <luis.machado@linaro.org>

* server.cc (handle_general_set, handle_query): Update variable
to bool and fix verification logic.

gdbserver/ChangeLog
gdbserver/server.cc

index edce56b0eb9d2c1cce33ca5ed659eb860a176184..58ed0f0e69bfdb402a0cbdcf67523387a950e7e5 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-30  Luis Machado  <luis.machado@linaro.org>
+
+       * server.cc (handle_general_set, handle_query): Update variable
+       to bool and fix verification logic.
+
 2021-03-24  Luis Machado  <luis.machado@linaro.org>
 
        * Makefile.in (SFILES): Add /../gdb/nat/aarch64-mte-linux-ptrace.c.
index fd5e78083639660239b78b0dfbedf4b7dcf04ec8..2a443305691063d745e560e9063dab5a44f99644 100644 (file)
@@ -982,13 +982,13 @@ handle_general_set (char *own_buf)
 
       require_running_or_return (own_buf);
 
-      int ret = parse_store_memtags_request (own_buf, &addr, &len, tags,
+      bool ret = parse_store_memtags_request (own_buf, &addr, &len, tags,
                                             &type);
 
-      if (ret == 0)
+      if (ret)
        ret = the_target->store_memtags (addr, len, tags, type);
 
-      if (ret)
+      if (!ret)
        write_enn (own_buf);
       else
        write_ok (own_buf);
@@ -2730,12 +2730,12 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
 
       parse_fetch_memtags_request (own_buf, &addr, &len, &type);
 
-      int ret = the_target->fetch_memtags (addr, len, tags, type);
+      bool ret = the_target->fetch_memtags (addr, len, tags, type);
 
       if (ret)
        ret = create_fetch_memtags_reply (own_buf, tags);
 
-      if (ret)
+      if (!ret)
        write_enn (own_buf);
 
       *new_packet_len_p = strlen (own_buf);