From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5A1ED3858C74; Fri, 28 Oct 2022 20:33:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A1ED3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666989225; bh=ms9ua8b/Ht1W1HA1lnsNSZUlOiw/kcFgtFfbEqruFMk=; h=From:To:Subject:Date:From; b=se8UfLzuQ1MrC6AB6qnL+mmfjWcnCJSHB+gHQ/FFSyz9FnDzQwIzEsXbC3LCSN07K W8h71ZlCnyrjustzUBGKjrSZvLKZiVLHaKR9lmmvhedtJUHqqi/KBsRtKkSHHD2BZB NDOycmxKCSeeeKG0PIPmC/ek43vCgP2kv9xdGjWo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Convert compunit_language to a method X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 6b84c098e533f87d7973fd6fe8a39ee97255ebdb X-Git-Newrev: 425d5e76e04d684789452b35363be7302aa0c90b Message-Id: <20221028203345.5A1ED3858C74@sourceware.org> Date: Fri, 28 Oct 2022 20:33:45 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D425d5e76e04d= 684789452b35363be7302aa0c90b commit 425d5e76e04d684789452b35363be7302aa0c90b Author: Tom Tromey Date: Wed Oct 26 18:26:38 2022 -0600 Convert compunit_language to a method =20 This changes compunit_language to be a method on compunit_symtab. =20 Approved-By: Simon Marchi Diff: --- 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 *d= ie) m_builder.reset (new struct buildsym_compunit (cust->objfile (), "", cust->dirname (), - compunit_language (cust), + cust->language (), 0, cust)); list_in_scope =3D get_builder ()->get_file_symbols (); } @@ -9790,7 +9790,7 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *d= ie) m_builder.reset (new struct buildsym_compunit (cust->objfile (), "", cust->dirname (), - compunit_language (cust), + cust->language (), 0, cust)); list_in_scope =3D get_builder ()->get_file_symbols (); =20 diff --git a/gdb/frame.c b/gdb/frame.c index 858fe64e832..5cf9186e43d 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1895,10 +1895,10 @@ select_frame (frame_info_ptr fi) struct compunit_symtab *cust =3D find_pc_compunit_symtab (pc); =20 if (cust !=3D NULL - && compunit_language (cust) !=3D current_language->la_language - && compunit_language (cust) !=3D language_unknown + && cust->language () !=3D current_language->la_language + && cust->language () !=3D language_unknown && language_mode =3D=3D 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 =3D find_pc_compunit_symtab (pc); =20 if (cust !=3D NULL) - return compunit_language (cust); + return cust->language (); } =20 return language_unknown; diff --git a/gdb/infrun.c b/gdb/infrun.c index 8507796cc31..5ff0dc44d03 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -7788,7 +7788,7 @@ handle_step_into_function (struct gdbarch *gdbarch, =20 compunit_symtab *cust =3D find_pc_compunit_symtab (ecs->event_thread->stop_pc ()); - if (cust !=3D NULL && compunit_language (cust) !=3D language_asm) + if (cust !=3D NULL && cust->language () !=3D language_asm) ecs->stop_func_start =3D gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start); =20 @@ -7867,7 +7867,7 @@ handle_step_into_function_backward (struct gdbarch *g= dbarch, fill_in_stop_func (gdbarch, ecs); =20 cust =3D find_pc_compunit_symtab (ecs->event_thread->stop_pc ()); - if (cust !=3D NULL && compunit_language (cust) !=3D language_asm) + if (cust !=3D NULL && cust->language () !=3D language_asm) ecs->stop_func_start =3D gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start); =20 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 ob= jfile *objfile) symtab =3D allocate_symtab (cust, name); =20 symtab->set_linetable (new_linetable (maxlines)); - lang =3D compunit_language (cust); + lang =3D cust->language (); =20 /* All symtabs must have at least two blocks. */ bv =3D 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. */ =20 enum language -compunit_language (const struct compunit_symtab *cust) +compunit_symtab::language () const { - struct symtab *symtab =3D cust->primary_filetab (); + struct symtab *symtab =3D primary_filetab (); =20 -/* 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 (); } =20 diff --git a/gdb/symtab.h b/gdb/symtab.h index dac3266290c..4f3e84bbbe9 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; =20 + /* Return the language of this compunit_symtab. */ + enum language language () const; + /* Unordered chain of all compunit symtabs of this objfile. */ struct compunit_symtab *next; =20 @@ -1920,10 +1923,6 @@ struct compunit_symtab =20 using compunit_symtab_range =3D next_range; =20 -/* 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.= */ =20 static inline bool