From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124605 invoked by alias); 29 Aug 2018 16:41:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 124520 invoked by uid 89); 29 Aug 2018 16:41:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 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.2 spammy=10522 X-HELO: mail-wm0-f44.google.com Received: from mail-wm0-f44.google.com (HELO mail-wm0-f44.google.com) (74.125.82.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Aug 2018 16:41:15 +0000 Received: by mail-wm0-f44.google.com with SMTP id i134-v6so4947410wmf.0 for ; Wed, 29 Aug 2018 09:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=TsCZTDMr6WKB0h7wIwSVDCt0ESrqpA3Qu3FyFYn/VYI=; b=JdQ7G4pbpbeJLIUEh4ikUrgh1Wmgpgt/InVhACg3mF53Qh7SeWS+vG3HXpTnBK2ytS 2t2t+OsAwdQ1xlb6nOn8/l+aHPRKHVbMwQHTLwMc2Rf3DZtOuHmFd3lmowlGEo4e8Z1I XXqWF4wXJs/EIDiFSZ9UMTOeJjFrEaJ1kUeGc0iCTPlyCcOQGjradba9doEWekS1P5M6 T4aq/5nM8RCei/As0pv+RUdMMNxX+HUCTGb65IxhO4vFjTtUe/MhrFMY/VwWiGZ6r6yE Vj+ovToLieybmCYjbSDVN9ihwpgGFa3Teb3LnTROFmOXR7QWaNXiZND9d54ChNf+UBmB XigQ== Return-Path: Received: from localhost (host86-134-20-86.range86-134.btcentralplus.com. [86.134.20.86]) by smtp.gmail.com with ESMTPSA id 60-v6sm4737111wre.82.2018.08.29.09.41.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Aug 2018 09:41:12 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: jimw@sifive.com, palmer@sifive.com, Andrew Burgess Subject: [PATCH 3/4] gdb: Extend the trad-frame API Date: Wed, 29 Aug 2018 16:41:00 -0000 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00754.txt.bz2 Adds two new functions to the trad-frame API and update the internals of trad-frame to use the new functions. These functions will be used in later commits. gdb/ChangeLog: * trad-frame.h (trad_frame_set_realreg): Declare. (trad_frame_set_addr): Declare. * trad-frame.c (trad_frame_set_realreg): Define new function. (trad_frame_set_addr): Define new function. (trad_frame_set_reg_realreg): Use new function. (trad_frame_set_reg_addr): Use new function. --- gdb/ChangeLog | 9 +++++++++ gdb/trad-frame.c | 21 ++++++++++++++++++--- gdb/trad-frame.h | 8 ++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c index a6e24158279..e3e48f2b7b0 100644 --- a/gdb/trad-frame.c +++ b/gdb/trad-frame.c @@ -105,6 +105,22 @@ trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[], this_saved_regs[regnum].addr = val; } +void +trad_frame_set_realreg (struct trad_frame_saved_reg this_saved_regs[], + int regnum, int realreg) +{ + this_saved_regs[regnum].realreg = realreg; + this_saved_regs[regnum].addr = -1; +} + +void +trad_frame_set_addr (struct trad_frame_saved_reg this_saved_regs[], + int regnum, CORE_ADDR addr) +{ + this_saved_regs[regnum].realreg = regnum; + this_saved_regs[regnum].addr = addr; +} + void trad_frame_set_reg_value (struct trad_frame_cache *this_trad_cache, int regnum, LONGEST val) @@ -118,15 +134,14 @@ void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache, int regnum, int realreg) { - this_trad_cache->prev_regs[regnum].realreg = realreg; - this_trad_cache->prev_regs[regnum].addr = -1; + trad_frame_set_realreg (this_trad_cache->prev_regs, regnum, realreg); } void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr) { - this_trad_cache->prev_regs[regnum].addr = addr; + trad_frame_set_addr (this_trad_cache->prev_regs, regnum, addr); } void diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h index f7ec43cc80c..a11a2c29c9c 100644 --- a/gdb/trad-frame.h +++ b/gdb/trad-frame.h @@ -88,6 +88,14 @@ struct trad_frame_saved_reg void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[], int regnum, LONGEST val); +/* Encode REGNUM is in REALREG in the trad-frame. */ +void trad_frame_set_realreg (struct trad_frame_saved_reg this_saved_regs[], + int regnum, int realreg); + +/* Encode REGNUM is at address ADDR in the trad-frame. */ +void trad_frame_set_addr (struct trad_frame_saved_reg this_trad_cache[], + int regnum, CORE_ADDR addr); + /* Mark REGNUM as unknown. */ void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[], int regnum); -- 2.14.4