gdb, gdbserver: make status_to_str return std::string

Instead of using a static buffer.  This is safer, and we don't really
mind about any extra dynamic allocation here, since it's only used for
debug purposes.

gdb/ChangeLog:

	* nat/linux-waitpid.c (status_to_str): Return std::string.
	* nat/linux-waitpid.h (status_to_str): Likewise.
	* linux-nat.c (linux_nat_post_attach_wait): Adjust.
	(linux_nat_target::attach): Adjust.
	(linux_handle_extended_wait): Adjust.
	(wait_lwp): Adjust.
	(stop_wait_callback): Adjust.
	(linux_nat_filter_event): Adjust.
	(linux_nat_wait_1): Adjust.
	* nat/linux-waitpid.c (status_to_str): Adjust.
	* nat/linux-waitpid.h (status_to_str): Adjust.

gdbserver/ChangeLog:

	* linux-low.cc (linux_process_target::wait_for_event_filtered):
	Adjust to status_to_str returning std::string.

Change-Id: Ia8aead70270438a5690f243e6faafff6c38ff757
This commit is contained in:
Simon Marchi
2021-05-08 21:06:41 -04:00
parent 550e9289ab
commit 8d06918ff5
6 changed files with 41 additions and 25 deletions

View File

@@ -2601,7 +2601,7 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
if (debug_threads)
{
debug_printf ("LLW: waitpid %ld received %s\n",
(long) ret, status_to_str (*wstatp));
(long) ret, status_to_str (*wstatp).c_str ());
}
/* Filter all events. IOW, leave all events pending. We'll