aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/dwz.h
AgeCommit message (Collapse)AuthorFilesLines
2025-04-22Handle DWARF 5 separate debug sectionsTom Tromey1-2/+2
DWARF 5 standardized the .gnu_debugaltlink section that dwz emits in multi-file mode. This is handled via some new forms, and a new .debug_sup section. This patch adds support for this to gdb. It is largely straightforward, I think, though one oddity is that I chose not to have this code search the system build-id directories for the supplementary file. My feeling was that, while it makes sense for a distro to unify the build-id concept with the hash stored in the .debug_sup section, there's no intrinsic need to do so. This in turn means that a few tests -- for example those that test the index cache -- will not work in this mode. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32808 Acked-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-22Remove 'read' call from dwz_file::read_stringTom Tromey1-12/+13
dwz_file::read_string calls 'read' on the section, but this isn't needed as the sections have all been pre-read. This patch makes this change, and refactors dwz_file a bit to make this more obvious -- by making it clear that only the "static constructor" can create a dwz_file. Approved-By: Simon Marchi <simon.marchi@efficios.com> Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2025-04-08Update copyright dates to include 2025Tom Tromey1-1/+1
This updates the copyright headers to include 2025. I did this by running gdb/copyright.py and then manually modifying a few files as noted by the script. Approved-By: Eli Zaretskii <eliz@gnu.org>
2025-03-04gdb/dwarf: make dwarf2_get_dwz_file a method of dwarf2_per_bfdSimon Marchi1-8/+0
dwarf2_get_dwz_file looks more or less like a simple getter of dwarf2_per_bfd::dwz_file, so make it into a method. I typically avoid the `get_` prefix for getters, but that would conflict with the field name here. Change-Id: Idd0d5b1bd3813babf438b20aac514b19c77cfc18 Approved-By: Tom Tromey <tom@tromey.com>
2025-02-14gdb/dwarf: unique_ptr cleanupSimon Marchi1-1/+3
Throughout gdb/dwarf2, use `*_up` typedefs. Add a few missing typedefs, and move some so they are, ideally, just after the corresponding class. Change-Id: Iab5cd8fc2e9989d4bd8d4868586703c2312f254f Approved-By: Tom Tromey <tom@tromey.com>
2024-08-30gdb/dwarf2: cleanup includesSimon Marchi1-0/+1
Cleanup includes in dwarf2/*. 1. Add the necessary includes so that clangd reports no errors when opening header files. This ensures that header files include what they use. 2. Remove all includes reported as unused by clangd (except gdb-safe-ctype.h, which I think does some magic that affects what follows). Built-tested --enable-threading at "yes" and "no", since there are some portions of code gated by `#ifdef CXX_STD_THREAD`. Change-Id: I21debffcd7c2caf90f08e1e0fbba3ce30422d042 Approved-By: Tom Tromey <tom@tromey.com>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2024-01-08Pre-read DWZ section dataTom Tromey1-3/+10
This changes the DWZ code to pre-read the section data and somewhat simplify the DWZ API. This makes it easier to add the bfd_cache_close call to the new dwarf2_read_dwz_file function -- after this is done, there shouldn't be a reason to keep the BFD's file descriptor open.
2023-09-20[gdb/symtab] Error out for .debug_types section in dwz fileTom de Vries1-0/+1
There are two methods to factor out type information in a dwarf4 executable: - use -fdebug-info-types to generate type units in a .debug_types section, and - use dwz to create partial units. The dwz method has an extra benefit: it also allows to factor out information between executables into a newly created .dwz file, pointed to by a .gnu_debugaltlink section. There is nothing prohibiting a .gnu_debugaltlink file to contain a .debug_types section. It's just not generated by dwz or any other tool atm, and consequently gdb has no support for it. Enhancement PR symtab/30838 is open about the lack of support. Make the current situation explicit by emitting a dwarf error: ... (gdb) file struct-with-sig-2^M Reading symbols from struct-with-sig-2...^M Dwarf Error: .debug_types section not supported in dwz file^M ... and add an assert in write_gdbindex: ... + /* See enhancement PR symtab/30838. */ + gdb_assert (!(per_cu->is_dwz && per_cu->is_debug_types)); ... to clarify why we can use: ... data_buf &cu_list = (per_cu->is_debug_types ? types_cu_list : per_cu->is_dwz ? dwz_cu_list : objfile_cu_list); ... The test-case is a modified copy from gdb.dwarf2/struct-with-sig.exp, so it keeps the copyright years range. Tested on x86_64-linux. Tested-By: Guinevere Larsen <blarsen@redhat.com> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30838
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-03-06Move dwarf2_get_dwz_file to dwarf2/dwz.hTom Tromey1-0/+11
This moves dwarf2_get_dwz_file and some helper code to dwarf2/dwz.h. The main benefit of this is just shrinking dwarf2/read.c a little bit. gdb/ChangeLog 2021-03-06 Tom Tromey <tom@tromey.com> * dwarf2/sect-names.h (dwarf2_elf_names): Declare. * dwarf2/read.h (dwarf2_get_dwz_file): Move to dwz.h. * dwarf2/read.c (dwarf2_elf_names): No longer static. (locate_dwz_sections, dwz_search_other_debugdirs) (dwarf2_get_dwz_file): Move to dwz.c. * dwarf2/dwz.h (dwarf2_get_dwz_file): Move declaration from read.h. * dwarf2/dwz.c (locate_dwz_sections, dwz_search_other_debugdirs) (dwarf2_get_dwz_file): Move from read.c.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-03-26Add dwz.c and dwz_file::read_stringTom Tromey1-0/+7
This changes read_indirect_string_from_dwz to be a method on the dwz_file, and adds a new dwarf2/dwz.c file. gdb/ChangeLog 2020-03-26 Tom Tromey <tom@tromey.com> * dwarf2/read.c (read_attribute_value): Update. (read_indirect_string_from_dwz): Move to dwz.c; change into method. (dwarf_decode_macro_bytes): Update. * dwarf2/dwz.h (struct dwz_file) <read_string>: Declare method. * dwarf2/dwz.c: New file. * Makefile.in (COMMON_SFILES): Add dwz.c.
2020-03-26Introduce dwarf2/dwz.hTom Tromey1-0/+58
This moves "struct dwz_file" to a new header file, dwarf2/dwz.h. gdb/ChangeLog 2020-03-26 Tom Tromey <tom@tromey.com> * dwarf2/read.h (struct dwz_file): Move to dwz.h. * dwarf2/read.c: Add include. * dwarf2/index-write.c: Add include. * dwarf2/index-cache.c: Add include. * dwarf2/dwz.h: New file.