summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/backtrace.in
blob: 4547355f96561ced282eee92e24635beb85b5950 (plain)
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
/*****
 * backtrace.in
 * Andy Hammerlindl  2009/07/28
 *
 * Runtime functions for printing garbage collector backtraces.
 *
 *****/

// No extra types defined.

// No extra code for .cc file.

void generate_random_backtrace()
{
#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
  GC_generate_random_backtrace();
#else
  error("generate_random_backtrace() requires ./configure --enable-gc-debug");
#endif
}

void print_random_addresses(Int n=1)
{
#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
  GC_gcollect();
  for (Int i=0; i < n; ++i)
    GC_debug_print_heap_obj_proc(GC_base(GC_generate_random_valid_address()));
#else
  error("print_random_addresses() requires ./configure --enable-gc-debug");
  unused(&n); // Avoid unused variable warning message.
#endif
}