From 91a81f69725a53644fb008a7066269020b8d2aa1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 14 Jun 2011 16:49:41 +0000 Subject: [PATCH] * symtab.h (current_objfile): Don't declare. * objfiles.h (current_objfile): Don't declare. * objfiles.c (current_objfile): Remove. * mdebugread.c (current_objfile): New file-scope global. * dbxread.c (current_objfile): New file-scope global. * coffread.c (current_objfile): New file-scope global. --- gdb/ChangeLog | 9 +++++++++ gdb/coffread.c | 4 ++++ gdb/dbxread.c | 6 +++++- gdb/mdebugread.c | 5 +++++ gdb/objfiles.c | 1 - gdb/objfiles.h | 15 --------------- gdb/symtab.h | 4 ---- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25f39a1eca6..c53b7e29f72 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2011-06-14 Tom Tromey + + * symtab.h (current_objfile): Don't declare. + * objfiles.h (current_objfile): Don't declare. + * objfiles.c (current_objfile): Remove. + * mdebugread.c (current_objfile): New file-scope global. + * dbxread.c (current_objfile): New file-scope global. + * coffread.c (current_objfile): New file-scope global. + 2011-06-13 Pedro Alves * top.h (line): Rename to ... diff --git a/gdb/coffread.c b/gdb/coffread.c index 16fd58f1b2b..dff40105fe1 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -49,6 +49,10 @@ extern void _initialize_coffread (void); +/* The objfile we are currently reading. */ + +static struct objfile *current_objfile; + struct coff_symfile_info { file_ptr min_lineno_offset; /* Where in file lowest line#s are. */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 51ddd9da877..5b57507c42f 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1,6 +1,6 @@ /* Read dbx symbol tables and convert to internal format, for GDB. Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010. + 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009, 2010, 2011. Free Software Foundation, Inc. This file is part of GDB. @@ -105,6 +105,10 @@ struct symloc #define FILE_STRING_OFFSET(p) (SYMLOC(p)->file_string_offset) +/* The objfile we are currently reading. */ + +static struct objfile *current_objfile; + /* Remember what we deduced to be the source language of this psymtab. */ static enum language psymtab_language = language_unknown; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ae77ebd0838..465ee2d724e 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -78,6 +78,11 @@ extern void _initialize_mdebugread (void); case the symbol's ELF section could not be represented in ECOFF. */ #define ECOFF_IN_ELF(bfd) (bfd_get_flavour (bfd) == bfd_target_elf_flavour \ && bfd_get_section_by_name (bfd, ".mdebug") != NULL) + +/* The objfile we are currently reading. */ + +static struct objfile *current_objfile; + /* We put a pointer to this structure in the read_symtab_private field diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 151588b132c..34d64225c45 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -64,7 +64,6 @@ static void objfile_free_data (struct objfile *objfile); /* Externally visible variables that are owned by this module. See declarations in objfile.h for more info. */ -struct objfile *current_objfile; /* For symbol file being read in */ struct objfile *rt_common_objfile; /* For runtime common symbols */ struct objfile_pspace_info diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 6a9a2fdfe27..bb28dc1d658 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -439,21 +439,6 @@ struct objfile extern struct objfile *rt_common_objfile; -/* When we need to allocate a new type, we need to know which objfile_obstack - to allocate the type on, since there is one for each objfile. The places - where types are allocated are deeply buried in function call hierarchies - which know nothing about objfiles, so rather than trying to pass a - particular objfile down to them, we just do an end run around them and - set current_objfile to be whatever objfile we expect to be using at the - time types are being allocated. For instance, when we start reading - symbols for a particular objfile, we set current_objfile to point to that - objfile, and when we are done, we set it back to NULL, to ensure that we - never put a type someplace other than where we are expecting to put it. - FIXME: Maybe we should review the entire type handling system and - see if there is a better way to avoid this problem. */ - -extern struct objfile *current_objfile; - /* Declarations for functions defined in objfiles.c */ extern struct objfile *allocate_objfile (bfd *, int); diff --git a/gdb/symtab.h b/gdb/symtab.h index 12f52a21dc4..c4319a731e2 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -847,10 +847,6 @@ struct symtab /* External variables and functions for the objects described above. */ -/* See the comment in symfile.c about how current_objfile is used. */ - -extern struct objfile *current_objfile; - /* True if we are nested inside psymtab_to_symtab. */ extern int currently_reading_symtab; -- 2.30.2