Changeset fb97252f for src


Ignore:
Timestamp:
Apr 17, 2018, 2:10:11 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
new-env, with_gc
Children:
5af7306
Parents:
24de7b1
Message:

Added GC_TRAP debugging compilation flag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/GC.cc

    r24de7b1 rfb97252f  
    5151}
    5252
     53// build with flag GC_TRAP to compile in a breakpoint on register and sweep of a dynamically
     54// chosen object. Process to use:
     55//     break GC::register_object
     56//     run
     57//     set variable GC_TRAP_OBJ = <target>
     58//     disable <first breakpoint>
     59#ifdef GC_TRAP
     60#include <csignal>
     61
     62/// Set to object to check in debugger
     63void* GC_TRAP_OBJ = nullptr;
     64#endif
     65
    5366void GC::register_object(GC_Object* obj) {
     67        #ifdef GC_TRAP
     68                if ( obj == GC_TRAP_OBJ ) std::raise(SIGTRAP);
     69        #endif
    5470        gens[g].push_back(obj);
    5571        obj->mark = !this->mark;  // initialize as un-marked
     
    8197        for ( GC_Object*& obj : young ) {
    8298                if ( obj->mark != mark ) {
     99                        #ifdef GC_TRAP
     100                                if ( obj == GC_TRAP_OBJ ) std::raise(SIGTRAP);
     101                        #endif
    83102                        delete obj;
    84103                        obj = nullptr;
     
    103122        for ( GC_Object*& obj : old ) {
    104123                if ( obj->mark != mark ) {
     124                        #ifdef GC_TRAP
     125                                if ( obj == GC_TRAP_OBJ ) std::raise(SIGTRAP);
     126                        #endif
    105127                        delete obj;
    106128                        obj = nullptr;
Note: See TracChangeset for help on using the changeset viewer.