aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2019-07-08 13:59:15 +0100
committerNick Alcock <nick.alcock@oracle.com>2019-10-03 17:04:55 +0100
commit9b32cba44ddeb32251092a05f1238d2462eb2345 (patch)
treee313eb919ec3ae3c75c66829e290736843c8c745 /binutils
parentfd55eae84d8b94b497c6043e5aa6e111e7f5a225 (diff)
downloadgdb-9b32cba44ddeb32251092a05f1238d2462eb2345.zip
gdb-9b32cba44ddeb32251092a05f1238d2462eb2345.tar.gz
gdb-9b32cba44ddeb32251092a05f1238d2462eb2345.tar.bz2
libctf, binutils: dump the CTF header
The CTF header has before now been thrown away too soon to be dumped using the ctf_dump() machinery used by objdump and readelf: instead, a kludge involving debugging-priority dumps of the header offsets on every open was used. Replace this with proper first-class dumping machinery just like everything else in the CTF file, and have objdump and readelf use it. (The dumper already had an enum value in ctf_sect_names_t for this purpose, waiting to be used.) v5: fix tabdamage. libctf/ * ctf-impl.h (ctf_file_t): New field ctf_openflags. * ctf-open.c (ctf_bufopen): Set it. No longer dump header offsets. * ctf-dump.c (dump_header): New function, dump the CTF header. (ctf_dump): Call it. (ctf_dump_header_strfield): New function. (ctf_dump_header_sectfield): Likewise. binutils/ * objdump.c (dump_ctf_archive_member): Dump the CTF header. * readelf.c (dump_section_as_ctf): Likewise.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/objdump.c7
-rw-r--r--binutils/readelf.c7
3 files changed, 13 insertions, 6 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f4402ae..356eb05 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-08 Nick Alcock <nick.alcock@oracle.com>
+
+ * objdump.c (dump_ctf_archive_member): Dump the CTF header.
+ * readelf.c (dump_section_as_ctf): Likewise.
+
2019-10-02 Niklas Gürtler <profclonk@gmail.com>
PR 24942
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 96727a0..d5a45ae 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -3282,8 +3282,9 @@ static int
dump_ctf_archive_member (ctf_file_t *ctf, const char *name, void *arg)
{
ctf_file_t *parent = (ctf_file_t *) arg;
- const char *things[] = {"Labels", "Data objects", "Function objects",
- "Variables", "Types", "Strings", ""};
+ const char *things[] = {"Header", "Labels", "Data objects",
+ "Function objects", "Variables", "Types", "Strings",
+ ""};
const char **thing;
size_t i;
@@ -3294,7 +3295,7 @@ dump_ctf_archive_member (ctf_file_t *ctf, const char *name, void *arg)
printf (_("\nCTF archive member: %s:\n"), sanitize_string (name));
ctf_import (ctf, parent);
- for (i = 1, thing = things; *thing[0]; thing++, i++)
+ for (i = 0, thing = things; *thing[0]; thing++, i++)
{
ctf_dump_state_t *s = NULL;
char *item;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0962877..7e2b3ad 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13932,8 +13932,9 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
ctf_file_t * ctf = NULL;
ctf_file_t * parent = NULL;
- const char *things[] = {"Labels", "Data objects", "Function objects",
- "Variables", "Types", "Strings", ""};
+ const char *things[] = {"Header", "Labels", "Data objects",
+ "Function objects", "Variables", "Types", "Strings",
+ ""};
const char **thing;
int err;
bfd_boolean ret = FALSE;
@@ -14014,7 +14015,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
printf (_("\nDump of CTF section '%s':\n"),
printable_section_name (filedata, section));
- for (i = 1, thing = things; *thing[0]; thing++, i++)
+ for (i = 0, thing = things; *thing[0]; thing++, i++)
{
ctf_dump_state_t *s = NULL;
char *item;