Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
backtrace.c File Reference

Go to the source code of this file.

Defines

#define MAX_FOUND_OBJECTS   5000

Functions

static void reset_object_traces ()
static void register_traced_object (void *p)
static voidprint_out_pointer (const char *prefix, void *p, GC_get_type_name_proc get_type_name, GC_get_xtagged_name_proc get_xtagged_name, GC_print_tagged_value_proc print_tagged_value)
static void print_traced_objects (int path_length_limit, GC_get_type_name_proc get_type_name, GC_get_xtagged_name_proc get_xtagged_name, GC_print_tagged_value_proc print_tagged_value)

Variables

static int found_object_count
static voidfound_objects [MAX_FOUND_OBJECTS]

Define Documentation

#define MAX_FOUND_OBJECTS   5000

Definition at line 24 of file backtrace.c.


Function Documentation

static void* print_out_pointer ( const char *  prefix,
void p,
GC_get_type_name_proc  get_type_name,
GC_get_xtagged_name_proc  get_xtagged_name,
GC_print_tagged_value_proc  print_tagged_value 
) [static]

Definition at line 40 of file backtrace.c.

{
  trace_page_t *page;
  const char *what;

  page = pagemap_find_page(GC->page_maps, p);
  if (!page || (trace_page_type(page) == TRACE_PAGE_BAD)) {
    GCPRINT(GCOUTF, "%s??? %p\n", prefix, p);
    return NULL;
  }
  p = trace_pointer_start(page, p);

  if (trace_page_type(page) == TRACE_PAGE_TAGGED) {
    Type_Tag tag;
    tag = *(Type_Tag *)p;
    if ((tag >= 0) && get_type_name && get_type_name(tag)) {
      print_tagged_value(prefix, p, 0, 0, 1000, "\n");
    } else {
      GCPRINT(GCOUTF, "%s<#%d> %p\n", prefix, tag, p);
    }
    what = NULL;
  } else if (trace_page_type(page) == TRACE_PAGE_ARRAY) {
    what = "ARRAY";
  } else if (trace_page_type(page) == TRACE_PAGE_TAGGED_ARRAY) {
    what = "TARRAY";
  } else if (trace_page_type(page) == TRACE_PAGE_ATOMIC) {
    what = "ATOMIC";
  } else if (trace_page_type(page) == TRACE_PAGE_XTAGGED) {
    if (get_xtagged_name)
      what = get_xtagged_name(p);
    else
      what = "XTAGGED";
  } else if (trace_page_type(page) == TRACE_PAGE_MALLOCFREE) {
    what = "MALLOCED";
  } else {
    what = "?!?";
  }

  if (what) {
    GCPRINT(GCOUTF, "%s%s%s %p\n", 
           prefix, what, 
           (trace_page_is_big(page) ? "b" : ""),
           p);
  }

  return trace_backpointer(page, p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void print_traced_objects ( int  path_length_limit,
GC_get_type_name_proc  get_type_name,
GC_get_xtagged_name_proc  get_xtagged_name,
GC_print_tagged_value_proc  print_tagged_value 
) [static]

Definition at line 91 of file backtrace.c.

{
  int i;
  GC->dumping_avoid_collection++;
  GCPRINT(GCOUTF, "Begin Trace\n");
  for (i = 0; i < found_object_count; i++) {
    void *p;
    int limit = path_length_limit;
    p = found_objects[i];
    p = print_out_pointer("==* ", p, get_type_name, get_xtagged_name, print_tagged_value);
    while (p && limit) {
      p = print_out_pointer(" <- ", p, get_type_name, get_xtagged_name, print_tagged_value);
      limit--;
    }
  }
  GCPRINT(GCOUTF, "End Trace\n");
  --GC->dumping_avoid_collection;
}

Here is the call graph for this function:

static void register_traced_object ( void p) [static]

Definition at line 33 of file backtrace.c.

static void reset_object_traces ( ) [static]

Definition at line 28 of file backtrace.c.


Variable Documentation

Definition at line 25 of file backtrace.c.

Definition at line 26 of file backtrace.c.