From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alt-proxy28.mail.unifiedlayer.com (alt-proxy28.mail.unifiedlayer.com [74.220.216.123]) by sourceware.org (Postfix) with ESMTPS id E3CFF388460F for ; Thu, 27 Oct 2022 00:32:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E3CFF388460F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw10.mail.unifiedlayer.com (unknown [10.0.90.125]) by progateway1.mail.pro1.eigbox.com (Postfix) with ESMTP id 1DB891003FA83 for ; Thu, 27 Oct 2022 00:32:31 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id nqowo7fyDT2g2nqowoXn5D; Thu, 27 Oct 2022 00:32:31 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=Pds6Ogtd c=1 sm=1 tr=0 ts=6359d19f a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=Qawa6l4ZSaYA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=YqvH6VQ2Qyk6V1BWolIA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9IKSEOJPAZEF5qV0n0m2OqCnQCaaUCSo+zkjDYtu4hY=; b=H2twkGofg47EAFRABKTO3djiOm 6gzJ5VULXQNJDDwJwf16dTSeXh0gX9cjani/6CLMhq7tqNyzjH8s1MWUXCmidyuxGY5+SILWriST9 y+7hjcQUquiFprBHvxPwjtiUW; Received: from 97-122-76-186.hlrn.qwest.net ([97.122.76.186]:42686 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1onqov-000KS4-Md; Wed, 26 Oct 2022 18:32:29 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Convert compunit_language to a method Date: Wed, 26 Oct 2022 18:32:21 -0600 Message-Id: <20221027003221.1496383-1-tom@tromey.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.76.186 X-Source-L: No X-Exim-ID: 1onqov-000KS4-Md X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-76-186.hlrn.qwest.net (localhost.localdomain) [97.122.76.186]:42686 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3028.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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; -/* 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