-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack_traverser.h
38 lines (30 loc) · 1.25 KB
/
stack_traverser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// \file
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include <setjmp.h>
#include "linked_list.h"
#include "heap.h"
#ifndef __stack_traverser__
#define __stack_traverser__
/// Creates a stack top and returns it.
///
/// \returns the new stack top
void *get_stack_top();
/// Traverses the stack with predefined top and bottom, that would the full stack.
///
/// \param h is the heap to check
/// \returns ll_node, the first node of the list containing all the pointers that point to the heap h
ll_head get_alive_stack_pointers(heap_t *h);
ll_head get_alive_stack_address_pointers(heap_t *h);
/// Traverses the stack and creates a list of the pointers that points to the heap h in the range of top and bottom addresses.
/// alive_stack_pointers decides if it's a stack grows upwards or downwards, you don't have to take care of that.
///
/// \param h is the heap to be checked
/// \param top the stack top address
/// \param bottom the stack bottom address
/// \returns ll_node, the first node of the list containing all the pointers that point to the heap h
ll_head get_alive_stack_pointers_in_range(heap_t *h, void *top, void *bottom);
ll_head get_alive_stack_address_pointers_in_range(heap_t *h, void *top, void *bottom);
#endif