* main.c (captured_main): Set it.
* top.c (lim_at_start): Define.
(command_loop): Use it instead of &environ.
* event-top.c (command_handler): Likewise.
* gdb.base/selftest.exp: Next over lim_at_start initialization.
+2003-06-02 Richard Henderson <rth@redhat.com>
+
+ * top.h (lim_at_start): Declare.
+ * main.c (captured_main): Set it.
+ * top.c (lim_at_start): Define.
+ (command_loop): Use it instead of &environ.
+ * event-top.c (command_handler): Likewise.
+
2003-06-01 Jason Thorpe <thorpej@wasabisystems.com>
* mipsnbsd-tdep.c: Update copyright years.
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
}
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",
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",
/* This needs to happen before the first use of malloc. */
init_malloc (NULL);
+#ifdef HAVE_SBRK
+ lim_at_start = (char *) sbrk (0);
+#endif
+
#if defined (ALIGN_STACK_ON_STARTUP)
i = (int) &count & 0x3;
if (i != 0)
+2003-06-02 Richard Henderson <rth@redhat.com>
+
+ * gdb.base/selftest.exp: Next over lim_at_start initialization.
+
2003-06-02 Richard Henderson <rth@redhat.com>
* gdb.base/dump.exp [alpha*-*-*]: Add -taso linker switch.
set description "next over init_malloc and everything it calls"
set command "next"
}
+ -re ".*lim_at_start.*$gdb_prompt $" {
+ set description "next over lim_at_start initialization"
+ set command "next"
+ }
-re ".*count . 0x3.*$gdb_prompt $" {
set description "next over conditional stack alignment code 1"
set command "next"
/* 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
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
}
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",
extern char *source_pre_error;
extern int history_expansion_p;
extern int server_command;
+extern char *lim_at_start;
#endif