From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id E1970384842D for ; Mon, 21 Jun 2021 03:55:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E1970384842D Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 47BB733BDF0 for ; Mon, 21 Jun 2021 03:55:08 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 2/3] sim: callback: generate signal map Date: Sun, 20 Jun 2021 23:55:04 -0400 Message-Id: <20210621035505.29431-2-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.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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 We've been generating the syscall/errno/open maps, but not the signal map, even though we've been including them in the source constants. --- sim/common/callback.c | 3 +++ sim/common/gentmap.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sim/common/callback.c b/sim/common/callback.c index 071e7b149b97..aca0112853c4 100644 --- a/sim/common/callback.c +++ b/sim/common/callback.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +57,7 @@ void sim_cb_eprintf (host_callback *, const char *, ...); extern CB_TARGET_DEFS_MAP cb_init_syscall_map[]; extern CB_TARGET_DEFS_MAP cb_init_errno_map[]; +extern CB_TARGET_DEFS_MAP cb_init_signal_map[]; extern CB_TARGET_DEFS_MAP cb_init_open_map[]; /* Make sure the FD provided is ok. If not, return non-zero @@ -676,6 +678,7 @@ os_init (host_callback *p) p->syscall_map = cb_init_syscall_map; p->errno_map = cb_init_errno_map; + p->signal_map = cb_init_signal_map; p->open_map = cb_init_open_map; return 1; diff --git a/sim/common/gentmap.c b/sim/common/gentmap.c index 254ec3f11195..f1f1bc2c03f3 100644 --- a/sim/common/gentmap.c +++ b/sim/common/gentmap.c @@ -23,6 +23,13 @@ static struct tdefs errno_tdefs[] = { { 0, 0 } }; +static struct tdefs signal_tdefs[] = { +#define signal_defs +#include "nltvals.def" +#undef signal_defs + { 0, 0 } +}; + static struct tdefs open_tdefs[] = { #define open_defs #include "nltvals.def" @@ -51,6 +58,11 @@ gen_targ_vals_h (void) printf ("#define TARGET_%s %d\n", t->symbol, t->value); printf ("\n"); + printf ("/* signal values */\n"); + for (t = &signal_tdefs[0]; t->symbol; ++t) + printf ("#define TARGET_%s %d\n", t->symbol, t->value); + printf ("\n"); + printf ("/* open flag values */\n"); for (t = &open_tdefs[0]; t->symbol; ++t) printf ("#define TARGET_%s 0x%x\n", t->symbol, t->value); @@ -70,6 +82,7 @@ gen_targ_map_c (void) printf ("#include \"defs.h\"\n"); printf ("#include \n"); printf ("#include \n"); + printf ("#include \n"); printf ("#include \"ansidecl.h\"\n"); printf ("#include \"sim/callback.h\"\n"); printf ("#include \"targ-vals.h\"\n"); @@ -98,6 +111,17 @@ gen_targ_map_c (void) printf (" { 0, 0, 0 }\n"); printf ("};\n\n"); + printf ("/* signals mapping table */\n"); + printf ("CB_TARGET_DEFS_MAP cb_init_signal_map[] = {\n"); + for (t = &signal_tdefs[0]; t->symbol; ++t) + { + printf ("#ifdef %s\n", t->symbol); + printf (" { \"%s\", %s, TARGET_%s },\n", t->symbol, t->symbol, t->symbol); + printf ("#endif\n"); + } + printf (" { 0, -1, -1 }\n"); + printf ("};\n\n"); + printf ("/* open flags mapping table */\n"); printf ("CB_TARGET_DEFS_MAP cb_init_open_map[] = {\n"); for (t = &open_tdefs[0]; t->symbol; ++t) -- 2.31.1