From 83ebf43970b824784eab9423529ebcdd15bc3019 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Fri, 16 Dec 1994 01:19:40 +0000 Subject: [PATCH] * top.c (command_loop): For space usage display, show both absolute size and the change from before command execution. --- gdb/ChangeLog | 27 ++++++++++++++++----------- gdb/top.c | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 70c689b0de2..31cc4c555be 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,16 +1,21 @@ +Thu Dec 15 16:55:35 1994 Stan Shebs + + * top.c (command_loop): For space usage display, show both + absolute size and the change from before command execution. + Thu Dec 15 16:40:10 1994 Stu Grossman (grossman@cygnus.com) - * defs.h, gdbtk.c (gdbtk_fputs), main.c (gdb_fputs), top.c: Add stream arg - to fputs_unfiltered_hook. Differentiate stdout from stderr when - passing text into tcl land. - * defs.h, top.c, utils.c (error): Add error_hook. - * gdbtk.c: Improve mechanism for capturing output values. - * (full_filename): Remove. - * (gdb_cmd call_wrapper gdbtk_init): Protect all calls from tcl - land with call_wrapper. This prevents longjmps (usually via - error()) from jumping out of tcl/tk and leaving things in an - indeterminate state. - * gdbtk.tcl: New view option to disable line numbers. Put catch + * defs.h, gdbtk.c (gdbtk_fputs), main.c (gdb_fputs), top.c: Add + stream arg to fputs_unfiltered_hook. Differentiate stdout from + stderr when passing text into tcl land. + * defs.h, top.c, utils.c (error): Add error_hook. + * gdbtk.c: Improve mechanism for capturing output values. + (full_filename): Remove. + (gdb_cmd call_wrapper gdbtk_init): Protect all calls from tcl land + with call_wrapper. This prevents longjmps (usually via error()) + from jumping out of tcl/tk and leaving things in an indeterminate + state. + * gdbtk.tcl: New view option to disable line numbers. Put catch around most uses of gdb_cmd. Add update button to reg config window. Stop doing immediate updates when selecting registers. Change register view values into checkbuttons. diff --git a/gdb/top.c b/gdb/top.c index 8109f516063..7ac7b1b1b66 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -932,6 +932,7 @@ command_loop () char *command; int stdin_is_tty = ISATTY (stdin); long time_at_cmd_start; + long space_at_cmd_start; extern int display_time; extern int display_space; @@ -951,6 +952,14 @@ command_loop () time_at_cmd_start = get_run_time (); + if (display_space) + { + extern char **environ; + char *lim = (char *) sbrk (0); + + space_at_cmd_start = (long) (lim - (char *) &environ); + } + execute_command (command, instream == stdin); /* Do any commands attached to breakpoint we stopped at. */ bpstat_do_actions (&stop_bpstat); @@ -968,9 +977,13 @@ command_loop () { extern char **environ; char *lim = (char *) sbrk (0); + long space_now = lim - (char *) &environ; + long space_diff = space_now - space_at_cmd_start; - printf_unfiltered ("Post-command data size: %ld\n", - (long) (lim - (char *) &environ)); + printf_unfiltered ("Space used: %ld (%c%ld for this command)\n", + space_now, + (space_diff >= 0 ? '+' : '-'), + space_diff); } } } -- 2.30.2