This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Move have_line_numbers to buildsym_compunit
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 16 Jul 2018 15:16:27 -0000
- Subject: [binutils-gdb] Move have_line_numbers to buildsym_compunit
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=530fedbcbf61b6d74c76a8ba720fe29d98896831
commit 530fedbcbf61b6d74c76a8ba720fe29d98896831
Author: Tom Tromey <tom@tromey.com>
Date: Sun May 20 10:48:41 2018 -0600
Move have_line_numbers to buildsym_compunit
This moves the global have_line_numbers into buildsym_compunit.
gdb/ChangeLog
2018-07-16 Tom Tromey <tom@tromey.com>
* buildsym.c (struct buildsym_compunit) <m_have_line_numbers>: New
member.
(have_line_numbers): Remove.
(record_line, prepare_for_building, end_symtab_get_static_block)
(augment_type_symtab): Update.
Diff:
---
gdb/ChangeLog | 8 ++++++++
gdb/buildsym.c | 16 +++++++---------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2c60338..4f4ad6a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2018-07-16 Tom Tromey <tom@tromey.com>
+ * buildsym.c (struct buildsym_compunit) <m_have_line_numbers>: New
+ member.
+ (have_line_numbers): Remove.
+ (record_line, prepare_for_building, end_symtab_get_static_block)
+ (augment_type_symtab): Update.
+
+2018-07-16 Tom Tromey <tom@tromey.com>
+
* buildsym.c (~buildsym_compunit): Free the macro table.
(struct buildsym_compunit) <get_macro_table, release_macros>: New
methods.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 571c971..8fd1009 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -191,6 +191,10 @@ struct buildsym_compunit
/* The macro table for the compilation unit whose symbols we're
currently reading. */
struct macro_table *m_pending_macros = nullptr;
+
+ /* True if symtab has line number info. This prevents an otherwise
+ empty symtab from being tossed. */
+ bool m_have_line_numbers = false;
};
/* The work-in-progress of the compunit we are building.
@@ -202,11 +206,6 @@ static struct buildsym_compunit *buildsym_compunit;
static struct pending *free_pendings;
-/* Non-zero if symtab has line number info. This prevents an
- otherwise empty symtab from being tossed. */
-
-static int have_line_numbers;
-
/* The mutable address map for the compilation unit whose symbols
we're currently reading. The symtabs' shared blockvector will
point to a fixed copy of this. */
@@ -929,7 +928,7 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc)
xmalloc (sizeof (struct linetable)
+ subfile->line_vector_length * sizeof (struct linetable_entry));
subfile->line_vector->nitems = 0;
- have_line_numbers = 1;
+ buildsym_compunit->m_have_line_numbers = true;
}
if (subfile->line_vector->nitems + 1 >= subfile->line_vector_length)
@@ -1025,7 +1024,6 @@ prepare_for_building (CORE_ADDR start_addr)
local_symbols = NULL;
local_using_directives = NULL;
within_function = 0;
- have_line_numbers = 0;
context_stack_depth = 0;
@@ -1282,7 +1280,7 @@ end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
&& pending_blocks == NULL
&& file_symbols == NULL
&& global_symbols == NULL
- && have_line_numbers == 0
+ && !buildsym_compunit->m_have_line_numbers
&& buildsym_compunit->m_pending_macros == NULL
&& global_using_directives == NULL)
{
@@ -1588,7 +1586,7 @@ augment_type_symtab (void)
complaint (_("Blocks in a type symtab"));
if (buildsym_compunit->m_pending_macros != NULL)
complaint (_("Macro in a type symtab"));
- if (have_line_numbers)
+ if (buildsym_compunit->m_have_line_numbers)
complaint (_("Line numbers recorded in a type symtab"));
if (file_symbols != NULL)