From patchwork Mon Jun 12 08:41:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 20922 Received: (qmail 70406 invoked by alias); 12 Jun 2017 08:42:10 -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 70194 invoked by uid 89); 12 Jun 2017 08:42:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:209.85.223.193, H*RU:209.85.223.193, H*r:sk:static. X-HELO: mail-io0-f193.google.com Received: from mail-io0-f193.google.com (HELO mail-io0-f193.google.com) (209.85.223.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Jun 2017 08:42:07 +0000 Received: by mail-io0-f193.google.com with SMTP id j200so5275028ioe.0 for ; Mon, 12 Jun 2017 01:42:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=EXK5P4C1E1iv5e4svdoH9/jNtMBgW5CdhlIAchd/5/A=; b=XfRlInnTAb9ppwsL/ubNpm8uFsKQ8lwkHy67H3Za8OS33K0uxnw+lpZza3BVTM9BYY qDO6gsMVbCGdqfOtoWGo8H+ncSSAGLyShpE3DGBDl8SkiRgvINDI/lmlh/XBBZL2uq32 0YlzQ1G1o8lC4zueEL663N9Fp1bi6l2XnfDf1FS4UWHqLb+sjXtRR5Twn5ZoO2TQSq0M misLIP3gSVI4eZN0MDhSiLEiZh4UTnfIf6ZxAeVp/4M/hcmr+3I6sdt/myuDKm6Qi0c3 m0K5IVAXx6SyUNJMycmS0gLXUjwn3blMCZPPMLSwN38mG8Wm4vu2GT+n60dh8/9AbAWK byGA== X-Gm-Message-State: AODbwcBjKA1uSFXUAsEmP0Yeh+d+qXiWv0kWkSCGeDogpS4mXn8UgoJe fBRVT52AvHNPVboQ X-Received: by 10.107.161.206 with SMTP id k197mr56143060ioe.141.1497256930469; Mon, 12 Jun 2017 01:42:10 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id u4sm5280289itu.1.2017.06.12.01.42.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jun 2017 01:42:10 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 10/25] Adjust code generated by regformats/regdat.sh Date: Mon, 12 Jun 2017 09:41:41 +0100 Message-Id: <1497256916-4958-11-git-send-email-yao.qi@linaro.org> In-Reply-To: <1497256916-4958-1-git-send-email-yao.qi@linaro.org> References: <1497256916-4958-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes regformats/regdat.sh generate some *-generated.c files when GDBserver is built. Each .c file has some static variables, which are only used within function init_registers_XXX, like this, static struct reg regs_i386_linux[] = { { "eax", 0, 32 }, { "ecx", 32, 32 }, ... }; static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 }; static const char *xmltarget_i386_linux = "i386-linux.xml"; void init_registers_i386_linux (void) { ... } This patch moves these static variables' definitions to function init_registers_XXX, so the generated files look like this, void init_registers_i386_linux (void) { static struct target_desc tdesc_i386_linux_s; struct target_desc *result = &tdesc_i386_linux_s; static struct reg regs_i386_linux[] = { ... }; static const char *expedite_regs_i386_linux[] = { "ebp", "esp", "eip", 0 }; static const char *xmltarget_i386_linux = "i386-linux.xml"; ... } gdb: 2017-06-06 Yao Qi * regformats/regdat.sh: Adjust code order. --- gdb/regformats/regdat.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh index 651f703..2c764cd 100755 --- a/gdb/regformats/regdat.sh +++ b/gdb/regformats/regdat.sh @@ -123,6 +123,15 @@ while do_read do if test "${type}" = "name"; then name="${entry}" + + echo "const struct target_desc *tdesc_${name};" + echo "" + echo "void" + echo "init_registers_${name} (void)" + echo "{" + echo " static struct target_desc tdesc_${name}_s;" + echo " struct target_desc *result = &tdesc_${name}_s;" + echo "static struct reg regs_${name}[] = {" continue elif test "${type}" = "xmltarget"; then @@ -169,14 +178,6 @@ fi echo cat <reg_defs = regs_${name}; result->num_registers = sizeof (regs_${name}) / sizeof (regs_${name}[0]);