aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-05-20 11:19:14 -0600
committerTom Tromey <tom@tromey.com>2018-07-16 08:55:18 -0600
commit5985ac614d7e8ae65faadf62e9302c1c096b5647 (patch)
tree53f530368220eef99dfa603945ca812c013d87d5 /gdb
parent6b84eeb21628a89b40c985b527d3d5db7806c93c (diff)
downloadgdb-5985ac614d7e8ae65faadf62e9302c1c096b5647.zip
gdb-5985ac614d7e8ae65faadf62e9302c1c096b5647.tar.gz
gdb-5985ac614d7e8ae65faadf62e9302c1c096b5647.tar.bz2
Move within_function to stabsread
The global within_function is only used by a few symbol readers. This patch moves the global out of buildsym and into stabsread, which seemed like a better fit. It also arranges for the existing readers to clear the global at the appropriate time. gdb/ChangeLog 2018-07-16 Tom Tromey <tom@tromey.com> * stabsread.h (within_function): Move from buildsym.h. * stabsread.c (start_stabs): Clear within_function. * coffread.c (coff_start_symtab): Clear within_function. * buildsym.h (within_function): Move to stabsread.h. * buildsym.c (prepare_for_building): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/buildsym.c1
-rw-r--r--gdb/buildsym.h5
-rw-r--r--gdb/coffread.c1
-rw-r--r--gdb/stabsread.c1
-rw-r--r--gdb/stabsread.h5
6 files changed, 15 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f43ab29..74573a8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2018-07-16 Tom Tromey <tom@tromey.com>
+ * stabsread.h (within_function): Move from buildsym.h.
+ * stabsread.c (start_stabs): Clear within_function.
+ * coffread.c (coff_start_symtab): Clear within_function.
+ * buildsym.h (within_function): Move to stabsread.h.
+ * buildsym.c (prepare_for_building): Update.
+
+2018-07-16 Tom Tromey <tom@tromey.com>
+
* stabsread.h (processing_gcc_compilation): Move from buildsym.h.
* dwarf2read.c (dwarf2_start_symtab): Don't set
processing_gcc_compilation.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index f2176e2..fea4364 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1031,7 +1031,6 @@ prepare_for_building ()
{
local_symbols = NULL;
local_using_directives = NULL;
- within_function = 0;
context_stack_depth = 0;
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 01d9acc..a6bed3c 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -150,11 +150,6 @@ EXTERN int context_stack_depth;
/* Non-zero if the context stack is empty. */
#define outermost_context_p() (context_stack_depth == 0)
-/* Nonzero if within a function (so symbols should be local, if
- nothing says specifically). */
-
-EXTERN int within_function;
-
/* The type of the record_line function. */
typedef void (record_line_ftype) (struct subfile *subfile, int line,
CORE_ADDR pc);
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 0b0cbac..0ba5bab 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -383,6 +383,7 @@ coff_alloc_type (int index)
static void
coff_start_symtab (struct objfile *objfile, const char *name)
{
+ within_function = 0;
start_symtab (objfile,
/* We fill in the filename later. start_symtab puts this pointer
into last_source_file and we put it in subfiles->name, which
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index e4513c6..a260fc7 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4758,6 +4758,7 @@ start_stabs (void)
n_this_object_header_files = 1;
type_vector_length = 0;
type_vector = (struct type **) 0;
+ within_function = 0;
/* FIXME: If common_block_name is not already NULL, we should complain(). */
common_block_name = NULL;
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 0da88f4..34c6738 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -53,6 +53,11 @@ EXTERN const char *(*next_symbol_text_func) (struct objfile *);
EXTERN unsigned char processing_gcc_compilation;
+/* Nonzero if within a function (so symbols should be local, if
+ nothing says specifically). */
+
+EXTERN int within_function;
+
/* Hash table of global symbols whose values are not known yet.
They are chained thru the SYMBOL_VALUE_CHAIN, since we don't
have the correct data for that slot yet.