binutils-gdb/gdb/unittests
Simon Marchi 21fe1c752e remote: C++ify thread_item and threads_listing_context
This patch C++ifies the thread_item and threads_listing_context
structures in remote.c.  thread_item::{extra,name} are changed to
std::string.  As a result, there's a bit of awkwardness in
remote_update_thread_list, where we have to xstrdup those strings when
filling the private_thread_info structure.  This is removed in the
following patch, where private_thread_info is also C++ified and its
corresponding fields made std::string too.  The xstrdup then becomes an
std::move.

Other than that there's nothing really special, it's a usual day-to-day
VEC -> vector and char* -> std::string change.  It allows removing a
cleanup in remote_update_thread_list.

Note that an overload of hex2bin that returns a gdb::byte_vector is
added, with corresponding selftests.

gdb/ChangeLog:

	* remote.c (struct thread_item): Add constructor, disable copy
	construction and copy assignment, define default move
	construction and move assignment.
	<extra, name>: Change type to std::string.
	<core>: Initialize.
	<thread_handle>: Make non-pointer.
	(thread_item_t): Remove typedef.
	(DEF_VEC_O(thread_item_t)): Remove.
	(threads_listing_context) <contains_thread>: New method.
	<remove_thread>: New method.
	<items>: Change type to std::vector.
	(clear_threads_listing_context): Remove.
	(threads_listing_context_remove): Remove.
	(remote_newthread_step): Use thread_item constructor, adjust to
	change to std::vector.
	(start_thread): Use thread_item constructor, adjust to change to
	std::vector.
	(end_thread): Adjust to change to std::vector and std::string.
	(remote_get_threads_with_qthreadinfo): Use thread_item
	constructor, adjust to std::vector.
	(remote_update_thread_list): Adjust to change to std::vector and
	std::string, use threads_listing_context methods.
	(remove_child_of_pending_fork): Adjust.
	(remove_new_fork_children): Adjust.
	* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add rsp-low-selftests.c.
	(SUBDIR_UNITTESTS_OBS): Add rsp-low-selftests.o.
	* unittests/rsp-low-selftests.c: New file.
	* common/rsp-low.h: Include common/byte-vector.h.
	(hex2bin): New overload.
	* common/rsp-low.c (hex2bin): New overload.
2017-11-24 10:40:15 -05:00
..
optional gdb::optional unit tests 2017-04-18 23:49:33 +01:00
array-view-selftests.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
common-utils-selftests.c Introduce string_appendf/string_vappendf 2017-10-30 11:41:34 +00:00
environ-selftests.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
function-view-selftests.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
lookup_name_info-selftests.c lookup_name_info::make_ignore_params 2017-11-08 16:02:24 +00:00
memory-map-selftests.c Fix mem region parsing regression and add test 2017-11-14 16:42:08 -05:00
memrange-selftests.c Get rid of VEC(mem_range_s) 2017-10-16 11:07:18 -04:00
offset-type-selftests.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
optional-selftests.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
ptid-selftests.c ptid-selftests: Fix erroneous assert messages 2017-04-07 10:28:56 -04:00
rsp-low-selftests.c remote: C++ify thread_item and threads_listing_context 2017-11-24 10:40:15 -05:00
scoped_restore-selftests.c Add selftests run filtering 2017-09-16 14:06:03 +02:00
xml-utils-selftests.c Make xml_escape_text return an std::string 2017-09-16 14:19:31 +02:00