mirror of
https://github.com/QuasarApp/backward-cpp.git
synced 2025-04-30 04:14:30 +00:00
stackoverflow test
This commit is contained in:
parent
246fd67b34
commit
c486368c54
@ -23,7 +23,8 @@
|
|||||||
|
|
||||||
#include "backward.hpp"
|
#include "backward.hpp"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
|
#include <sys/resource.h>
|
||||||
#include "test/test.hpp"
|
#include "test/test.hpp"
|
||||||
|
|
||||||
using namespace backward;
|
using namespace backward;
|
||||||
@ -77,3 +78,16 @@ TEST_DIVZERO (divide_by_zero)
|
|||||||
int v = divide_by_zero();
|
int v = divide_by_zero();
|
||||||
std::cout << "v=" << v << std::endl;
|
std::cout << "v=" << v << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bye_bye_stack(int i) {
|
||||||
|
return bye_bye_stack(i + 1) + bye_bye_stack(i * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_SEGFAULT(stackoverflow)
|
||||||
|
{
|
||||||
|
struct rlimit limit;
|
||||||
|
limit.rlim_max = 8096;
|
||||||
|
setrlimit(RLIMIT_STACK, &limit);
|
||||||
|
int r = bye_bye_stack(42);
|
||||||
|
std::cout << "r=" << r << std::endl;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user