From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3514 invoked by alias); 4 May 2010 15:25:48 -0000 Received: (qmail 3483 invoked by uid 22791); 4 May 2010 15:25:44 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_BJ,TW_WT X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 May 2010 15:25:33 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C119A2BAB1C for ; Tue, 4 May 2010 11:25:31 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id l0bkvmDR1Rk2 for ; Tue, 4 May 2010 11:25:31 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 597292BAABD for ; Tue, 4 May 2010 11:25:31 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2C411F58F9; Tue, 4 May 2010 08:25:22 -0700 (PDT) Date: Tue, 04 May 2010 15:25:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: Re: [vxworks 05/14] Add options to control Vxworks related settings. Message-ID: <20100504152522.GH2768@adacore.com> References: <1272210447-13895-1-git-send-email-brobecker@adacore.com> <1272210447-13895-6-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="CdrF4e02JqNVZeln" Content-Disposition: inline In-Reply-To: <1272210447-13895-6-git-send-email-brobecker@adacore.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 X-SW-Source: 2010-05/txt/msg00067.txt.bz2 --CdrF4e02JqNVZeln Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 270 Hello, > 2010-04-23 Joel Brobecker > > * remote-wtx-opt.h, remote-wtx-opt.c: New files. Attached is a new version of this file, following the removal of ATTR_FORMAT... (a very minimal change compared to the first version). -- Joel --CdrF4e02JqNVZeln Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0005-vxworks-add-options-to-control-Vxworks-related-set.patch" Content-length: 13456 2010-04-23 Joel Brobecker * remote-wtx-opt.h, remote-wtx-opt.c: New files. --- gdb/remote-wtx-opt.c | 323 ++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/remote-wtx-opt.h | 46 +++++++ 2 files changed, 369 insertions(+), 0 deletions(-) create mode 100644 gdb/remote-wtx-opt.c create mode 100644 gdb/remote-wtx-opt.h diff --git a/gdb/remote-wtx-opt.c b/gdb/remote-wtx-opt.c new file mode 100644 index 0000000..70910b6 --- /dev/null +++ b/gdb/remote-wtx-opt.c @@ -0,0 +1,323 @@ +/* Support for the WTX protocol. + + This unit provides a user interface to various settings which are + related to the WTX protocol. We also provide several debug switches + that the user can use to turn on some debugging traces. + + Copyright (C) 2007, 2010 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "defs.h" +#include "command.h" +#include "gdbcmd.h" +#include "remote-wtx-opt.h" +#include "remote-wtxapi.h" + +/* The various settings that affect the the WTX protocol will be + accessible through the "set/show wtx" command prefix. The following + cmd_list_element variables contain the list of commands accessible + under that prefix. */ + +static struct cmd_list_element *set_wtx_list = NULL; +static struct cmd_list_element *show_wtx_list = NULL; + +/* The various debug switches are accessible through the "set/show wtx + debug" command prefix. The following cmd_list_element variables + contain the list of commands accessible under that prefix. */ + +static struct cmd_list_element *set_wtx_debug_list = NULL; +static struct cmd_list_element *show_wtx_debug_list = NULL; + +/* The name we use to identify ourselves when we connect to + the target server. The default value is allocated during + this file initialization phase. */ +static char *tool_name = NULL; + +/* The module load timeout in seconds. */ +static int load_timeout = 30; + +/* The stack size in bytes used when spawning a new process. */ +static int stack_size = 0x10000; + +/* The options used when spawning a new process. */ +static int task_options = 0; + +/* The priority used when spawning a new process. */ +static int task_priority = 100; + +/* Set to non-zero to print debug traces of the events received by GDB. */ +static int debug_events_level = 0; + +/* Set to non-zero to print debug traces related to watchpoint support. */ +static int debug_watchpoints = 0; + +/* Set to non-zero to print debug traces of the operations involving + objfile manipuations. */ +static int debug_objfiles = 0; + +/* If set to non-zero, then the user wants to see more verbose error + messages when the TCL interpreter failed to evaluate a command. */ +static int debug_tcl = 0; + +/* Accessor for TOOL_NAME. */ + +char * +wtx_opt_tool_name (void) +{ + return tool_name; +} + +/* Accessor for LOAD_TIMEOUT. */ + +int +wtx_opt_load_timeout (void) +{ + return load_timeout; +} + +int +wtx_opt_stack_size (void) +{ + return stack_size; +} + +int +wtx_opt_task_options (void) +{ + return task_options; +} + +/* Init task options using the target information. */ + +void +wtx_opt_init_task_options (void) +{ + const int VX_FP_TASK = wtxapi_vx_fp_task (); + const int VX_SPE_TASK = 0x04000000; + + /* If the target has a floating-point processor, then set the + floating-point option flag. */ + if (wtxapi_target_has_fpp_get ()) + task_options |= VX_FP_TASK; + + /* If the target is e500v2, the SPE APU should be enabled to run + floating point programs. + + FIXME: guitton/2009-07-20: In VxWorks 6.6, there is no way to + discriminate between e500 and e500v2: both have the same cpu + variant "ppc85XX". As we only support e500v2, it is fine to + assume that PPC85XX actually means e500v2... For now. But + it is not in the general case. The problem is fixed in Vxworks + 6.7, so we may get rid of this kludge at some point. */ + if (wtxapi_has_target_variant ("_e500v2") + || wtxapi_has_target_variant ("_ppc85XX")) + task_options |= VX_SPE_TASK; +} + +int +wtx_opt_task_priority (void) +{ + return task_priority; +} + +/* Accessor for DEBUG_TCL */ + +int +wtx_opt_tcl_verbose_p (void) +{ + return debug_tcl; +} + +/* Print a debug message if DEBUG_OBJFILES is non-zero. + The message uses the string FORMAT and all the associated parameters, + following the printf syntax. */ + +void +wtx_opt_objfiles_debug (const char *format, ...) +{ + if (debug_objfiles) + { + va_list args; + + va_start (args, format); + printf_filtered ("DEBUG (objfiles): "); + vprintf_filtered (format, args); + printf_filtered ("\n"); + va_end (args); + } +} + +/* Print a debug message if DEBUG_EVENTS is non-zero. + The message uses the string FORMAT and all the associated parameters, + following the printf syntax. */ + +void +wtx_opt_events_debug (int level, const char *format, ...) +{ + if (debug_events_level >= level) + { + va_list args; + + va_start (args, format); + printf_filtered ("DEBUG (events): "); + vprintf_filtered (format, args); + printf_filtered ("\n"); + va_end (args); + } +} + +void wtx_opt_watchpoints_debug (const char *format, ...) +{ + if (debug_watchpoints) + { + va_list args; + + va_start (args, format); + printf_filtered ("DEBUG (watchpoints): "); + vprintf_filtered (format, args); + printf_filtered ("\n"); + va_end (args); + } +} + +/* Implement the "set wtx" command. + This is not actually a valid command, so inform the user of that fact, + and print the list of valid subcommands to help him. */ + +static void +set_wtx_command (char *args, int from_tty) +{ + printf_filtered (_("\"set wtx\" must be followed by a subcommand.\n")); + help_list (set_wtx_list, "set wtx ", -1, gdb_stdout); +} + +/* Implement the "show wtx" command: Print the value of all settings + available through that command prefix. */ + +static void +show_wtx_command (char *args, int from_tty) +{ + cmd_show_list (show_wtx_list, from_tty, ""); +} + +/* Implement the "set wtx debug" command. + This is not actually a valid command, so inform the user of that fact, + and print the list of valid subcommands to help him. */ + +static void +set_wtx_debug_command (char *args, int from_tty) +{ + printf_filtered (_("\"set wtx debug\" must be followed by a subcommand.\n")); + help_list (set_wtx_debug_list, "set wtx debug", -1, gdb_stdout); +} + +/* Implement the "show wtx" command: Print the value of all settings + available through that command prefix. */ + +static void +show_wtx_debug_command (char *args, int from_tty) +{ + cmd_show_list (show_wtx_debug_list, from_tty, ""); +} + +void +_initialize_remote_wtx_opt (void) +{ + tool_name = xstrdup ("gdb"); + + /* Various "set/show" switches. */ + add_prefix_cmd ("wtx", no_class, set_wtx_command, _("\ +Adjust various settings specific to the WTX protocol."), &set_wtx_list, + "set wtx ", 0 /* allow_unknown */, &setlist); + add_prefix_cmd ("wtx", no_class, show_wtx_command, _("\ +Print various settings specific to the WTX protocol."), &show_wtx_list, + "show wtx ", 0 /* allow_unknown */, &showlist); + + add_setshow_string_noescape_cmd ("tool-name", class_support, + &tool_name, _("\ +Set the tool name used when connecting to the target server."), _("\ +Show the tool name used when connecting to the target server."), NULL, + NULL, NULL, + &set_wtx_list, &show_wtx_list); + + add_setshow_integer_cmd ("load-timeout", class_support, + &load_timeout, _("\ +Set the timeout in seconds when loading new modules on the target."), _("\ +Show the timeout in seconds when loading new modules on the target."), _("\ +Use this setting to adjust the maximum duration that loading a module\n\ +on the target can take before a timeout aborts the operation."), + NULL, NULL, &set_wtx_list, &show_wtx_list); + + add_setshow_zinteger_cmd ("stack-size", class_support, + &stack_size, _("\ +Set the stack size in bytes for tasks spawned by the debugger."), _("\ +Show the stack size in bytes for tasks spawned by the debugger.."), _("\ +Use this setting to adjust the stack size of new tasks."), + NULL, NULL, &set_wtx_list, &show_wtx_list); + + add_setshow_zinteger_cmd ("task-options", class_support, + &task_options, _("\ +Set the options of new tasks spawned by the debugger."), _("\ +Show the options of new tasks spawned by the debugger.."), _("\ +Use this setting to change the options used when spawning new tasks."), + NULL, NULL, &set_wtx_list, &show_wtx_list); + + add_setshow_zinteger_cmd ("task-priority", class_support, + &task_priority, _("\ +Set the priority of new tasks spawned by the debugger."), _("\ +Show the priority of new tasks spawned by the debugger.."), _("\ +Use this setting to change the priority used when spawning new tasks."), + NULL, NULL, &set_wtx_list, &show_wtx_list); + + /* Various debug switches for WTX. */ + add_prefix_cmd ("debug", no_class, set_wtx_debug_command, _("\ +Adjust various settings specific to the WTX protocol."), &set_wtx_debug_list, + "set wtx debug ", 0 /* allow_unknown */, &set_wtx_list); + add_prefix_cmd ("debug", no_class, show_wtx_debug_command, _("\ +Print various settings specific to the WTX protocol."), &show_wtx_debug_list, + "show wtx debug ", 0 /* allow_unknown */, &show_wtx_list); + + add_setshow_zinteger_cmd ("events", class_maintenance, + &debug_events_level, _("\ +Print debug traces related to WTX event handling."), _("\ +Debug traces related to WTX event handling."), + NULL, NULL, NULL, &set_wtx_debug_list, + &show_wtx_debug_list); + + add_setshow_boolean_cmd ("objfiles", class_maintenance, + &debug_objfiles, _("\ +Print debug traces related to objfile handling for WTX."), _("\ +Debug traces related to objfile handling for WTX."), + NULL, NULL, NULL, &set_wtx_debug_list, + &show_wtx_debug_list); + + add_setshow_boolean_cmd ("watchpoints", class_maintenance, + &debug_watchpoints, _("\ +Print debug traces related to WTX watchpoint handling."), _("\ +Debug traces related to WTX watchpoint handling."), + NULL, NULL, NULL, &set_wtx_debug_list, + &show_wtx_debug_list); + + add_setshow_boolean_cmd ("tcl", class_maintenance, + &debug_tcl, _("\ +Set the verbosity of the error messages from the TCL interpreter."), _("\ +Show the verbosity of the error messages from the TCL interpreter."), _("\ +When set, the TCL interpreter prints more verbose error messages"), + NULL, NULL, + &set_wtx_debug_list, &show_wtx_debug_list); + +} diff --git a/gdb/remote-wtx-opt.h b/gdb/remote-wtx-opt.h new file mode 100644 index 0000000..eff67d4 --- /dev/null +++ b/gdb/remote-wtx-opt.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2007, 2010 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef REMOTE_WTX_OPT_H +#define REMOTE_WTX_OPT_H + +char *wtx_opt_tool_name (void); + +int wtx_opt_load_timeout (void); + +int wtx_opt_stack_size (void); + +int wtx_opt_task_options (void); + +void wtx_opt_init_task_options (void); + +int wtx_opt_task_priority (void); + +int wtx_opt_tcl_verbose_p (void); + +/* Support for debugging traces. */ + +void wtx_opt_objfiles_debug (const char *format, ...) + ATTRIBUTE_PRINTF (1, 2); + +void wtx_opt_events_debug (int level, const char *format, ...) + ATTRIBUTE_PRINTF (2, 3); + +void wtx_opt_watchpoints_debug (const char *format, ...) + ATTRIBUTE_PRINTF (1, 2); + +#endif -- 1.5.4.3 --CdrF4e02JqNVZeln--