This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[7/10] [not really a patch] add assertion to minsyms.c
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 18 Feb 2013 13:29:19 -0700
- Subject: [7/10] [not really a patch] add assertion to minsyms.c
This patch is just for documentation purposes.
I don't plan to check it in.
This adds an assertion to prim_record_minimal_symbol_full to prove that,
after the previous patches are applied, a minsym's section and its
obj_section are identical.
This assertion doesn't trigger during a test suite run.
Tom
gdb/minsyms.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index b44f425..8f91d9d 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -947,14 +947,14 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
/* Find obj_section corresponding to bfd_section. */
if (bfd_section)
- ALL_OBJFILE_OSECTIONS (objfile, obj_section)
- {
- if (obj_section->the_bfd_section == bfd_section)
- {
- SYMBOL_OBJ_SECTION (msymbol) = obj_section;
- break;
- }
- }
+ {
+ /* This is written in a funny way due to some code in
+ elfread.c. */
+ gdb_assert (objfile->sections[section].the_bfd_section == bfd_section
+ || (objfile->separate_debug_objfile_backlink != NULL
+ && objfile->separate_debug_objfile_backlink->sections[section].the_bfd_section == bfd_section));
+ SYMBOL_OBJ_SECTION (msymbol) = &objfile->sections[section];
+ }
MSYMBOL_TYPE (msymbol) = ms_type;
MSYMBOL_TARGET_FLAG_1 (msymbol) = 0;
--
1.7.7.6