[4/8] libctf: make ctf_bfdopen_ctfsect a debugger entry point

Message ID 20210324012158.35472-4-nick.alcock@oracle.com
State New
Headers show
Series
  • [1/8] libctf, dump: do not emit size or alignment if it would error
Related show

Commit Message

H.J. Lu via Binutils March 24, 2021, 1:21 a.m.
This makes it possible to use LIBCTF_DEBUG to debug things that happen
before the ctf_bfdopen_internal call that ctf_bfdopen_ctfsect eventually
thunks down to (symtab/strtab lookup, archive opening, etc).

This is not important for ctf_open callers, since ctf_fdopen already
calls libctf_init_debug, but ctf_bfdopen_ctfsect is a public entry point
that can be called directly (e.g. objdump and readelf both do so).

libctf/ChangeLog
2021-03-23  Nick Alcock  <nick.alcock@oracle.com>

	* ctf-open-bfd.c (ctf_bfdopen_ctfsect): Initialize debugging.
---
 libctf/ctf-open-bfd.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.31.0.253.gdec51257f3

Patch

diff --git a/libctf/ctf-open-bfd.c b/libctf/ctf-open-bfd.c
index 84e4af6a73a..950864118fc 100644
--- a/libctf/ctf-open-bfd.c
+++ b/libctf/ctf-open-bfd.c
@@ -99,6 +99,8 @@  ctf_bfdopen_ctfsect (struct bfd *abfd _libctf_unused_,
   char *strtab_alloc = NULL;
   int symsect_endianness = -1;
 
+  libctf_init_debug();
+
 #ifdef HAVE_BFD_ELF
   ctf_sect_t symsect, strsect;
   Elf_Internal_Shdr *symhdr;