diff options
author | Richard Henderson <rth@redhat.com> | 2003-06-02 16:02:59 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2003-06-02 16:02:59 +0000 |
commit | 6dd77b815f4252948dae6b0a7e467789b09c6bbb (patch) | |
tree | 2776aa7f0c3036e5f302fffd78f1dc1c6b457026 | |
parent | f6347e16334910d73f974b8b35092a979ddabb04 (diff) | |
download | gdb-6dd77b815f4252948dae6b0a7e467789b09c6bbb.zip gdb-6dd77b815f4252948dae6b0a7e467789b09c6bbb.tar.gz gdb-6dd77b815f4252948dae6b0a7e467789b09c6bbb.tar.bz2 |
* 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.
* gdb.base/selftest.exp: Next over lim_at_start initialization.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/event-top.c | 10 | ||||
-rw-r--r-- | gdb/main.c | 4 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/selftest.exp | 4 | ||||
-rw-r--r-- | gdb/top.c | 12 | ||||
-rw-r--r-- | gdb/top.h | 1 |
7 files changed, 31 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a83c493..68cb29d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +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. diff --git a/gdb/event-top.c b/gdb/event-top.c index ceef7b9..5ab324d 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -492,10 +492,8 @@ command_handler (char *command) 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 } @@ -538,9 +536,8 @@ command_handler (char *command) 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", @@ -577,9 +574,8 @@ command_line_handler_continuation (struct continuation_arg *arg) 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", @@ -168,6 +168,10 @@ captured_main (void *data) /* 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) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b4f4994..6fd08ae 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,9 @@ 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. 2003-06-01 Daniel Jacobowitz <drow@mvista.com> diff --git a/gdb/testsuite/gdb.base/selftest.exp b/gdb/testsuite/gdb.base/selftest.exp index 5d9419e..a899e36 100644 --- a/gdb/testsuite/gdb.base/selftest.exp +++ b/gdb/testsuite/gdb.base/selftest.exp @@ -115,6 +115,10 @@ proc do_steps_and_nexts {} { 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" @@ -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 @@ -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", @@ -70,5 +70,6 @@ extern char *source_error; extern char *source_pre_error; extern int history_expansion_p; extern int server_command; +extern char *lim_at_start; #endif |