From patchwork Tue Feb 11 16:31:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 37971 Received: (qmail 60497 invoked by alias); 11 Feb 2020 16:32:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 60461 invoked by uid 89); 11 Feb 2020 16:32:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: sonic307-54.consmr.mail.ir2.yahoo.com Received: from sonic307-54.consmr.mail.ir2.yahoo.com (HELO sonic307-54.consmr.mail.ir2.yahoo.com) (87.248.110.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 11 Feb 2020 16:31:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1581438716; bh=5dLm2Ajto7Jc0+iFeNJFLXnhG5gZ+ZroAN6I11AC4xg=; h=From:To:Subject:Date:References:From:Subject; b=MR7uvHk+OtmWJwO4mDR6tPl7Sb+JHoDMmlK6YdoqSwshDaSeJmA3ax38BzUPtL016zJUp5SU4br2kgTDltpPvXXt8zdOWHNKI+4sQWKAM8GNDKk5n90NcNeMfUEjqg4wlTVr7Lnzmzvr+96loNwIlZS5NZXcpfrwOYC8fXr7DgLjBvTJrS9A8RCCGZ6D5J53kfoTkR3Wf3K1oWdjFookH+xgSE3GsJs9y0eFR1O9pUJRL4K+K/S/r0hAW7dXe0AtpUyRZ0qcWCXIjsQcR0P9Oy6dlOS1V9knR1Sb+5ueKcdwnQGWfTFIle43YtzdfVyW12nIaRl5mWZMqOwC5epF4g== Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ir2.yahoo.com with HTTP; Tue, 11 Feb 2020 16:31:56 +0000 Received: by smtp422.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 13767c31e94f35a07b5ef44767acc4ae; Tue, 11 Feb 2020 16:31:53 +0000 (UTC) X-Patchwork-Original-From: "Hannes Domani via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Hannes Domani To: gdb-patches@sourceware.org Subject: [PATCH v2] Cache the Thread Local Base pointer type in the gdbarch Date: Tue, 11 Feb 2020 17:31:38 +0100 Message-Id: <20200211163138.2810-1-ssbssa@yahoo.de> MIME-Version: 1.0 References: <20200211163138.2810-1-ssbssa.ref@yahoo.de> Content-Length: 2074 X-IsSubscribed: yes gdb/ChangeLog: 2020-02-11 Hannes Domani * windows-tdep.c (struct windows_gdbarch_data): Add tib_ptr_type. (windows_get_tlb_type): Use windows_gdbarch_data->tib_ptr_type. --- gdb/windows-tdep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 6eef476fb5..f3c6785218 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -162,6 +162,7 @@ static struct gdbarch_data *windows_gdbarch_data_handle; struct windows_gdbarch_data { struct type *siginfo_type; + struct type *tib_ptr_type; /* Type of thread information block */ }; /* Allocate windows_gdbarch_data for an arch. */ @@ -186,8 +187,7 @@ get_windows_gdbarch_data (struct gdbarch *gdbarch) static struct type * windows_get_tlb_type (struct gdbarch *gdbarch) { - static struct gdbarch *last_gdbarch = NULL; - static struct type *last_tlb_type = NULL; + struct windows_gdbarch_data *windows_gdbarch_data; struct type *dword_ptr_type, *dword32_type, *void_ptr_type; struct type *peb_ldr_type, *peb_ldr_ptr_type; struct type *peb_type, *peb_ptr_type, *list_type; @@ -196,10 +196,10 @@ windows_get_tlb_type (struct gdbarch *gdbarch) struct type *word_type, *wchar_type, *wchar_ptr_type; struct type *uni_str_type, *rupp_type, *rupp_ptr_type; - /* Do not rebuild type if same gdbarch as last time. */ - if (last_tlb_type && last_gdbarch == gdbarch) - return last_tlb_type; - + windows_gdbarch_data = get_windows_gdbarch_data (gdbarch); + if (windows_gdbarch_data->tib_ptr_type != nullptr) + return windows_gdbarch_data->tib_ptr_type; + dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "DWORD_PTR"); dword32_type = arch_integer_type (gdbarch, 32, @@ -369,8 +369,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch) NULL); TYPE_TARGET_TYPE (tib_ptr_type) = tib_type; - last_tlb_type = tib_ptr_type; - last_gdbarch = gdbarch; + windows_gdbarch_data->tib_ptr_type = tib_ptr_type; return tib_ptr_type; }