Make target_waitstatus_to_string return an std::string

A quite straightforward change.  It does "fix" leaks in record-btrace.c,
although since this is only used in debug printing code, it has no real
world impact.

gdb/ChangeLog:

	* target/waitstatus.h (target_waitstatus_to_string): Change
	return type to std::string.
	* target/waitstatus.c (target_waitstatus_to_string): Return
	std::string.
	* target.h (target_waitstatus_to_string): Remove declaration.
	* infrun.c (resume, clear_proceed_status_thread,
	print_target_wait_results, do_target_wait, save_waitstatus,
	stop_all_threads): Adjust.
	* record-btrace.c (record_btrace_wait): Adjust.
	* target-debug.h
	(target_debug_print_struct_target_waitstatus_p): Adjust.

gdb/gdbserver/ChangeLog:

	* linux-low.c (linux_wait_1): Adjust.
	* server.c (queue_stop_reply_callback): Adjust.
This commit is contained in:
Simon Marchi 2017-09-03 10:23:31 +02:00
parent f04bdfa7b2
commit 23fdd69e42
10 changed files with 71 additions and 70 deletions

View file

@ -3181,14 +3181,12 @@ queue_stop_reply_callback (struct inferior_list_entry *entry, void *arg)
{
if (debug_threads)
{
char *status_string
std::string status_string
= target_waitstatus_to_string (&thread->last_status);
debug_printf ("Reporting thread %s as already stopped with %s\n",
target_pid_to_str (entry->id),
status_string);
xfree (status_string);
status_string.c_str ());
}
gdb_assert (thread->last_status.kind != TARGET_WAITKIND_IGNORE);