From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id C4EB8384D377; Mon, 11 Apr 2022 14:48:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4EB8384D377 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove MSYMBOL_TYPE macro X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 4aeddc50d7a06294cc124dfd8f43992ffa0b7382 X-Git-Newrev: 60f62e2b83eb362c5063247235c111a59e13cad1 Message-Id: <20220411144810.C4EB8384D377@sourceware.org> Date: Mon, 11 Apr 2022 14:48:10 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2022 14:48:10 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D60f62e2b83eb= 362c5063247235c111a59e13cad1 commit 60f62e2b83eb362c5063247235c111a59e13cad1 Author: Simon Marchi Date: Fri Jan 28 10:28:57 2022 -0500 gdb: remove MSYMBOL_TYPE macro =20 Add a getter and a setter for a minimal symbol's type. Remove the corresponding macro and adjust all callers. =20 Change-Id: I89900df5ffa5687133fe1a16b2e0d4684e67a77d Diff: --- gdb/ada-lang.c | 6 +++--- gdb/breakpoint.c | 8 +++---- gdb/c-exp.y | 4 ++-- gdb/coff-pe-read.c | 2 +- gdb/coffread.c | 6 +++--- gdb/compile/compile-c-symbols.c | 4 ++-- gdb/compile/compile-cplus-symbols.c | 4 ++-- gdb/compile/compile-object-load.c | 2 +- gdb/elfread.c | 2 +- gdb/linespec.c | 14 ++++++------ gdb/minsyms.c | 43 ++++++++++++++++++---------------= ---- gdb/parse.c | 4 ++-- gdb/printcmd.c | 14 ++++++------ gdb/stabsread.c | 2 +- gdb/symmisc.c | 2 +- gdb/symtab.c | 34 ++++++++++++++--------------- gdb/symtab.h | 17 +++++++++++++-- 17 files changed, 90 insertions(+), 78 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 29f2a4b255a..ffe35500d68 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4898,7 +4898,7 @@ ada_lookup_simple_minsym (const char *name) for (minimal_symbol *msymbol : objfile->msymbols ()) { if (match_name (msymbol->linkage_name (), lookup_name, NULL) - && MSYMBOL_TYPE (msymbol) !=3D mst_solib_trampoline) + && msymbol->type () !=3D mst_solib_trampoline) { result.minsym =3D msymbol; result.objfile =3D objfile; @@ -11717,7 +11717,7 @@ ada_has_this_exception_support (const struct except= ion_support_info *einfo) struct bound_minimal_symbol msym =3D lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL); =20 - if (msym.minsym && MSYMBOL_TYPE (msym.minsym) !=3D mst_solib_trampol= ine) + if (msym.minsym && msym.minsym->type () !=3D mst_solib_trampoline) error (_("Your Ada runtime appears to be missing some debugging " "information.\nCannot insert Ada exception catchpoint " "in this configuration.")); @@ -11740,7 +11740,7 @@ ada_has_this_exception_support (const struct except= ion_support_info *einfo) struct bound_minimal_symbol msym =3D lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL); =20 - if (msym.minsym && MSYMBOL_TYPE (msym.minsym) !=3D mst_solib_trampol= ine) + if (msym.minsym && msym.minsym->type () !=3D mst_solib_trampoline) error (_("Your Ada runtime appears to be missing some debugging " "information.\nCannot insert Ada exception catchpoint " "in this configuration.")); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index af7eb6cc113..1a227e5d120 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3439,8 +3439,8 @@ create_std_terminate_master_breakpoint (void) struct bound_minimal_symbol m; =20 m =3D lookup_minimal_symbol (func_name, NULL, objfile); - if (m.minsym =3D=3D NULL || (MSYMBOL_TYPE (m.minsym) !=3D mst_text - && MSYMBOL_TYPE (m.minsym) !=3D mst_file_text)) + if (m.minsym =3D=3D NULL || (m.minsym->type () !=3D mst_text + && m.minsym->type () !=3D mst_file_text)) { /* Prevent future lookups in this objfile. */ bp_objfile_data->terminate_msym.minsym =3D &msym_not_found; @@ -7175,8 +7175,8 @@ set_breakpoint_location_function (struct bp_location = *loc) const char *function_name; =20 if (loc->msymbol !=3D NULL - && (MSYMBOL_TYPE (loc->msymbol) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (loc->msymbol) =3D=3D mst_data_gnu_ifunc)) + && (loc->msymbol->type () =3D=3D mst_text_gnu_ifunc + || loc->msymbol->type () =3D=3D mst_data_gnu_ifunc)) { struct breakpoint *b =3D loc->owner; =20 diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 4fa3f8d2fc4..d852b1e8a36 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1232,8 +1232,8 @@ variable: name_not_typename is important for example for "p *__errno_location()". */ symbol *alias_target - =3D ((msymbol.minsym->type !=3D mst_text_gnu_ifunc - && msymbol.minsym->type !=3D mst_data_gnu_ifunc) + =3D ((msymbol.minsym->type () !=3D mst_text_gnu_ifunc + && msymbol.minsym->type () !=3D mst_data_gnu_ifunc) ? find_function_alias_target (msymbol) : NULL); if (alias_target !=3D NULL) diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 1f11606cdff..3ae2a7ffb13 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -245,7 +245,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader, sym_name, dll_name, forward_qualified_name); =20 vma =3D msymbol.value_address (); - msymtype =3D MSYMBOL_TYPE (msymbol.minsym); + msymtype =3D msymbol.minsym->type (); section =3D msymbol.minsym->section_index (); =20 /* Generate a (hopefully unique) qualified name using the first part diff --git a/gdb/coffread.c b/gdb/coffread.c index 24dd9b96011..f5ef1285440 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -647,7 +647,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add= _flags symfile_flags) or "_imp_", get rid of the prefix, and search the minimal symbol in OBJFILE. Note that 'maintenance print msymbols' shows that type of these "_imp_XXXX" symbols is mst_data. */ - if (MSYMBOL_TYPE (msym) =3D=3D mst_data) + if (msym->type () =3D=3D mst_data) { const char *name1 =3D NULL; =20 @@ -669,8 +669,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add= _flags symfile_flags) respectively in OBJFILE. Set the type of symbol "foo" as 'mst_solib_trampoline'. */ if (found.minsym !=3D NULL - && MSYMBOL_TYPE (found.minsym) =3D=3D mst_text) - MSYMBOL_TYPE (found.minsym) =3D mst_solib_trampoline; + && found.minsym->type () =3D=3D mst_text) + found.minsym->set_type (mst_solib_trampoline); } } } diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbol= s.c index a50e84d117a..642c0be5db3 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -273,7 +273,7 @@ convert_symbol_bmsym (compile_c_instance *context, addr =3D msym->value_address (objfile); =20 /* Conversion copied from write_exp_msymbol. */ - switch (MSYMBOL_TYPE (msym)) + switch (msym->type ()) { case mst_text: case mst_file_text: @@ -422,7 +422,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *= gcc_context, "symbol\n", identifier); result =3D msym.value_address (); - if (MSYMBOL_TYPE (msym.minsym) =3D=3D mst_text_gnu_ifunc) + if (msym.minsym->type () =3D=3D mst_text_gnu_ifunc) result =3D gnu_ifunc_resolve_addr (target_gdbarch (), result); found =3D 1; } diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplu= s-symbols.c index b68184c55f9..7ad9ea91132 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -284,7 +284,7 @@ convert_symbol_bmsym (compile_cplus_instance *instance, addr =3D msym->value_address (objfile); =20 /* Conversion copied from write_exp_msymbol. */ - switch (MSYMBOL_TYPE (msym)) + switch (msym->type ()) { case mst_text: case mst_file_text: @@ -459,7 +459,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_co= ntext *gcc_context, "symbol\n", identifier); result =3D msym.value_address (); - if (MSYMBOL_TYPE (msym.minsym) =3D=3D mst_text_gnu_ifunc) + if (msym.minsym->type () =3D=3D mst_text_gnu_ifunc) result =3D gnu_ifunc_resolve_addr (target_gdbarch (), result); found =3D 1; } diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object= -load.c index bfb40c9625c..dee7882e7e3 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -766,7 +766,7 @@ compile_object_load (const compile_file_names &file_nam= es, =20 bmsym =3D lookup_minimal_symbol (sym->name, NULL, NULL); switch (bmsym.minsym =3D=3D NULL - ? mst_unknown : MSYMBOL_TYPE (bmsym.minsym)) + ? mst_unknown : bmsym.minsym->type ()) { case mst_text: case mst_bss: diff --git a/gdb/elfread.c b/gdb/elfread.c index 3f1f87650f2..6df206b19db 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -828,7 +828,7 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_AD= DR *addr_p) msym =3D lookup_minimal_symbol (name_got_plt, NULL, objfile); if (msym.minsym =3D=3D NULL) continue; - if (MSYMBOL_TYPE (msym.minsym) !=3D mst_slot_got_plt) + if (msym.minsym->type () !=3D mst_slot_got_plt) continue; pointer_address =3D msym.value_address (); =20 diff --git a/gdb/linespec.c b/gdb/linespec.c index 3c176bea94e..ba89bd09b56 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2228,11 +2228,11 @@ convert_linespec_to_sals (struct linespec_state *st= ate, linespec *ls) =20 for (const auto &elem : ls->minimal_symbols) { - if (MSYMBOL_TYPE (elem.minsym) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (elem.minsym) =3D=3D mst_data_gnu_ifunc) + if (elem.minsym->type () =3D=3D mst_text_gnu_ifunc + || elem.minsym->type () =3D=3D mst_data_gnu_ifunc) { CORE_ADDR msym_addr =3D elem.value_address (); - if (MSYMBOL_TYPE (elem.minsym) =3D=3D mst_data_gnu_ifunc) + if (elem.minsym->type () =3D=3D mst_data_gnu_ifunc) { struct gdbarch *gdbarch =3D elem.objfile->arch (); @@ -4146,8 +4146,8 @@ minsym_found (struct linespec_state *self, struct obj= file *objfile, { const char *msym_name =3D msymbol->linkage_name (); =20 - if (MSYMBOL_TYPE (msymbol) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (msymbol) =3D=3D mst_data_gnu_ifunc) + if (msymbol->type () =3D=3D mst_text_gnu_ifunc + || msymbol->type () =3D=3D mst_data_gnu_ifunc) want_start_sal =3D gnu_ifunc_resolve_name (msym_name, &func_addr); else want_start_sal =3D true; @@ -4284,7 +4284,7 @@ search_minsyms_for_name (struct collect_info *info, for (const bound_minimal_symbol &item : minsyms) { bool skip =3D false; - if (MSYMBOL_TYPE (item.minsym) =3D=3D mst_solib_trampoline) + if (item.minsym->type () =3D=3D mst_solib_trampoline) { for (const bound_minimal_symbol &item2 : minsyms) { @@ -4293,7 +4293,7 @@ search_minsyms_for_name (struct collect_info *info, =20 /* Trampoline symbols can only jump to exported symbols. */ - if (msymbol_type_is_static (MSYMBOL_TYPE (item2.minsym))) + if (msymbol_type_is_static (item2.minsym->type ())) continue; =20 if (strcmp (item.minsym->linkage_name (), diff --git a/gdb/minsyms.c b/gdb/minsyms.c index e93cbed8621..11d357b8096 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -115,7 +115,7 @@ msymbol_is_function (struct objfile *objfile, minimal_s= ymbol *minsym, { CORE_ADDR msym_addr =3D minsym->value_address (objfile); =20 - switch (minsym->type) + switch (minsym->type ()) { case mst_slot_got_plt: case mst_data: @@ -253,7 +253,7 @@ found_minimal_symbols::maybe_collect (const char *sfile, struct objfile *objfile, minimal_symbol *msymbol) { - switch (MSYMBOL_TYPE (msymbol)) + switch (msymbol->type ()) { case mst_file_text: case mst_file_data: @@ -586,8 +586,8 @@ lookup_minimal_symbol_linkage (const char *name, struct= objfile *objf) msymbol =3D msymbol->hash_next) { if (strcmp (msymbol->linkage_name (), name) =3D=3D 0 - && (MSYMBOL_TYPE (msymbol) =3D=3D mst_data - || MSYMBOL_TYPE (msymbol) =3D=3D mst_bss)) + && (msymbol->type () =3D=3D mst_data + || msymbol->type () =3D=3D mst_bss)) return {msymbol, objfile}; } } @@ -619,11 +619,11 @@ lookup_minimal_symbol_text (const char *name, struct = objfile *objf) msymbol =3D msymbol->hash_next) { if (strcmp (msymbol->linkage_name (), name) =3D=3D 0 && - (MSYMBOL_TYPE (msymbol) =3D=3D mst_text - || MSYMBOL_TYPE (msymbol) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (msymbol) =3D=3D mst_file_text)) + (msymbol->type () =3D=3D mst_text + || msymbol->type () =3D=3D mst_text_gnu_ifunc + || msymbol->type () =3D=3D mst_file_text)) { - switch (MSYMBOL_TYPE (msymbol)) + switch (msymbol->type ()) { case mst_file_text: found_file_symbol.minsym =3D msymbol; @@ -840,7 +840,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, s= truct obj_section *sectio triggered by a special mst_abs_or_lib or some such. */ =20 - if (MSYMBOL_TYPE (&msymbol[hi]) =3D=3D mst_abs) + if (msymbol[hi].type () =3D=3D mst_abs) { hi--; continue; @@ -866,8 +866,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, s= truct obj_section *sectio preceding symbol too. If they are otherwise identical prefer that one. */ if (hi > 0 - && MSYMBOL_TYPE (&msymbol[hi]) !=3D want_type - && MSYMBOL_TYPE (&msymbol[hi - 1]) =3D=3D want_type + && msymbol[hi].type () !=3D want_type + && msymbol[hi - 1].type () =3D=3D want_type && (MSYMBOL_SIZE (&msymbol[hi]) =3D=3D MSYMBOL_SIZE (&msymbol[hi - 1])) && (msymbol[hi].value_raw_address () @@ -993,7 +993,7 @@ in_gnu_ifunc_stub (CORE_ADDR pc) bound_minimal_symbol msymbol =3D lookup_minimal_symbol_by_pc_section (pc, NULL, lookup_msym_prefer::GNU_IFUNC); - return msymbol.minsym && MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_text_g= nu_ifunc; + return msymbol.minsym && msymbol.minsym->type () =3D=3D mst_text_gnu_ifu= nc; } =20 /* See elf_gnu_ifunc_resolve_addr for its real implementation. */ @@ -1211,7 +1211,7 @@ minimal_symbol_reader::record_full (gdb::string_view = name, msymbol->set_value_address (address); msymbol->set_section_index (section); =20 - MSYMBOL_TYPE (msymbol) =3D ms_type; + msymbol->set_type (ms_type); =20 /* If we already read minimal symbols for this objfile, then don't ever allocate a new one. */ @@ -1303,10 +1303,9 @@ compact_minimal_symbols (struct minimal_symbol *msym= bol, int mcount, && strcmp (copyfrom->linkage_name (), (copyfrom + 1)->linkage_name ()) =3D=3D 0) { - if (MSYMBOL_TYPE ((copyfrom + 1)) =3D=3D mst_unknown) - { - MSYMBOL_TYPE ((copyfrom + 1)) =3D MSYMBOL_TYPE (copyfrom); - } + if ((copyfrom + 1)->type () =3D=3D mst_unknown) + (copyfrom + 1)->set_type (copyfrom->type ()); + copyfrom++; } else @@ -1530,7 +1529,7 @@ lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc) lookup_msym_prefer::TRAMPOLINE); =20 if (msymbol.minsym !=3D NULL - && MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_solib_trampoline) + && msymbol.minsym->type () =3D=3D mst_solib_trampoline) return msymbol.minsym; return NULL; } @@ -1558,10 +1557,10 @@ find_solib_trampoline_target (struct frame_info *fr= ame, CORE_ADDR pc) { /* Also handle minimal symbols pointing to function descriptors. */ - if ((MSYMBOL_TYPE (msymbol) =3D=3D mst_text - || MSYMBOL_TYPE (msymbol) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (msymbol) =3D=3D mst_data - || MSYMBOL_TYPE (msymbol) =3D=3D mst_data_gnu_ifunc) + if ((msymbol->type () =3D=3D mst_text + || msymbol->type () =3D=3D mst_text_gnu_ifunc + || msymbol->type () =3D=3D mst_data + || msymbol->type () =3D=3D mst_data_gnu_ifunc) && strcmp (msymbol->linkage_name (), tsymbol->linkage_name ()) =3D=3D 0) { diff --git a/gdb/parse.c b/gdb/parse.c index 2389dbf0b0f..73669923890 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -103,7 +103,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol, { bound_minimal_symbol bound_msym =3D {msymbol, objfile}; struct obj_section *section =3D msymbol->obj_section (objfile); - enum minimal_symbol_type type =3D MSYMBOL_TYPE (msymbol); + enum minimal_symbol_type type =3D msymbol->type (); =20 bool is_tls =3D (section !=3D NULL && section->the_bfd_section->flags & SEC_THREAD_LOCAL); @@ -124,7 +124,7 @@ find_minsym_type_and_address (minimal_symbol *msymbol, /* This means we resolved a function descriptor, and we now have an address for a code/text symbol instead of a data symbol. */ - if (MSYMBOL_TYPE (msymbol) =3D=3D mst_data_gnu_ifunc) + if (msymbol->type () =3D=3D mst_data_gnu_ifunc) type =3D mst_text_gnu_ifunc; else type =3D mst_text; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index e870b35cf38..19add04d3b3 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -655,9 +655,9 @@ build_address_symbolic (struct gdbarch *gdbarch, if (msymbol.minsym !=3D NULL && MSYMBOL_HAS_SIZE (msymbol.minsym) && MSYMBOL_SIZE (msymbol.minsym) =3D=3D 0 - && MSYMBOL_TYPE (msymbol.minsym) !=3D mst_text - && MSYMBOL_TYPE (msymbol.minsym) !=3D mst_text_gnu_ifunc - && MSYMBOL_TYPE (msymbol.minsym) !=3D mst_file_text) + && msymbol.minsym->type () !=3D mst_text + && msymbol.minsym->type () !=3D mst_text_gnu_ifunc + && msymbol.minsym->type () !=3D mst_file_text) msymbol.minsym =3D NULL; =20 if (msymbol.minsym !=3D NULL) @@ -681,10 +681,10 @@ build_address_symbolic (struct gdbarch *gdbarch, first instruction of a Thumb function as ; the second instruction will be , even though the pointer is . This matches the ISA behavior. */ - if (MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_text - || MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_file_text - || MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_solib_trampoline) + if (msymbol.minsym->type () =3D=3D mst_text + || msymbol.minsym->type () =3D=3D mst_text_gnu_ifunc + || msymbol.minsym->type () =3D=3D mst_file_text + || msymbol.minsym->type () =3D=3D mst_solib_trampoline) addr =3D gdbarch_addr_bits_remove (gdbarch, addr); =20 symbol =3D 0; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 3f173da71d5..4fe2110a47f 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -4538,7 +4538,7 @@ scan_file_globals (struct objfile *objfile) QUIT; =20 /* Skip static symbols. */ - switch (MSYMBOL_TYPE (msymbol)) + switch (msymbol->type ()) { case mst_file_text: case mst_file_data: diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 1bc5f9f0bd9..18741e4cab5 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -160,7 +160,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file = *outfile) { struct obj_section *section =3D msymbol->obj_section (objfile); =20 - switch (MSYMBOL_TYPE (msymbol)) + switch (msymbol->type ()) { case mst_unknown: ms_type =3D 'u'; diff --git a/gdb/symtab.c b/gdb/symtab.c index d15eec8b6b4..a75492603b8 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -432,11 +432,11 @@ minimal_symbol::value_address (objfile *objfile) const bool minimal_symbol::data_p () const { - return type =3D=3D mst_data - || type =3D=3D mst_bss - || type =3D=3D mst_abs - || type =3D=3D mst_file_data - || type =3D=3D mst_file_bss; + return m_type =3D=3D mst_data + || m_type =3D=3D mst_bss + || m_type =3D=3D mst_abs + || m_type =3D=3D mst_file_data + || m_type =3D=3D mst_file_bss; } =20 /* See symtab.h. */ @@ -444,12 +444,12 @@ minimal_symbol::data_p () const bool minimal_symbol::text_p () const { - return type =3D=3D mst_text - || type =3D=3D mst_text_gnu_ifunc - || type =3D=3D mst_data_gnu_ifunc - || type =3D=3D mst_slot_got_plt - || type =3D=3D mst_solib_trampoline - || type =3D=3D mst_file_text; + return m_type =3D=3D mst_text + || m_type =3D=3D mst_text_gnu_ifunc + || m_type =3D=3D mst_data_gnu_ifunc + || m_type =3D=3D mst_slot_got_plt + || m_type =3D=3D mst_solib_trampoline + || m_type =3D=3D mst_file_text; } =20 /* See whether FILENAME matches SEARCH_NAME using the rule that we @@ -3238,7 +3238,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *= section, int notcurrent) */ msymbol =3D lookup_minimal_symbol_by_pc (pc); if (msymbol.minsym !=3D NULL) - if (MSYMBOL_TYPE (msymbol.minsym) =3D=3D mst_solib_trampoline) + if (msymbol.minsym->type () =3D=3D mst_solib_trampoline) { struct bound_minimal_symbol mfunsym =3D lookup_minimal_symbol_text (msymbol.minsym->linkage_name (), @@ -4751,7 +4751,7 @@ bool global_symbol_searcher::is_suitable_msymbol (const enum search_domain kind, const minimal_symbol *msymbol) { - switch (MSYMBOL_TYPE (msymbol)) + switch (msymbol->type ()) { case mst_data: case mst_bss: @@ -5767,7 +5767,7 @@ symbol_is_function_or_method (symbol *sym) bool symbol_is_function_or_method (minimal_symbol *msymbol) { - switch (MSYMBOL_TYPE (msymbol)) + switch (msymbol->type ()) { case mst_text: case mst_text_gnu_ifunc: @@ -5797,11 +5797,11 @@ find_gnu_ifunc (const symbol *sym) iterate_over_minimal_symbols (objfile, lookup_name, [&] (minimal_symbol *minsym) { - if (MSYMBOL_TYPE (minsym) =3D=3D mst_text_gnu_ifunc - || MSYMBOL_TYPE (minsym) =3D=3D mst_data_gnu_ifunc) + if (minsym->type () =3D=3D mst_text_gnu_ifunc + || minsym->type () =3D=3D mst_data_gnu_ifunc) { CORE_ADDR msym_addr =3D minsym->value_address (objfile); - if (MSYMBOL_TYPE (minsym) =3D=3D mst_data_gnu_ifunc) + if (minsym->type () =3D=3D mst_data_gnu_ifunc) { struct gdbarch *gdbarch =3D objfile->arch (); msym_addr =3D gdbarch_convert_from_func_ptr_addr diff --git a/gdb/symtab.h b/gdb/symtab.h index 390ee9d0d67..3bb23d6f7ef 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -699,6 +699,20 @@ struct minimal_symbol : public general_symbol_info return m_value.address; } =20 + /* Return this minimal symbol's type. */ + + minimal_symbol_type type () const + { + return m_type; + } + + /* Set this minimal symbol's type. */ + + void set_type (minimal_symbol_type type) + { + m_type =3D type; + } + /* Size of this symbol. dbx_end_psymtab in dbxread.c uses this information to calculate the end of the partial symtab based on the address of the last symbol plus the size of the last symbol. */ @@ -710,7 +724,7 @@ struct minimal_symbol : public general_symbol_info =20 /* Classification type for this minimal symbol. */ =20 - ENUM_BITFIELD(minimal_symbol_type) type : MINSYM_TYPE_BITS; + ENUM_BITFIELD(minimal_symbol_type) m_type : MINSYM_TYPE_BITS; =20 /* Non-zero if this symbol was created by gdb. Such symbols do not appear in the output of "info var|fun". */ @@ -766,7 +780,6 @@ struct minimal_symbol : public general_symbol_info (msymbol)->has_size =3D 1; \ } while (0) #define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0) -#define MSYMBOL_TYPE(msymbol) (msymbol)->type =20 #include "minsyms.h"