From: Tom Tromey Date: Mon, 15 Jun 2020 12:28:09 +0000 (-0600) Subject: Remove a use of target_read_string X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a5d871ddaf2aa8462922ed25b0c0dc7f02128cb9;p=binutils-gdb.git Remove a use of target_read_string linux-tdep.c:dump_mapping_p uses target_read_string, but in a way that does not really make sense. It's better to use target_read_memory here. gdb/ChangeLog 2020-06-15 Tom Tromey * linux-tdep.c (dump_mapping_p): Use target_read_memory. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f12edc7264..af82b2310a6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-06-15 Tom Tromey + + * linux-tdep.c (dump_mapping_p): Use target_read_memory. + 2020-06-15 Tom Tromey * valprint.c (read_string): Update comment. diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 0f9559355f1..2dcdc630769 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -701,22 +701,16 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, if (!dump_p && private_p && offset == 0 && (filterflags & COREFILTER_ELF_HEADERS) != 0) { - /* Let's check if we have an ELF header. */ - gdb::unique_xmalloc_ptr header; - int errcode; - /* Useful define specifying the size of the ELF magical header. */ #ifndef SELFMAG #define SELFMAG 4 #endif - /* Read the first SELFMAG bytes and check if it is ELFMAG. */ - if (target_read_string (addr, &header, SELFMAG, &errcode) == SELFMAG - && errcode == 0) + /* Let's check if we have an ELF header. */ + gdb_byte h[SELFMAG]; + if (target_read_memory (addr, h, SELFMAG) == 0) { - const char *h = header.get (); - /* The EI_MAG* and ELFMAG* constants come from . */ if (h[EI_MAG0] == ELFMAG0 && h[EI_MAG1] == ELFMAG1