1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-26 03:11:44 +02:00

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)
This commit is contained in:
mostang.com!davidm 2005-05-03 09:13:17 +00:00
parent 4e833d43fc
commit a5e8408d47

View file

@ -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>
@ -68,6 +69,18 @@ do_backtrace (void)
while (ret > 0);
}
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)
{
@ -75,6 +88,9 @@ main (int argc, char **argv)
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);