From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id EA8993848007 for ; Mon, 21 Jun 2021 03:55:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA8993848007 Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 419CF33BE23 for ; Mon, 21 Jun 2021 03:55:09 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 3/3] sim: callback: add missing cb_target_to_host_signal Date: Sun, 20 Jun 2021 23:55:05 -0400 Message-Id: <20210621035505.29431-3-vapier@gentoo.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210621035505.29431-1-vapier@gentoo.org> References: <20210621035505.29431-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2021 03:55:11 -0000 There's been a prototype for this forever, but the implementation was missing. Probably because there weren't any callers, but we'll start using it to implement the kill function. --- sim/common/callback.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sim/common/callback.c b/sim/common/callback.c index aca0112853c4..06d76b477245 100644 --- a/sim/common/callback.c +++ b/sim/common/callback.c @@ -927,6 +927,19 @@ cb_target_to_host_open (host_callback *cb, int target_val) return host_val; } +/* Translate the target's version of a signal number to the host's. + This isn't actually the host's version, rather a canonical form. + ??? Perhaps this should be renamed to ..._canon_signal. */ + +int +cb_target_to_host_signal (host_callback *cb, int target_val) +{ + const CB_TARGET_DEFS_MAP *m = + cb_target_map_entry (cb->signal_map, target_val); + + return m ? m->host_val : -1; +} + /* Utility for e.g. cb_host_to_target_stat to store values in the target's stat struct. -- 2.31.1