* [PATCH] Convert compunit_language to a method
@ 2022-10-27 0:32 Tom Tromey
2022-10-27 1:35 ` Simon Marchi
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2022-10-27 0:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes compunit_language to be a method on compunit_symtab.
---
gdb/dwarf2/read.c | 4 ++--
gdb/frame.c | 8 ++++----
gdb/infrun.c | 4 ++--
gdb/mdebugread.c | 2 +-
gdb/symtab.c | 8 ++++----
gdb/symtab.h | 7 +++----
6 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 071d0c48e99..7a5745be71f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9736,7 +9736,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
m_builder.reset (new struct buildsym_compunit
(cust->objfile (), "",
cust->dirname (),
- compunit_language (cust),
+ cust->language (),
0, cust));
list_in_scope = get_builder ()->get_file_symbols ();
}
@@ -9790,7 +9790,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
m_builder.reset (new struct buildsym_compunit
(cust->objfile (), "",
cust->dirname (),
- compunit_language (cust),
+ cust->language (),
0, cust));
list_in_scope = get_builder ()->get_file_symbols ();
diff --git a/gdb/frame.c b/gdb/frame.c
index 3ddc0d06996..bbdd6a0671c 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1895,10 +1895,10 @@ select_frame (frame_info_ptr fi)
struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
if (cust != NULL
- && compunit_language (cust) != current_language->la_language
- && compunit_language (cust) != language_unknown
+ && cust->language () != current_language->la_language
+ && cust->language () != language_unknown
&& language_mode == language_mode_auto)
- set_language (compunit_language (cust));
+ set_language (cust->language ());
}
}
}
@@ -2964,7 +2964,7 @@ get_frame_language (frame_info_ptr frame)
struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
if (cust != NULL)
- return compunit_language (cust);
+ return cust->language ();
}
return language_unknown;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index fcc4d80fc73..38dae3afde5 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7788,7 +7788,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
compunit_symtab *cust
= find_pc_compunit_symtab (ecs->event_thread->stop_pc ());
- if (cust != NULL && compunit_language (cust) != language_asm)
+ if (cust != NULL && cust->language () != language_asm)
ecs->stop_func_start
= gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
@@ -7867,7 +7867,7 @@ handle_step_into_function_backward (struct gdbarch *gdbarch,
fill_in_stop_func (gdbarch, ecs);
cust = find_pc_compunit_symtab (ecs->event_thread->stop_pc ());
- if (cust != NULL && compunit_language (cust) != language_asm)
+ if (cust != NULL && cust->language () != language_asm)
ecs->stop_func_start
= gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index c547e2320e1..050589197a7 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4623,7 +4623,7 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
symtab = allocate_symtab (cust, name);
symtab->set_linetable (new_linetable (maxlines));
- lang = compunit_language (cust);
+ lang = cust->language ();
/* All symtabs must have at least two blocks. */
bv = new_bvect (2);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a004cc021fe..ff8d24a5614 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -405,12 +405,12 @@ compunit_symtab::primary_filetab () const
/* See symtab.h. */
enum language
-compunit_language (const struct compunit_symtab *cust)
+compunit_symtab::language () const
{
- struct symtab *symtab = cust->primary_filetab ();
+ struct symtab *symtab = primary_filetab ();
-/* The language of the compunit symtab is the language of its primary
- source file. */
+ /* The language of the compunit symtab is the language of its
+ primary source file. */
return symtab->language ();
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 90f5b45738b..7d2f0d2b049 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1840,6 +1840,9 @@ struct compunit_symtab
/* Find call_site info for PC. */
call_site *find_call_site (CORE_ADDR pc) const;
+ /* Return the language of this compunit_symtab. */
+ enum language language () const;
+
/* Unordered chain of all compunit symtabs of this objfile. */
struct compunit_symtab *next;
@@ -1920,10 +1923,6 @@ struct compunit_symtab
using compunit_symtab_range = next_range<compunit_symtab>;
-/* Return the language of CUST. */
-
-extern enum language compunit_language (const struct compunit_symtab *cust);
-
/* Return true if this symtab is the "main" symtab of its compunit_symtab. */
static inline bool
--
2.34.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Convert compunit_language to a method
2022-10-27 0:32 [PATCH] Convert compunit_language to a method Tom Tromey
@ 2022-10-27 1:35 ` Simon Marchi
0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2022-10-27 1:35 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
On 10/26/22 20:32, Tom Tromey wrote:
> This changes compunit_language to be a method on compunit_symtab.
> ---
> gdb/dwarf2/read.c | 4 ++--
> gdb/frame.c | 8 ++++----
> gdb/infrun.c | 4 ++--
> gdb/mdebugread.c | 2 +-
> gdb/symtab.c | 8 ++++----
> gdb/symtab.h | 7 +++----
> 6 files changed, 16 insertions(+), 17 deletions(-)
Seems obvious enough, thanks for doing this.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-27 1:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 0:32 [PATCH] Convert compunit_language to a method Tom Tromey
2022-10-27 1:35 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).