aboutsummaryrefslogtreecommitdiff
path: root/gdb/progspace.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-19 20:40:52 +0000
committerSimon Marchi <simon.marchi@polymtl.ca>2023-10-20 22:00:23 -0400
commit0e17d3fc080f543d81e6c2520ba0bd8046ea3a95 (patch)
tree2f0a495b079cc9edb11114028e480890a1c1f866 /gdb/progspace.h
parent4a6daabb94982ccc17ea45ebb6f6e8efa8f86399 (diff)
downloadbinutils-0e17d3fc080f543d81e6c2520ba0bd8046ea3a95.zip
binutils-0e17d3fc080f543d81e6c2520ba0bd8046ea3a95.tar.gz
binutils-0e17d3fc080f543d81e6c2520ba0bd8046ea3a95.tar.bz2
gdb: fix owner passed to remove_target_sections in clear_solib
Commit 8971d2788e7 ("gdb: link so_list using intrusive_list") introduced a bug in clear_solib. Instead of passing an `so_list *` to remove_target_sections, it passed an `so_list **`. This was not caught by the compiler, because remove_target_sections takes a `void *` as the "owner", so you can pass it any pointer and it won't complain. This happened because I previously had a patch to change the type of the disposer parameter to be a reference rather than a pointer, so had to change `so` to `&so`. When dropping that patch, I forgot to revert this bit and / or it got re-introduced when handling subsequent merge conflicts. And I didn't properly retest. Fix that, but try to make things less error prone. Add a union to represent the possible owner kinds for a target_section. Trying to pass a pointer to another type than those will not compile. Change-Id: I600cab5ea0408ccc5638467b760768161ca3036c
Diffstat (limited to 'gdb/progspace.h')
-rw-r--r--gdb/progspace.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/progspace.h b/gdb/progspace.h
index a480f56..a22e427 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -284,11 +284,11 @@ struct program_space
bool empty ();
/* Remove all target sections owned by OWNER. */
- void remove_target_sections (const void *owner);
+ void remove_target_sections (target_section_owner owner);
/* Add the sections array defined by SECTIONS to the
current set of target sections. */
- void add_target_sections (const void *owner,
+ void add_target_sections (target_section_owner owner,
const std::vector<target_section> &sections);
/* Add the sections of OBJFILE to the current set of target