aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-svr4.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-06-15 06:28:09 -0600
committerTom Tromey <tromey@adacore.com>2020-06-15 06:28:10 -0600
commit669203174311c5be76744a879563c697cd479853 (patch)
tree77b21ddbec4501e2cf04dafd9987a347d66e8cc2 /gdb/solib-svr4.c
parenta5d871ddaf2aa8462922ed25b0c0dc7f02128cb9 (diff)
downloadgdb-669203174311c5be76744a879563c697cd479853.zip
gdb-669203174311c5be76744a879563c697cd479853.tar.gz
gdb-669203174311c5be76744a879563c697cd479853.tar.bz2
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.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r--gdb/solib-svr4.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 19d1105..570450c 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -957,8 +957,6 @@ static int
open_symbol_file_object (int from_tty)
{
CORE_ADDR lm, l_name;
- gdb::unique_xmalloc_ptr<char> filename;
- int errcode;
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int l_name_size = TYPE_LENGTH (ptr_type);
@@ -993,12 +991,12 @@ open_symbol_file_object (int from_tty)
return 0; /* No filename. */
/* Now fetch the filename from target memory. */
- target_read_string (l_name, &filename, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+ gdb::unique_xmalloc_ptr<char> filename
+ = target_read_string (l_name, SO_NAME_MAX_PATH_SIZE - 1);
- if (errcode)
+ if (filename == nullptr)
{
- warning (_("failed to read exec filename from attached file: %s"),
- safe_strerror (errcode));
+ warning (_("failed to read exec filename from attached file"));
return 0;
}
@@ -1297,9 +1295,6 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
for (; lm != 0; prev_lm = lm, lm = next_lm)
{
- int errcode;
- gdb::unique_xmalloc_ptr<char> buffer;
-
so_list_up newobj (XCNEW (struct so_list));
lm_info_svr4 *li = lm_info_read (lm).release ();
@@ -1330,17 +1325,16 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
}
/* Extract this shared object's name. */
- target_read_string (li->l_name, &buffer, SO_NAME_MAX_PATH_SIZE - 1,
- &errcode);
- if (errcode != 0)
+ gdb::unique_xmalloc_ptr<char> buffer
+ = target_read_string (li->l_name, SO_NAME_MAX_PATH_SIZE - 1);
+ if (buffer == nullptr)
{
/* If this entry's l_name address matches that of the
inferior executable, then this is not a normal shared
object, but (most likely) a vDSO. In this case, silently
skip it; otherwise emit a warning. */
if (first_l_name == 0 || li->l_name != first_l_name)
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ warning (_("Can't read pathname for load map."));
continue;
}