This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
driver.cpp
62 lines (55 loc) · 1.63 KB
/
driver.cpp
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* \file
* \brief Important initialisation that has to happen at the start of main().
*
* Also contains main(), so it can be the only file different between
* boomerang and bigtest.
*
* \authors
* Copyright (C) 1998-2001, The University of Queensland
* \authors
* Copyright (C) 2001, Sun Microsystems, Inc
* \authors
* Copyright (C) 2002-2006, Mike Van Emmerik and Trent Waddington
*
* \copyright
* See the file "LICENSE.TERMS" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "boomerang.h"
//#define GC_DEBUG 1 // Uncomment to debug the garbage collector
#include "gc.h"
void init_dfa(); // Prototypes for
void init_sslparser(); // various initialisation functions
void init_basicblock(); // for garbage collection safety
#ifndef NO_CMDLINE_MAIN
int main(int argc, const char *argv[])
{
// Call the various initialisation functions for safe garbage collection
init_dfa();
init_sslparser();
init_basicblock();
return Boomerang::get()->commandLine(argc, argv);
}
#endif
#ifndef NO_NEW_OR_DELETE_OPERATORS
#ifndef NO_GARBAGE_COLLECTOR
/* This makes sure that the garbage collector sees all allocations, even those
that we can't be bothered collecting, especially standard STL objects */
void *operator new(size_t n)
{
#ifdef DONT_COLLECT_STL
return GC_malloc_uncollectable(n); // Don't collect, but mark
#else
return GC_malloc(n); // Collect everything
#endif
}
void operator delete(void *p)
{
#ifdef DONT_COLLECT_STL
GC_free(p); // Important to call this if you call GC_malloc_uncollectable
// #else do nothing!
#endif
}
#endif
#endif