diff options
author | mostang.com!davidm <mostang.com!davidm> | 2005-05-03 09:13:17 +0000 |
---|---|---|
committer | mostang.com!davidm <mostang.com!davidm> | 2005-05-03 09:13:17 +0000 |
commit | a5e8408d4774885c768caf030cfc1ec3314e8115 (patch) | |
tree | 1a509c19c6e98c2cba042553537ed7ab8b8e3820 /tests | |
parent | 4e833d43fc44f8a9c9b107cf3c936bcf3a562d56 (diff) | |
download | libunwind-a5e8408d4774885c768caf030cfc1ec3314e8115.tar.gz |
Include <string.h> to get memset() declared.
(consume_some_stack_space): New function.
(main): Call consume_some_stack_space() before establishing the
rlimit. Otherwise, stack-expansion may bump into
the address-space rlimit.
(Logical change 1.290)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-mem.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test-mem.c b/tests/test-mem.c index e1fcb2b6..4f7e58c5 100644 --- a/tests/test-mem.c +++ b/tests/test-mem.c @@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <libunwind.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <sys/resource.h> @@ -69,12 +70,27 @@ do_backtrace (void) } int +consume_some_stack_space (void) +{ + unw_cursor_t cursor; + unw_context_t uc; + char string[1024]; + + memset (&cursor, 0, sizeof (cursor)); + memset (&uc, 0, sizeof (uc)); + return sprintf (string, "hello %p %p\n", &cursor, &uc); +} + +int main (int argc, char **argv) { struct rlimit rlim; verbose = argc > 1; + if (consume_some_stack_space () > 9999) + exit (-1); /* can't happen, but don't let the compiler know... */ + rlim.rlim_cur = 0; rlim.rlim_max = RLIM_INFINITY; setrlimit (RLIMIT_DATA, &rlim); |