ext/objspace/object_tracing.c File Reference

#include "ruby/ruby.h"
#include "ruby/debug.h"
#include "objspace.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  traceobj_arg

Functions

static const char * make_unique_str (st_table *tbl, const char *str, long len)
static void delete_unique_str (st_table *tbl, const char *str)
static void newobj_i (VALUE tpval, void *data)
static void freeobj_i (VALUE tpval, void *data)
static int free_keys_i (st_data_t key, st_data_t value, void *data)
static int free_values_i (st_data_t key, st_data_t value, void *data)
static struct traceobj_argget_traceobj_arg (void)
static VALUE trace_object_allocations_start (VALUE self)
static VALUE trace_object_allocations_stop (VALUE self)
static VALUE trace_object_allocations_clear (VALUE self)
static VALUE trace_object_allocations (VALUE self)
int rb_bug_reporter_add (void(*func)(FILE *, void *), void *data)
static int object_allocations_reporter_i (st_data_t key, st_data_t val, st_data_t ptr)
static void object_allocations_reporter (FILE *out, void *ptr)
static VALUE trace_object_allocations_debug_start (VALUE self)
static struct allocation_infolookup_allocation_info (VALUE obj)
allocation_infoobjspace_lookup_allocation_info (VALUE obj)
static VALUE allocation_sourcefile (VALUE self, VALUE obj)
static VALUE allocation_sourceline (VALUE self, VALUE obj)
static VALUE allocation_class_path (VALUE self, VALUE obj)
static VALUE allocation_method_id (VALUE self, VALUE obj)
static VALUE allocation_generation (VALUE self, VALUE obj)
void Init_object_tracing (VALUE rb_mObjSpace)

Variables

static struct traceobj_argtmp_trace_arg
static int tmp_keep_remains
static int object_allocations_reporter_registered = 0


Function Documentation

static VALUE allocation_class_path ( VALUE  self,
VALUE  obj 
) [static]

Definition at line 395 of file object_tracing.c.

References allocation_info::class_path, lookup_allocation_info(), Qnil, and rb_str_new2.

Referenced by Init_object_tracing().

static VALUE allocation_generation ( VALUE  self,
VALUE  obj 
) [static]

Definition at line 460 of file object_tracing.c.

References allocation_info::generation, lookup_allocation_info(), Qnil, and SIZET2NUM.

Referenced by Init_object_tracing().

static VALUE allocation_method_id ( VALUE  self,
VALUE  obj 
) [static]

Definition at line 428 of file object_tracing.c.

References lookup_allocation_info(), allocation_info::mid, and Qnil.

Referenced by Init_object_tracing().

static VALUE allocation_sourcefile ( VALUE  self,
VALUE  obj 
) [static]

Definition at line 344 of file object_tracing.c.

References lookup_allocation_info(), allocation_info::path, Qnil, and rb_str_new2.

Referenced by Init_object_tracing().

static VALUE allocation_sourceline ( VALUE  self,
VALUE  obj 
) [static]

Definition at line 364 of file object_tracing.c.

References INT2FIX, allocation_info::line, lookup_allocation_info(), and Qnil.

Referenced by Init_object_tracing().

static void delete_unique_str ( st_table tbl,
const char *  str 
) [static]

Definition at line 56 of file object_tracing.c.

References ruby_xfree(), st_data_t, st_delete(), st_insert(), and st_lookup().

Referenced by freeobj_i(), and newobj_i().

static int free_keys_i ( st_data_t  key,
st_data_t  value,
void *  data 
) [static]

Definition at line 134 of file object_tracing.c.

References ruby_xfree(), and ST_CONTINUE.

Referenced by trace_object_allocations_clear().

static int free_values_i ( st_data_t  key,
st_data_t  value,
void *  data 
) [static]

Definition at line 141 of file object_tracing.c.

References ruby_xfree(), and ST_CONTINUE.

Referenced by trace_object_allocations_clear().

static void freeobj_i ( VALUE  tpval,
void *  data 
) [static]

Definition at line 113 of file object_tracing.c.

References delete_unique_str(), traceobj_arg::keep_remains, traceobj_arg::object_table, rb_tracearg_from_tracepoint(), rb_tracearg_object(), ruby_xfree(), st_data_t, st_delete(), st_lookup(), traceobj_arg::str_table, and VALUE.

Referenced by trace_object_allocations_start().

static struct traceobj_arg* get_traceobj_arg ( void   )  [static]

Definition at line 151 of file object_tracing.c.

References ALLOC_N, traceobj_arg::freeobj_trace, traceobj_arg::keep_remains, traceobj_arg::newobj_trace, traceobj_arg::object_table, traceobj_arg::running, st_init_numtable(), st_init_strtable(), traceobj_arg::str_table, tmp_keep_remains, and tmp_trace_arg.

Referenced by trace_object_allocations_clear(), trace_object_allocations_start(), and trace_object_allocations_stop().

void Init_object_tracing ( VALUE  rb_mObjSpace  ) 

Definition at line 472 of file object_tracing.c.

References allocation_class_path(), allocation_generation(), allocation_method_id(), allocation_sourcefile(), allocation_sourceline(), rb_define_module(), rb_define_module_function(), trace_object_allocations(), trace_object_allocations_clear(), trace_object_allocations_debug_start(), trace_object_allocations_start(), and trace_object_allocations_stop().

Referenced by Init_objspace().

static struct allocation_info* lookup_allocation_info ( VALUE  obj  )  [static]

Definition at line 319 of file object_tracing.c.

References NULL, traceobj_arg::object_table, st_data_t, st_lookup(), and tmp_trace_arg.

Referenced by allocation_class_path(), allocation_generation(), allocation_method_id(), allocation_sourcefile(), allocation_sourceline(), and objspace_lookup_allocation_info().

static const char* make_unique_str ( st_table tbl,
const char *  str,
long  len 
) [static]

Definition at line 32 of file object_tracing.c.

References NULL, result, ruby_xmalloc(), st_add_direct(), st_data_t, st_get_key(), st_insert(), and st_lookup().

Referenced by newobj_i().

static void newobj_i ( VALUE  tpval,
void *  data 
) [static]

Definition at line 73 of file object_tracing.c.

References allocation_info::class_path, delete_unique_str(), traceobj_arg::keep_remains, make_unique_str(), NUM2INT, OBJ_FROZEN, traceobj_arg::object_table, Qnil, rb_class_path_cached(), rb_gc_count(), rb_tracearg_defined_class(), rb_tracearg_from_tracepoint(), rb_tracearg_lineno(), rb_tracearg_method_id(), rb_tracearg_object(), rb_tracearg_path(), RBASIC, RBASIC_CLASS, RSTRING_LEN, RSTRING_PTR, RTEST, ruby_xmalloc(), st_data_t, st_insert(), st_lookup(), traceobj_arg::str_table, and VALUE.

Referenced by trace_object_allocations_start().

static void object_allocations_reporter ( FILE out,
void *  ptr 
) [static]

Definition at line 297 of file object_tracing.c.

References object_allocations_reporter_i(), traceobj_arg::object_table, st_data_t, st_foreach(), and tmp_trace_arg.

Referenced by trace_object_allocations_debug_start().

static int object_allocations_reporter_i ( st_data_t  key,
st_data_t  val,
st_data_t  ptr 
) [static]

Definition at line 280 of file object_tracing.c.

References allocation_info::class_path, allocation_info::flags, allocation_info::klass, allocation_info::line, allocation_info::living, allocation_info::mid, NIL_P, allocation_info::path, rb_id2name(), ST_CONTINUE, SYM2ID, and VALUE.

Referenced by object_allocations_reporter().

struct allocation_info* objspace_lookup_allocation_info ( VALUE  obj  ) 

Definition at line 331 of file object_tracing.c.

References lookup_allocation_info().

Referenced by dump_object().

int rb_bug_reporter_add ( void(*)(FILE *, void *)  func,
void *  data 
)

Definition at line 282 of file error.c.

static VALUE trace_object_allocations ( VALUE  self  )  [static]

Definition at line 270 of file object_tracing.c.

References Qnil, rb_ensure(), rb_yield(), trace_object_allocations_start(), and trace_object_allocations_stop().

Referenced by Init_object_tracing().

static VALUE trace_object_allocations_clear ( VALUE  self  )  [static]

Definition at line 226 of file object_tracing.c.

References free_keys_i(), free_values_i(), get_traceobj_arg(), traceobj_arg::object_table, Qnil, st_clear(), st_foreach(), and traceobj_arg::str_table.

Referenced by Init_object_tracing().

static VALUE trace_object_allocations_debug_start ( VALUE  self  )  [static]

Definition at line 307 of file object_tracing.c.

References object_allocations_reporter(), rb_bug_reporter_add(), tmp_keep_remains, and trace_object_allocations_start().

Referenced by Init_object_tracing().

static VALUE trace_object_allocations_start ( VALUE  self  )  [static]

Definition at line 172 of file object_tracing.c.

References freeobj_i(), traceobj_arg::freeobj_trace, get_traceobj_arg(), newobj_i(), traceobj_arg::newobj_trace, Qnil, rb_tracepoint_enable(), rb_tracepoint_new(), RUBY_INTERNAL_EVENT_FREEOBJ, RUBY_INTERNAL_EVENT_NEWOBJ, and traceobj_arg::running.

Referenced by Init_object_tracing(), trace_object_allocations(), and trace_object_allocations_debug_start().

static VALUE trace_object_allocations_stop ( VALUE  self  )  [static]

Definition at line 201 of file object_tracing.c.

References traceobj_arg::freeobj_trace, get_traceobj_arg(), traceobj_arg::newobj_trace, Qnil, rb_tracepoint_disable(), and traceobj_arg::running.

Referenced by Init_object_tracing(), and trace_object_allocations().


Variable Documentation

int object_allocations_reporter_registered = 0 [static]

Definition at line 277 of file object_tracing.c.

int tmp_keep_remains [static]

Definition at line 148 of file object_tracing.c.

Referenced by get_traceobj_arg(), and trace_object_allocations_debug_start().

struct traceobj_arg* tmp_trace_arg [static]

Definition at line 147 of file object_tracing.c.

Referenced by get_traceobj_arg(), lookup_allocation_info(), and object_allocations_reporter().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7