mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 19:23:33 +08:00
b15cc25cbe
This makes these flag types be "enum flag" types. The benefit is making use of C++'s stronger typing -- mixing the flags types by mistake errors at compile time. This caught one old bug in symbol_file_add_main_1 already, fixed by this patch as well: @@ -1318,7 +1326,7 @@ symbol_file_add_main_1 (const char *args, int from_tty, int flags) what is frameless. */ reinit_frame_cache (); - if ((flags & SYMFILE_NO_READ) == 0) + if ((add_flags & SYMFILE_NO_READ) == 0) set_initial_language (); } Above, "flags" are objfile flags, not symfile_add_flags. So that was actually checking for "flag & OBJF_PSYMTABS_READ", which has the same value as SYMFILE_NO_READ... I moved the flags definitions to separate files to break circular dependencies. Built with --enable-targets=all and tested on x86-64 Fedora 23. gdb/ChangeLog: 2016-10-26 Pedro Alves <palves@redhat.com> * coffread.c (coff_symfile_read): Use symfile_add_flags. * dbxread.c (dbx_symfile_read): Ditto. * elfread.c (elf_symfile_read): Ditto. * inferior.h: Include symfile-add-flags.h. (struct inferior) <symfile_flags>: Now symfile_add_flags. * machoread.c (macho_add_oso_symfile, macho_symfile_read_all_oso) (macho_symfile_read, mipscoff_symfile_read): Use symfile_add_flags. * objfile-flags.h: New file. * objfiles.c (allocate_objfile): Use objfile_flags. * objfiles.h: Include objfile-flags.h. (struct objfile) <flags>: Now an objfile_flags. (OBJF_REORDERED, OBJF_SHARED, OBJF_READNOW, OBJF_USERLOADED) (OBJF_PSYMTABS_READ, OBJF_MAINLINE, OBJF_NOT_FILENAME): Delete. Converted to an enum-flags in objfile-flags.h. (allocate_objfile): Use objfile_flags. * python/py-objfile.c (objfpy_add_separate_debug_file): Remove unnecessary local. * solib.c (solib_read_symbols, solib_add) (reload_shared_libraries_1): Use symfile_add_flags. * solib.h: Include "symfile-add-flags.h". (solib_read_symbols): Use symfile_add_flags. * symfile-add-flags.h: New file. * symfile-debug.c (debug_sym_read): Use symfile_add_flags. * symfile-mem.c (symbol_file_add_from_memory): Use symfile_add_flags. * symfile.c (read_symbols, syms_from_objfile_1) (syms_from_objfile, finish_new_objfile): Use symfile_add_flags. (symbol_file_add_with_addrs): Use symfile_add_flags and objfile_flags. (symbol_file_add_separate): Use symfile_add_flags. (symbol_file_add_from_bfd, symbol_file_add): Use symfile_add_flags and objfile_flags. (symbol_file_add_main_1): : Use objfile_flags. Fix add_flags vs flags confusion. (symbol_file_command): Use objfile_flags. (add_symbol_file_command): Use symfile_add_flags and objfile_flags. (clear_symtab_users): Use symfile_add_flags. * symfile.h: Include "symfile-add-flags.h" and "objfile-flags.h". (struct sym_fns) <sym_read>: Use symfile_add_flags. (clear_symtab_users): Use symfile_add_flags. (enum symfile_add_flags): Delete, moved to symfile-add-flags.h and converted to enum-flags. (symbol_file_add, symbol_file_add_from_bfd) (symbol_file_add_separate): Use symfile_add_flags. * xcoffread.c (xcoff_initial_scan): Use symfile_add_flags.
72 lines
2.8 KiB
C
72 lines
2.8 KiB
C
/* Definition of objfile flags.
|
|
|
|
Copyright (C) 1992-2016 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#if !defined (OBJFILE_FLAGS_H)
|
|
#define OBJFILE_FLAGS_H
|
|
|
|
#include "common/enum-flags.h"
|
|
|
|
/* Defines for the objfile flags field. Defined in a separate file to
|
|
break circular header dependencies. */
|
|
|
|
enum objfile_flag
|
|
{
|
|
/* When an object file has its functions reordered (currently
|
|
Irix-5.2 shared libraries exhibit this behaviour), we will need
|
|
an expensive algorithm to locate a partial symtab or symtab via
|
|
an address. To avoid this penalty for normal object files, we
|
|
use this flag, whose setting is determined upon symbol table
|
|
read in. */
|
|
OBJF_REORDERED = 1 << 0, /* Functions are reordered */
|
|
|
|
/* Distinguish between an objfile for a shared library and a
|
|
"vanilla" objfile. This may come from a target's
|
|
implementation of the solib interface, from add-symbol-file, or
|
|
any other mechanism that loads dynamic objects. */
|
|
OBJF_SHARED = 1 << 1, /* From a shared library */
|
|
|
|
/* User requested that this objfile be read in it's entirety. */
|
|
OBJF_READNOW = 1 << 2, /* Immediate full read */
|
|
|
|
/* This objfile was created because the user explicitly caused it
|
|
(e.g., used the add-symbol-file command). This bit offers a
|
|
way for run_command to remove old objfile entries which are no
|
|
longer valid (i.e., are associated with an old inferior), but
|
|
to preserve ones that the user explicitly loaded via the
|
|
add-symbol-file command. */
|
|
OBJF_USERLOADED = 1 << 3, /* User loaded */
|
|
|
|
/* Set if we have tried to read partial symtabs for this objfile.
|
|
This is used to allow lazy reading of partial symtabs. */
|
|
OBJF_PSYMTABS_READ = 1 << 4,
|
|
|
|
/* Set if this is the main symbol file (as opposed to symbol file
|
|
for dynamically loaded code). */
|
|
OBJF_MAINLINE = 1 << 5,
|
|
|
|
/* ORIGINAL_NAME and OBFD->FILENAME correspond to text description
|
|
unrelated to filesystem names. It can be for example
|
|
"<image in memory>". */
|
|
OBJF_NOT_FILENAME = 1 << 6,
|
|
};
|
|
|
|
DEF_ENUM_FLAGS_TYPE (enum objfile_flag, objfile_flags);
|
|
|
|
#endif /* !defined (OBJFILE_FLAGS_H) */
|