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.
This commit is contained in:
parent
fd55eae84d
commit
9b32cba44d
7 changed files with 151 additions and 14 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue