binutils-gdb/gdb/ctfread.h
Simon Marchi c8133969ad gdb/ctf: don't use psymtabs, create symtabs directly
The CTF debug info reader is the last user of partial symtabs.  Being a
fairly limited debug info format, CTF only uses a fraction of the
psymtab features.  So I see 3 ways forward:

 - keep psymtabs but trim them down, removing everything not useful for
   CTF

 - make the CTF reader implement its own index-like structure that
   implements the quick_symbol_functions interface (which would
   presumably be a small subset of partial symtabs)

 - make the CTF reader skip partial symtabs, create full symtabs
   directly

My hypothesis is that CTF debug info is typically small enough and fast
enough to process that it's not worth it to bother with an intermediate
step before full symbols.  But I will need help to see if this is true,
I'm not sure what representatively big C project I can build with CTF
debug info.  I tried to build the Linux kernel with -gctf, but I got
plenty of warnings like:

  ld: warning: orphan section `.ctf' from `vmlinux.o' being placed in section `.ctf'

GDB is still able to load the resulting ELF, and there are about 150k
calls to ctf_add_type_cb.  Before this patch, elfctf_build_psymtabs
takes anywhere between 300-350 ms.  With this patch, it's around 400 ms.

Implementation
--------------

This patch gets rid of the ctf_psymtab step, creating full symtabs from
the start.

The entry point elfctf_build_psymtabs gets renamed to
elfctf_build_symtabs.

Everything related to ctf_psymtab or partial symtabs is removed.

The build_ctf_archive_member function nows contains the code to build a
full symtab out of one CTF dict.  This code is not new for the most
part, it has been moved from other functions that used to be called when
expanding one symtab.

Change-Id: I728c1ef35785218c178fb467b80db71d59269a6d
Approved-By: Tom Tromey <tom@tromey.com>
2026-03-09 15:00:05 -04:00

25 lines
911 B
C

/* CTF debugging format support for GDB.
Copyright (C) 2019-2026 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef GDB_CTFREAD_H
#define GDB_CTFREAD_H
extern void elfctf_build_symtabs (struct objfile *objfile);
#endif /* GDB_CTFREAD_H */