diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2021-11-20 08:47:30 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2022-02-06 16:03:44 -0500 |
commit | 1ee2e9f9304d05f2962bbc4b83096b850fe4e433 (patch) | |
tree | 5df392b5191f79e7193b0d53cfb03c77233abeb7 /gdb | |
parent | 5b6074611edfdd1590e8da1ca443950b47942bbb (diff) | |
download | gdb-1ee2e9f9304d05f2962bbc4b83096b850fe4e433.zip gdb-1ee2e9f9304d05f2962bbc4b83096b850fe4e433.tar.gz gdb-1ee2e9f9304d05f2962bbc4b83096b850fe4e433.tar.bz2 |
gdb: remove SYMTAB_LANGUAGE macro, add getter/setter
Add a getter and a setter for a symtab's language. Remove the
corresponding macro and adjust all callers.
Change-Id: I9f4d840b11c19f80f39bac1bce020fdd1739e11f
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/buildsym.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 8 | ||||
-rw-r--r-- | gdb/linespec.c | 2 | ||||
-rw-r--r-- | gdb/mdebugread.c | 5 | ||||
-rw-r--r-- | gdb/source-cache.c | 2 | ||||
-rw-r--r-- | gdb/source.c | 3 | ||||
-rw-r--r-- | gdb/stack.c | 2 | ||||
-rw-r--r-- | gdb/symfile.c | 2 | ||||
-rw-r--r-- | gdb/symmisc.c | 8 | ||||
-rw-r--r-- | gdb/symtab.c | 8 | ||||
-rw-r--r-- | gdb/symtab.h | 13 |
11 files changed, 33 insertions, 22 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 2a99a96..27206f9 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -991,7 +991,7 @@ buildsym_compunit::end_symtab_with_blockvector (struct block *static_block, we created the subfile, and we may have altered our opinion of what language it is from things we found in the symbols. */ - symtab->language = subfile->language; + symtab->set_language (subfile->language); } /* Make sure the filetab of main_subfile is the primary filetab of the CU. */ diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index fb138de..3bbd253 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9477,8 +9477,8 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language) compilation is from a C file generated by language preprocessors, do not set the language if it was already deduced by start_subfile. */ if (!(cu->per_cu->lang == language_c - && cust->primary_filetab ()->language != language_unknown)) - cust->primary_filetab ()->language = cu->per_cu->lang; + && cust->primary_filetab ()->language () != language_unknown)) + cust->primary_filetab ()->set_language (cu->per_cu->lang); /* GCC-4.0 has started to support -fvar-tracking. GCC-3.x still can produce DW_AT_location with location lists but it can be possibly @@ -9562,8 +9562,8 @@ process_full_type_unit (dwarf2_cu *cu, do not set the language if it was already deduced by start_subfile. */ if (!(cu->per_cu->lang == language_c - && cust->primary_filetab ()->language != language_c)) - cust->primary_filetab ()->language = cu->per_cu->lang; + && cust->primary_filetab ()->language () != language_c)) + cust->primary_filetab ()->set_language (cu->per_cu->lang); } } else diff --git a/gdb/linespec.c b/gdb/linespec.c index d502515..acbcc09 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -4424,7 +4424,7 @@ add_matching_symbols_to_info (const char *name, which we don't have debug info. Check for a minimal symbol in this case. */ if (prev_len == info->result.symbols->size () - && elt->language == language_asm) + && elt->language () == language_asm) search_minsyms_for_name (info, lookup_name, pspace, elt); } } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 3dc6a8b..192fafa 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4084,10 +4084,11 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) /* The proper language was already determined when building the psymtab, use it. */ - cust->primary_filetab ()->language = PST_PRIVATE (pst)->pst_language; + cust->primary_filetab ()->set_language + (PST_PRIVATE (pst)->pst_language); } - psymtab_language = cust->primary_filetab ()->language; + psymtab_language = cust->primary_filetab ()->language (); lines = cust->primary_filetab ()->linetable (); diff --git a/gdb/source-cache.c b/gdb/source-cache.c index 373607f..d2447ca 100644 --- a/gdb/source-cache.c +++ b/gdb/source-cache.c @@ -231,7 +231,7 @@ source_cache::ensure (struct symtab *s) { #ifdef HAVE_SOURCE_HIGHLIGHT bool already_styled = false; - const char *lang_name = get_language_name (SYMTAB_LANGUAGE (s)); + const char *lang_name = get_language_name (s->language ()); if (lang_name != nullptr && use_gnu_source_highlight) { /* The global source highlight object, or null if one was diff --git a/gdb/source.c b/gdb/source.c index ee89626..e99fff8 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -722,7 +722,8 @@ info_source_command (const char *ignore, int from_tty) printf_filtered (_("Contains %d line%s.\n"), (int) offsets->size (), offsets->size () == 1 ? "" : "s"); - printf_filtered (_("Source language is %s.\n"), language_str (s->language)); + printf_filtered (_("Source language is %s.\n"), + language_str (s->language ())); printf_filtered (_("Producer is %s.\n"), (cust->producer ()) != nullptr ? cust->producer () : _("unknown")); diff --git a/gdb/stack.c b/gdb/stack.c index c7269e2..8d5983e 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1638,7 +1638,7 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) if (s) printf_filtered (" source language %s.\n", - language_str (s->language)); + language_str (s->language ())); { /* Address of the argument list for this frame, or 0. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index 46c4201..1a64fc7 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2780,7 +2780,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename) symtab->filename = objfile->intern (filename); symtab->fullname = NULL; - symtab->language = deduce_language_from_filename (filename); + symtab->set_language (deduce_language_from_filename (filename)); /* This can be very verbose with lots of headers. Only print at higher debug levels. */ diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 2fdd0f6..24b2915 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -256,7 +256,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) objfile_name (objfile), host_address_to_string (objfile)); fprintf_filtered (outfile, "Language: %s\n", - language_str (symtab->language)); + language_str (symtab->language ())); /* First print the line table. */ l = symtab->linetable (); @@ -370,11 +370,11 @@ dump_symtab (struct symtab *symtab, struct ui_file *outfile) because certain routines used during dump_symtab() use the current language to print an image of the symbol. We'll restore it later. But use only real languages, not placeholders. */ - if (symtab->language != language_unknown - && symtab->language != language_auto) + if (symtab->language () != language_unknown + && symtab->language () != language_auto) { scoped_restore_current_language save_lang; - set_language (symtab->language); + set_language (symtab->language ()); dump_symtab_1 (symtab, outfile); } else diff --git a/gdb/symtab.c b/gdb/symtab.c index f796ee4..6535937 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -407,7 +407,7 @@ compunit_language (const struct compunit_symtab *cust) /* The language of the compunit symtab is the language of its primary source file. */ - return SYMTAB_LANGUAGE (symtab); + return symtab->language (); } /* See symtab.h. */ @@ -3710,7 +3710,7 @@ find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section, if (funfirstline && sal.symtab != NULL && (sal.symtab->compunit ()->locations_valid () - || SYMTAB_LANGUAGE (sal.symtab) == language_asm)) + || sal.symtab->language () == language_asm)) { struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch (); @@ -3840,7 +3840,7 @@ skip_prologue_sal (struct symtab_and_line *sal) is likely to be the wrong choice. */ if (sal->symtab != nullptr && sal->explicit_line - && SYMTAB_LANGUAGE (sal->symtab) == language_asm) + && sal->symtab->language () == language_asm) return; scoped_restore_current_pspace_and_thread restore_pspace_thread; @@ -4023,7 +4023,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr) The GNU assembler emits separate line notes for each instruction in a multi-instruction macro, but compilers generally will not do this. */ - if (prologue_sal.symtab->language != language_asm) + if (prologue_sal.symtab->language () != language_asm) { struct linetable *linetable = prologue_sal.symtab->linetable (); int idx = 0; diff --git a/gdb/symtab.h b/gdb/symtab.h index 8881f4e..2830969 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1393,6 +1393,16 @@ struct symtab m_linetable = linetable; } + enum language language () const + { + return m_language; + } + + void set_language (enum language language) + { + m_language = language; + } + /* Unordered chain of all filetabs in the compunit, with the exception that the "main" source file is the first entry in the list. */ @@ -1413,7 +1423,7 @@ struct symtab /* Language of this source file. */ - enum language language; + enum language m_language; /* Full name of file as found by searching the source path. NULL if not yet known. */ @@ -1425,7 +1435,6 @@ struct symtab using symtab_range = next_range<symtab>; -#define SYMTAB_LANGUAGE(symtab) ((symtab)->language) #define SYMTAB_BLOCKVECTOR(symtab) \ (symtab->compunit ()->blockvector ()) #define SYMTAB_OBJFILE(symtab) \ |