diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-24 16:28:08 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-03-24 21:01:43 +1030 |
commit | 17749b3926dcf60acfec6b718733f3932b9fe880 (patch) | |
tree | 93d4a0055f4fbf440473d2a7b205c00e3cde1c31 /bfd | |
parent | c569a946f6925d3f210c3eaf74dcda56843350ef (diff) | |
download | gdb-17749b3926dcf60acfec6b718733f3932b9fe880.zip gdb-17749b3926dcf60acfec6b718733f3932b9fe880.tar.gz gdb-17749b3926dcf60acfec6b718733f3932b9fe880.tar.bz2 |
Tidy dwarf1 cached section contents
* dwarf1.c (_bfd_dwarf1_cleanup_debug_info): New function.
* libbfd-in.h (_bfd_dwarf1_cleanup_debug_info): Declare.
* elf.c (_bfd_elf_close_and_cleanup): Call it.
* elf-bfd.h (struct elf_obj_tdata): Make dwarf1_find_line_info
a void*.
* libbfd.h: Regenerate.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/dwarf1.c | 12 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 2 | ||||
-rw-r--r-- | bfd/elf.c | 1 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 4 | ||||
-rw-r--r-- | bfd/libbfd.h | 4 |
5 files changed, 22 insertions, 1 deletions
diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c index a80d19d..d7c50ea 100644 --- a/bfd/dwarf1.c +++ b/bfd/dwarf1.c @@ -593,3 +593,15 @@ _bfd_dwarf1_find_nearest_line (bfd *abfd, return false; } + +void +_bfd_dwarf1_cleanup_debug_info (bfd *abfd ATTRIBUTE_UNUSED, void **pinfo) +{ + struct dwarf1_debug* stash = *pinfo; + + if (stash == NULL) + return; + + free (stash->debug_section); + free (stash->line_section); +} diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index dff1982..2a64a1e 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2070,7 +2070,7 @@ struct elf_obj_tdata void *line_info; /* A place to stash dwarf1 info for this bfd. */ - struct dwarf1_debug *dwarf1_find_line_info; + void *dwarf1_find_line_info; /* A place to stash dwarf2 info for this bfd. */ void *dwarf2_find_line_info; @@ -9592,6 +9592,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd) if (elf_tdata (abfd)->o != NULL && elf_shstrtab (abfd) != NULL) _bfd_elf_strtab_free (elf_shstrtab (abfd)); _bfd_dwarf2_cleanup_debug_info (abfd, &tdata->dwarf2_find_line_info); + _bfd_dwarf1_cleanup_debug_info (abfd, &tdata->dwarf1_find_line_info); _bfd_stab_cleanup (abfd, &tdata->line_info); } diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index ff58421..1c9f34b 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -573,6 +573,10 @@ extern bool _bfd_dwarf1_find_nearest_line (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; +/* Clean up the data used to handle DWARF 1 debugging information. */ +extern void _bfd_dwarf1_cleanup_debug_info + (bfd *, void **) ATTRIBUTE_HIDDEN; + struct dwarf_debug_section { const char * uncompressed_name; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index fa6f2d7..d1dc7b9 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -579,6 +579,10 @@ extern bool _bfd_dwarf1_find_nearest_line (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN; +/* Clean up the data used to handle DWARF 1 debugging information. */ +extern void _bfd_dwarf1_cleanup_debug_info + (bfd *, void **) ATTRIBUTE_HIDDEN; + struct dwarf_debug_section { const char * uncompressed_name; |