Ejemplo n.º 1
0
 def main(argv):
     rawrefcount.create_link_pypy(w1, ob1)
     w = None
     ob = lltype.nullptr(PyObjectS)
     oblist = []
     for op in argv[1:]:
         revdb.stop_point()
         w = W_Root(42)
         ob = lltype.malloc(PyObjectS, flavor='raw', zero=True)
         ob.c_ob_refcnt = rawrefcount.REFCNT_FROM_PYPY
         rawrefcount.create_link_pypy(w, ob)
         oblist.append(ob)
     del oblist[-1]
     #
     rgc.collect()
     assert rawrefcount.from_obj(PyObject, w) == ob
     assert rawrefcount.to_obj(W_Root, ob) == w
     while True:
         ob = rawrefcount.next_dead(PyObject)
         if not ob:
             break
         assert ob in oblist
         oblist.remove(ob)
     objectmodel.keepalive_until_here(w)
     revdb.stop_point()
     return 9
Ejemplo n.º 2
0
 def bootstrap():
     rthread.gc_thread_start()
     _sleep(1)
     revdb.stop_point()
     _sleep(2)
     revdb.stop_point()
     rthread.gc_thread_die()
Ejemplo n.º 3
0
 def main(argv):
     lst, keepalive = make(argv[0])
     expected = ['prebuilt'] + [c for c in argv[0]]
     dead = [False] * len(lst)
     for j in range(17000):
         outp = []
         for i in range(len(lst)):
             v = lst[i]()
             debug_print(v)
             if dead[i]:
                 assert v is None
             elif v is None:
                 outp.append('<DEAD>')
                 dead[i] = True
             else:
                 outp.append(v.s)
                 assert v.s == expected[i]
         print ''.join(outp)
         if (j % 1000) == 999:
             debug_print('============= COLLECT ===========')
             rgc.collect()
         debug_print('------ done', j, '.')
     assert not dead[0]
     assert not dead[-1]
     keepalive_until_here(keepalive)
     revdb.stop_point()
     return 9
Ejemplo n.º 4
0
 def main(argv):
     glob.ping = False
     lst1 = [X() for i in range(256)]
     lst = [X() for i in range(3000)]
     for i, x in enumerate(lst):
         x.baz = i
         fq.register_finalizer(x)
     for i in range(3000):
         lst[i] = None
         if i % 300 == 150:
             rgc.collect()
         revdb.stop_point()
         j = i + glob.ping * 1000000
         assert foobar(j) == j
         if glob.ping:
             glob.ping = False
             total = 0
             while True:
                 x = fq.next_dead()
                 if x is None:
                     break
                 total = intmask(total * 3 + x.baz)
             assert foobar(total) == total
     keepalive_until_here(lst1)
     return 9
Ejemplo n.º 5
0
def stop_point_activate(place=0, pycode=None, opindex=-1):
    if revdb.watch_save_state():
        any_watch_point = False
        # ^^ this flag is set to True if we must continue to enter this
        # block of code.  If it is still False for watch_restore_state()
        # below, then future watch_save_state() will return False too---
        # until the next time revdb.c:set_revdb_breakpoints() is called.
        space = dbstate.space
        with non_standard_code:
            watch_id = -1
            if dbstate.breakpoint_by_file is not None:
                any_watch_point = True
                if pycode is not None:
                    watch_id = check_and_trigger_bkpt(pycode, opindex)
            if watch_id == -1:
                for prog, watch_id, expected in dbstate.watch_progs:
                    any_watch_point = True
                    try:
                        got = _run_watch(space, prog)
                    except OperationError as e:
                        got = e.errorstr(space)
                    except Exception:
                        break
                    if got != expected:
                        break
                else:
                    watch_id = -1
        revdb.watch_restore_state(any_watch_point)
        if watch_id != -1:
            revdb.breakpoint(watch_id)
    revdb.stop_point(place)
Ejemplo n.º 6
0
 def main(argv):
     revdb.stop_point()
     rthread.start_new_thread(bootstrap, ())
     for i in range(2):
         _sleep(2)
         revdb.stop_point()
     print "ok"
     return 9
Ejemplo n.º 7
0
 def main(argv):
     lst = [X() for i in range(3000)]
     for i in range(3000):
         lst[i] = None
         if i % 300 == 150:
             rgc.collect()
         revdb.stop_point()
     return 9
Ejemplo n.º 8
0
 def main(argv):
     revdb.stop_point()
     ec = EC(12)
     raw_thread_local.set(ec)
     rthread.start_new_thread(bootstrap, ())
     _sleep(2)
     print raw_thread_local.get().value
     assert raw_thread_local.get() is ec
     return 9
Ejemplo n.º 9
0
 def bootstrap():
     rthread.gc_thread_start()
     _sleep(1)
     ec = EC(4567)
     raw_thread_local.set(ec)
     revdb.stop_point()
     print raw_thread_local.get().value
     assert raw_thread_local.get() is ec
     rthread.gc_thread_die()
Ejemplo n.º 10
0
 def main(argv):
     lst = [argv[0], 'prebuilt1', 'prebuilt2']
     for op in argv[1:]:
         revdb.stop_point()
         print op
         lst.append(op + '??')  # create a new string here
     for x in lst:
         print revdb.get_unique_id(x)
     return 9
Ejemplo n.º 11
0
 def main(argv):
     revdb.register_debug_command(1, lambda_blip)
     for i, op in enumerate(argv[1:]):
         dbstate.stuff = Stuff()
         dbstate.stuff.x = i + 1000
         revdb.stop_point(i * 10)
         print op
         if i == 1:
             if os.fork() == 0:  # child
                 os.write(2, "this line is from the fork child.\n")
                 return 0
     return 9
Ejemplo n.º 12
0
 def main(argv):
     glob.count = 0
     lst = [X() for i in range(3000)]
     x = -1
     for i in range(3000):
         lst[i] = None
         if i % 300 == 150:
             rgc.collect()
         revdb.stop_point()
         x = glob.count
         assert foobar(x) == x
     print x
     return 9
Ejemplo n.º 13
0
 def main(argv):
     revdb.register_debug_command(100, lambda_blip)
     revdb.register_debug_command(CMD_PRINT, lambda_print)
     revdb.register_debug_command(CMD_ATTACHID, lambda_attachid)
     revdb.register_debug_command("ALLOCATING", lambda_allocating)
     revdb.register_debug_command(revdb.CMD_COMPILEWATCH,
                                  lambda_compilewatch)
     revdb.register_debug_command(revdb.CMD_CHECKWATCH,
                                  lambda_checkwatch)
     for i, op in enumerate(argv[1:]):
         dbstate.stuff = Stuff()
         dbstate.stuff.x = i + 1000
         if i == dbstate.break_loop or i == dbstate.break_loop + 1:
             revdb.breakpoint(99)
         revdb.stop_point()
         print op
     return 9
Ejemplo n.º 14
0
 def main(argv):
     revdb.stop_point()
     print intmask(callme(callback))
     revdb.stop_point()
     return 9