Fix two bugs in gdbserver thread name handling
authorTom Tromey <tromey@adacore.com>
Fri, 15 Dec 2023 14:56:45 +0000 (07:56 -0700)
committerTom Tromey <tromey@adacore.com>
Tue, 9 Jan 2024 14:07:41 +0000 (07:07 -0700)
commit862180a2d10963494356ec089a16b808bab736bd
tree75a90c6a724aae0e9b52ca47d130714c0cdd07e0
parentbdb4b8036fd60438ac614d8a8326a17fa5f4ebe7
Fix two bugs in gdbserver thread name handling

Simon pointed out that my earlier patch to gdbserver's thread name
code:

    commit 07b3255c3bae7126a0d679f957788560351eb236
    Author: Tom Tromey <tom@tromey.com>
    Date:   Thu Jul 13 17:28:48 2023 -0600

Filter invalid encodings from Linux thread names

... introduced a regression.  This bug was that the iconv output was
not \0-terminated.

Looking at it, I found another bug as well -- replace_non_ascii would
not \0-terminate, and also would return the wrong pointer

This patch fixes both of them.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31153
gdbserver/linux-low.cc