Change target_read_string API

This simplifies the target_read_string API a bit.

Note that some code was using safe_strerror on the error codes
returned by target_read_string.  It seems to me that this is incorrect
(if it was ever correct, it must have been quite a long time ago).

gdb/ChangeLog
2020-06-15  Tom Tromey  <tromey@adacore.com>

	* windows-nat.c (windows_nat::handle_output_debug_string):
	Update.
	(windows_nat::handle_ms_vc_exception): Update.
	* target.h (target_read_string): Change API.
	* target.c (target_read_string): Change API.
	* solib-svr4.c (open_symbol_file_object, svr4_read_so_list):
	Update.
	* solib-frv.c (frv_current_sos): Update.
	* solib-dsbt.c (dsbt_current_sos): Update.
	* solib-darwin.c (darwin_current_sos): Update.
	* linux-thread-db.c (inferior_has_bug): Update.
	* expprint.c (print_subexp_standard): Update.
	* ada-lang.c (ada_main_name, ada_tag_name_from_tsd)
	(ada_exception_message_1): Update.
This commit is contained in:
Tom Tromey
2020-06-15 06:28:09 -06:00
parent a5d871ddaf
commit 6692031743
11 changed files with 76 additions and 91 deletions

View File

@@ -472,16 +472,17 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
{
struct bound_minimal_symbol version_msym;
CORE_ADDR version_addr;
gdb::unique_xmalloc_ptr<char> version;
int err, got, retval = 0;
int got, retval = 0;
version_msym = lookup_minimal_symbol (ver_symbol, NULL, NULL);
if (version_msym.minsym == NULL)
return 0;
version_addr = BMSYMBOL_VALUE_ADDRESS (version_msym);
got = target_read_string (version_addr, &version, 32, &err);
if (err == 0 && memchr (version.get (), 0, got) == version.get () + got - 1)
gdb::unique_xmalloc_ptr<char> version
= target_read_string (version_addr, 32, &got);
if (version != nullptr
&& memchr (version.get (), 0, got) == version.get () + got - 1)
{
int major, minor;