From patchwork Sun Feb 9 16:41:50 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: 37789 Received: (qmail 25888 invoked by alias); 9 Feb 2020 16:42:16 -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 25863 invoked by uid 89); 9 Feb 2020 16:42:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.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=H*RU:sk:sonic31, 1626, H*r:sk:sonic31, HX-HELO:sk:sonic31 X-HELO: sonic311-31.consmr.mail.ir2.yahoo.com Received: from sonic311-31.consmr.mail.ir2.yahoo.com (HELO sonic311-31.consmr.mail.ir2.yahoo.com) (77.238.176.163) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 09 Feb 2020 16:42:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1581266527; bh=vvRFUPoEAjtrQrGYhlh6NIq1+N8KF7e/f1d6173jVxY=; h=From:To:Subject:Date:References:From:Subject; b=oTez3Ei6MsM3KyEHCiol75k/dCUsejPdSFpDnwnQTdWt/FhdG8GKufAR+vvqXEe5wvH7XmCPZ5eFCMu/5UK1l4u5mdbq2AwRq1wnxz5LjcuIgk4w4lDAE8gE37YIckRlSU/ybhFCoskv/EGq7v/bh/6aVaVM/uVfLhHmcgJpSyio0wEsiHUDOrFhzBsbHdVqjREXgE5yCAk6bwlflgolslbYSSleDJFQgxS++SHuXfnwoGSxfel9oFTirJ46fbhUL45WB3om2lAcByGM+aaNpqfIS+jfaKFBisf7ejuqEVNSILTkTIIqAiSzhoOiFaFvjrhY7VBs0DH/MrZVJb4txA== Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ir2.yahoo.com with HTTP; Sun, 9 Feb 2020 16:42:07 +0000 Received: by smtp431.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 2d937e714975d0cdc1d6fee629cfab94; Sun, 09 Feb 2020 16:42:05 +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] Cache the Thread Local Base pointer type in the gdbarch Date: Sun, 9 Feb 2020 17:41:50 +0100 Message-Id: <20200209164150.43386-1-ssbssa@yahoo.de> MIME-Version: 1.0 References: <20200209164150.43386-1-ssbssa.ref@yahoo.de> Content-Length: 2032 X-IsSubscribed: yes gdb/ChangeLog: 2020-02-09 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..2efd2f0d7e 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; }; /* 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 != NULL) + 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; }