From patchwork Tue Feb 25 12:10:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 38300 Received: (qmail 89295 invoked by alias); 25 Feb 2020 12:10:36 -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 89287 invoked by uid 89); 25 Feb 2020 12:10:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 required=5.0 tests=AWL, BAYES_00, 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=HX-Received:1353 X-HELO: mail-qk1-f196.google.com Received: from mail-qk1-f196.google.com (HELO mail-qk1-f196.google.com) (209.85.222.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Feb 2020 12:10:34 +0000 Received: by mail-qk1-f196.google.com with SMTP id m9so6452569qke.4 for ; Tue, 25 Feb 2020 04:10:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=iwNq+AcTJL6ZAdWRQ3/+5OFQW/aC+sIxa9+4k7Q+eKo=; b=X0SzQ9Nh3meUi63E98aNlb7z9xS5B1JIGO0f6AVC52TDnFdUieg/2Zes7hEdieYUM3 qAPSicETS7TOLI8PaMDsWE7P21iL7cR/Q9oIYoW/+6HmPJy0RnwnoCSVLKmsT3y4wvE/ h75+IFBvBgNOF3cTJewgU/ZxESfgx8Yd8TLs9TTPBm3fIfg/NACruHNz9b3SFltoNDF9 kMWhcyifKvNQv4iQByJ0iKRpQesVHI6zyFwqWRb6K+PF5QcJe7sWzgKEOZVrshOFHUrF LOY5BMQwMsqLaMAAT8No4S7vk98HTgWbaGYbfTzDGulCBjGnS/fWqZTecI2otXovGHDB 8Cjw== Return-Path: Received: from localhost.localdomain ([191.34.86.53]) by smtp.gmail.com with ESMTPSA id x14sm3932127qkf.99.2020.02.25.04.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 04:10:31 -0800 (PST) From: Luis Machado To: gdb-patches@sourceware.org Subject: [PATCH] Update ELF auxv entry types and update GDB to use them. Date: Tue, 25 Feb 2020 09:10:21 -0300 Message-Id: <20200225121021.30075-1-luis.machado@linaro.org> X-IsSubscribed: yes I noticed GDB didn't know a particular AT tag (51) when doing some debugging. Turns out we're missing a few entries compared to glibc's headers. This patch adds them to the ELF include file and GDB. include/ChangeLog: * elf/common.h (AT_L1I_CACHESIZE, AT_L1I_CACHEGEOMETRY, AT_L1D_CACHESIZE, AT_L1D_CACHEGEOMETRY, AT_L2_CACHESIZE, AT_L2_CACHEGEOMETRY, AT_L3_CACHESIZE, AT_L3_CACHEGEOMETRY, AT_MINSIGSTKSZ): New defines, imported from glibc. gdb/ChangeLog: * auxv.c (default_print_auxv_entry): Add new auxv entries. --- gdb/auxv.c | 12 ++++++++++++ include/elf/common.h | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/gdb/auxv.c b/gdb/auxv.c index eb1233527e..e7432e1852 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -497,6 +497,18 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, AUXV_FORMAT_HEX); TAG (AT_SUN_CAP_HW2, _("Machine-dependent CPU capability hints 2"), AUXV_FORMAT_HEX); + TAG (AT_L1I_CACHESIZE , _("L1 Instruction cache size"), AUXV_FORMAT_HEX); + TAG (AT_L1I_CACHEGEOMETRY , _("L1 Instruction cache geometry"), + AUXV_FORMAT_HEX); + TAG (AT_L1D_CACHESIZE , _("L1 Data cache size"), AUXV_FORMAT_HEX); + TAG (AT_L1D_CACHEGEOMETRY , _("L1 Data cache geometry"), + AUXV_FORMAT_HEX); + TAG (AT_L2_CACHESIZE , _("L2 cache size"), AUXV_FORMAT_HEX); + TAG (AT_L2_CACHEGEOMETRY , _("L2 cache geometry"), AUXV_FORMAT_HEX); + TAG (AT_L3_CACHESIZE , _("L3 cache size"), AUXV_FORMAT_HEX); + TAG (AT_L3_CACHEGEOMETRY , _("L3 cache geometry"), AUXV_FORMAT_HEX); + TAG (AT_MINSIGSTKSZ , _("Minimum stack size for signal delivery"), + AUXV_FORMAT_HEX); } fprint_auxv_entry (file, name, description, format, type, val); diff --git a/include/elf/common.h b/include/elf/common.h index 53b72445ca..18c898cf6b 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -1222,6 +1222,21 @@ #define AT_L2_CACHESHAPE 36 #define AT_L3_CACHESHAPE 37 +/* Shapes of the caches, with more room to describe them. + *GEOMETRY are comprised of cache line size in bytes in the bottom 16 bits + and the cache associativity in the next 16 bits. */ +#define AT_L1I_CACHESIZE 40 +#define AT_L1I_CACHEGEOMETRY 41 +#define AT_L1D_CACHESIZE 42 +#define AT_L1D_CACHEGEOMETRY 43 +#define AT_L2_CACHESIZE 44 +#define AT_L2_CACHEGEOMETRY 45 +#define AT_L3_CACHESIZE 46 +#define AT_L3_CACHEGEOMETRY 47 + +#define AT_MINSIGSTKSZ 51 /* Stack needed for signal delivery + (AArch64). */ + #define AT_FREEBSD_EXECPATH 15 /* Path to the executable. */ #define AT_FREEBSD_CANARY 16 /* Canary for SSP. */ #define AT_FREEBSD_CANARYLEN 17 /* Length of the canary. */