From bf365a6eb8017153912171ded6367d660d70088f Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Mon, 8 Jul 2019 13:59:15 +0100 Subject: 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.) 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. --- libctf/ctf-open.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libctf/ctf-open.c') diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 46fb42e..5d070ac 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -1323,11 +1323,7 @@ ctf_bufopen (const ctf_sect_t *ctfsect, const ctf_sect_t *symsect, if (foreign_endian) flip_header (hp); - - ctf_dprintf ("header offsets: %x/%x/%x/%x/%x/%x/%x\n", - hp->cth_lbloff, hp->cth_objtoff, hp->cth_funcoff, - hp->cth_varoff, hp->cth_typeoff, hp->cth_stroff, - hp->cth_strlen); + fp->ctf_openflags = hp->cth_flags; fp->ctf_size = hp->cth_stroff + hp->cth_strlen; -- cgit v1.1