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
This commit is contained in:
parent
5b6074611e
commit
1ee2e9f930
@ -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. */
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 ();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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"));
|
||||
|
@ -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. */
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
13
gdb/symtab.h
13
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) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user