summaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2021-11-19 21:14:36 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2022-02-06 15:48:18 -0500
commit36664835fa3f81503633024e0e834be4d84276e1 (patch)
treea00cbe27884e94579e4ddb559faf62356be3d4b1 /gdb/symtab.c
parent43b49762a17718fe13718238a8c0af9b62b682d4 (diff)
gdb: add compunit_symtab::set_primary_filetab method
Add a method to set the primary filetab of the CU. This is currently done in buildsym_compunit::end_symtab_with_blockvector. Change-Id: I16c51a6b90a4cb4c0c5f183b0f2e12bc64b6fd74
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 2028e837f0..f4f5f09f21 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -361,6 +361,34 @@ compunit_symtab::set_call_site_htab (htab_t call_site_htab)
/* See symtab.h. */
+void
+compunit_symtab::set_primary_filetab (symtab *primary_filetab)
+{
+ symtab *prev_filetab = nullptr;
+
+ /* Move PRIMARY_FILETAB to the head of the filetab list. */
+ for (symtab *filetab : compunit_filetabs (this))
+ {
+ if (filetab == primary_filetab)
+ {
+ if (prev_filetab != nullptr)
+ {
+ prev_filetab->next = primary_filetab->next;
+ primary_filetab->next = this->filetabs;
+ this->filetabs = primary_filetab;
+ }
+
+ break;
+ }
+
+ prev_filetab = filetab;
+ }
+
+ gdb_assert (primary_filetab == this->filetabs);
+}
+
+/* See symtab.h. */
+
struct symtab *
compunit_symtab::primary_filetab () const
{