aos/usr/stackoverflow/main.c

33 lines
719 B
C

/**
* \file
* \brief that intentionally creates a stack overflow
*/
/*
* Copyright (c) 2016, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
*/
#include <stdio.h>
#include <stdlib.h>
#include <aos/aos.h>
void stackoverflow(int i);
void stackoverflow(int i) {
void * pointer = NULL;
volatile char filler[BASE_PAGE_SIZE];
filler[0] = 'a';
debug_printf("i = %d, pointer = %p\n", i, &pointer);
stackoverflow(i + 1);
}
int main(int argc, char *argv[])
{
stackoverflow(0);
}