diff options
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -171,6 +171,11 @@ int target_executing = 0; /* Level of control structure. */ static int control_level; +/* Sbrk location on entry to main. Used for statistics only. */ +#ifdef HAVE_SBRK +char *lim_at_start; +#endif + /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */ #ifndef STOP_SIGNAL @@ -485,7 +490,7 @@ struct catch_errors_args void *func_args; }; -int +static int do_catch_errors (struct ui_out *uiout, void *data) { struct catch_errors_args *args = data; @@ -782,10 +787,8 @@ command_loop (void) if (display_space) { #ifdef HAVE_SBRK - extern char **environ; char *lim = (char *) sbrk (0); - - space_at_cmd_start = (long) (lim - (char *) &environ); + space_at_cmd_start = lim - lim_at_start; #endif } @@ -805,9 +808,8 @@ command_loop (void) if (display_space) { #ifdef HAVE_SBRK - extern char **environ; char *lim = (char *) sbrk (0); - long space_now = lim - (char *) &environ; + long space_now = lim - lim_at_start; long space_diff = space_now - space_at_cmd_start; printf_unfiltered ("Space used: %ld (%c%ld for this command)\n", @@ -1059,7 +1061,7 @@ static int operate_saved_history = -1; /* This is put on the appropriate hook and helps operate-and-get-next do its work. */ -void +static void gdb_rl_operate_and_get_next_completion (void) { int delta = where_history () - operate_saved_history; |