From 43ab4ba582a495a5c0f13c1e0869b6a241442611 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Wed, 23 Nov 1994 03:27:40 +0000 Subject: Maintenance commands to report time and space usage. * main.c (display_time, display_space): New globals. (main): Add argument --statistics to enable reporting, display time and space after startup is done. * maint.c (maintenance_time_display, maintenance_space_display): New commands. * top.c (command_loop): Display time and space after command execution. * top.c (pre_init_ui_hook): New global. (gdb_init): If pre_init_ui_hook set, call before all other init. --- gdb/maint.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) (limited to 'gdb/maint.c') diff --git a/gdb/maint.c b/gdb/maint.c index ce39506..479ee6b 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -1,5 +1,5 @@ /* Support for GDB maintenance commands. - Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. This file is part of GDB. @@ -33,14 +33,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "expression.h" /* For language.h */ #include "language.h" -static void -maintenance_command PARAMS ((char *, int)); +static void maintenance_command PARAMS ((char *, int)); -static void -maintenance_dump_me PARAMS ((char *, int)); +static void maintenance_dump_me PARAMS ((char *, int)); -static void -maintenance_demangle PARAMS ((char *, int)); +static void maintenance_demangle PARAMS ((char *, int)); + +static void maintenance_time_display PARAMS ((char *, int)); + +static void maintenance_space_display PARAMS ((char *, int)); /* @@ -113,6 +114,32 @@ maintenance_demangle (args, from_tty) } } +static void +maintenance_time_display (args, from_tty) + char *args; + int from_tty; +{ + extern int display_time; + + if (args == NULL || *args == '\0') + printf_unfiltered ("\"maintenance time\" takes a numeric argument.\n"); + else + display_time = strtol (args, NULL, 10); +} + +static void +maintenance_space_display (args, from_tty) + char *args; + int from_tty; +{ + extern int display_space; + + if (args == NULL || *args == '\0') + printf_unfiltered ("\"maintenance space\" takes a numeric argument.\n"); + else + display_space = strtol (args, NULL, 10); +} + /* The "maintenance info" command is defined as a prefix, with allow_unknown 0. Therefore, its own definition is called only for "maintenance info" with no args. */ @@ -260,6 +287,18 @@ Call internal GDB demangler routine to demangle a C++ link name\n\ and prints the result.", &maintenancelist); + add_cmd ("time", class_maintenance, maintenance_time_display, + "Set the display of time usage.\n\ +If nonzero, will cause the execution time for each command to be\n\ +displayed, following the command's output.", + &maintenancelist); + + add_cmd ("space", class_maintenance, maintenance_space_display, + "Set the display of space usage.\n\ +If nonzero, will cause the execution space for each command to be\n\ +displayed, following the command's output.", + &maintenancelist); + add_cmd ("type", class_maintenance, maintenance_print_type, "Print a type chain for a given symbol.\n\ For each node in a type chain, print the raw data for each member of\n\ -- cgit v1.1