From patchwork Fri Dec 25 01:13:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 10116 X-Patchwork-Delegate: vapier@gentoo.org Received: (qmail 109713 invoked by alias); 25 Dec 2015 01:13:22 -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 109699 invoked by uid 89); 25 Dec 2015 01:13:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:attribu, no_argument, sk:ATTRIBU, 1426 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 25 Dec 2015 01:13:20 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 3C4F834067D for ; Fri, 25 Dec 2015 01:13:18 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: h8300: move h8300-specific options out of common code [committed] Date: Thu, 24 Dec 2015 20:13:16 -0500 Message-Id: <1451005996-6366-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Register the options in sim_open like other arches to avoid having to hack up the common modules. --- sim/common/ChangeLog | 7 +++++++ sim/common/sim-options.c | 29 -------------------------- sim/h8300/ChangeLog | 8 +++++++ sim/h8300/compile.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ sim/h8300/tconfig.h | 5 ----- 5 files changed, 69 insertions(+), 34 deletions(-) delete mode 100644 sim/h8300/tconfig.h diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index b740a17..cb1a9a6 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,12 @@ 2015-12-24 Mike Frysinger + * sim-options.c (OPTION_H8300H, OPTION_H8300S, OPTION_H8300SX): + Move to h8300/compile.c. + [SIM_H8300] (standard_options): Likewise. + (standard_option_handler): Likewise. + +2015-12-24 Mike Frysinger + * sim-module.c [WITH_WATCHPOINTS] (modules): Always call sim_watchpoint_install. diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 5e04573..69655b0 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -104,11 +104,6 @@ typedef enum { OPTION_DEBUG, OPTION_HELP, OPTION_VERSION, -#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ - OPTION_H8300H, - OPTION_H8300S, - OPTION_H8300SX, -#endif OPTION_LOAD_LMA, OPTION_LOAD_VMA, OPTION_SYSROOT @@ -147,18 +142,6 @@ static const OPTION standard_options[] = '\0', "FILE NAME", "Specify debugging output file", standard_option_handler }, -#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */ - { {"h8300h", no_argument, NULL, OPTION_H8300H}, - 'h', NULL, "Indicate the CPU is H8/300H", - standard_option_handler }, - { {"h8300s", no_argument, NULL, OPTION_H8300S}, - 'S', NULL, "Indicate the CPU is H8S", - standard_option_handler }, - { {"h8300sx", no_argument, NULL, OPTION_H8300SX}, - 'x', NULL, "Indicate the CPU is H8SX", - standard_option_handler }, -#endif - { {"do-command", required_argument, NULL, OPTION_DO_COMMAND}, '\0', "COMMAND", ""/*undocumented*/, standard_option_handler }, @@ -355,18 +338,6 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, } break; -#ifdef SIM_H8300 /* FIXME: Can be moved to h8300 dir. */ - case OPTION_H8300H: - set_h8300h (bfd_mach_h8300h); - break; - case OPTION_H8300S: - set_h8300h (bfd_mach_h8300s); - break; - case OPTION_H8300SX: - set_h8300h (bfd_mach_h8300sx); - break; -#endif - case OPTION_DO_COMMAND: sim_do_command (sd, arg); break; diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index f54d697..d566a65 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,5 +1,13 @@ 2015-12-24 Mike Frysinger + * compile.c (H8300_OPTIONS): New enum from common/sim-options.c. + (h8300_option_handler): New func from common/sim-options.c. + (h8300_options): New options from common/sim-options.c. + (sim_open): Call sim_add_option_table. + * tconfig.h: Delete file. + +2015-12-24 Mike Frysinger + * tconfig.h (SIM_HAVE_SIMCACHE): Delete. 2015-11-21 Mike Frysinger diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 15d4f53..bc91725 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4813,6 +4813,54 @@ set_h8300h (unsigned long machine) h8300_normal_mode = 1; } +/* H8300-specific options. + TODO: These really should be merged into the common model modules. */ +typedef enum { + OPTION_H8300H, + OPTION_H8300S, + OPTION_H8300SX +} H8300_OPTIONS; + +static SIM_RC +h8300_option_handler (SIM_DESC sd, sim_cpu *cpu ATTRIBUTE_UNUSED, int opt, + char *arg, int is_command ATTRIBUTE_UNUSED) +{ + switch ((H8300_OPTIONS) opt) + { + case OPTION_H8300H: + set_h8300h (bfd_mach_h8300h); + break; + case OPTION_H8300S: + set_h8300h (bfd_mach_h8300s); + break; + case OPTION_H8300SX: + set_h8300h (bfd_mach_h8300sx); + break; + + default: + /* We'll actually never get here; the caller handles the error + case. */ + sim_io_eprintf (sd, "Unknown option `%s'\n", arg); + return SIM_RC_FAIL; + } + + return SIM_RC_OK; +} + +static const OPTION h8300_options[] = +{ + { {"h8300h", no_argument, NULL, OPTION_H8300H}, + 'h', NULL, "Indicate the CPU is H8/300H", + h8300_option_handler }, + { {"h8300s", no_argument, NULL, OPTION_H8300S}, + 'S', NULL, "Indicate the CPU is H8S", + h8300_option_handler }, + { {"h8300sx", no_argument, NULL, OPTION_H8300SX}, + 'x', NULL, "Indicate the CPU is H8SX", + h8300_option_handler }, + { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL, NULL } +}; + static sim_cia h8300_pc_get (sim_cpu *cpu) { @@ -4872,6 +4920,12 @@ sim_open (SIM_OPEN_KIND kind, return 0; } + if (sim_add_option_table (sd, NULL, h8300_options) != SIM_RC_OK) + { + free_state (sd); + return 0; + } + /* getopt will print the error message so we just have to exit if this fails. FIXME: Hmmm... in the case of gdb we need getopt to call print_filtered. */ diff --git a/sim/h8300/tconfig.h b/sim/h8300/tconfig.h deleted file mode 100644 index 3da84b7..0000000 --- a/sim/h8300/tconfig.h +++ /dev/null @@ -1,5 +0,0 @@ -/* h8300 target configuration file. */ - -/* FIXME: This is a quick hack for run.c so it can support the `-h' option. - It will eventually be replaced by a more general facility. */ -#define SIM_H8300