Fix btrace regression
authorTom Tromey <tom@tromey.com>
Wed, 1 Mar 2023 01:43:01 +0000 (18:43 -0700)
committerTom Tromey <tom@tromey.com>
Wed, 1 Mar 2023 13:38:19 +0000 (06:38 -0700)
Tom de Vries pointed out that my earlier patch:

    commit 873a185be258ad2552b9579005852815b4da5baf
    Date:   Fri Dec 16 07:56:57 2022 -0700

Don't use struct buffer in handle_qxfer_btrace

regressed gdb.btrace/reconnect.exp.  I didn't notice this because I
did not have libipt installed.

This patch fixes the bug.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30169
Tested-By: Bruno Larsen <blarsen@redhat.com>
gdbserver/linux-low.cc

index dec1944d45ff74b84ac871c4169f4eadc026be7e..0ca3bb1cd6af282d486327d8314ff714b9c70a61 100644 (file)
@@ -6781,7 +6781,7 @@ linux_low_encode_raw (std::string *buffer, const gdb_byte *data,
       elem[0] = tohex ((*data >> 4) & 0xf);
       elem[1] = tohex (*data++ & 0xf);
 
-      buffer->append (elem);
+      buffer->append (elem, 2);
     }
 
   *buffer += "</raw>\n";