mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-03-31 03:32:16 +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:
parent
4e833d43fc
commit
a5e8408d47
1 changed files with 16 additions and 0 deletions
|
@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
@ -68,6 +69,18 @@ do_backtrace (void)
|
||||||
while (ret > 0);
|
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
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +88,9 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
verbose = argc > 1;
|
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_cur = 0;
|
||||||
rlim.rlim_max = RLIM_INFINITY;
|
rlim.rlim_max = RLIM_INFINITY;
|
||||||
setrlimit (RLIMIT_DATA, &rlim);
|
setrlimit (RLIMIT_DATA, &rlim);
|
||||||
|
|
Loading…
Add table
Reference in a new issue