...
 
Commits (2)
......@@ -197,19 +197,19 @@ def build_closure_printers():
closurePrinters = build_closure_printers()
closureTypeDict = { v: str(ty) for ty, v in ClosureType.__dict__.items() }
@memoized
def heap_bounds() -> Tuple[Ptr, Ptr]:
aspace = gdb.parse_and_eval('mblock_address_space')
begin = Ptr(aspace['begin'])
end = Ptr(aspace['end'])
#end = Ptr(aspace['end'])
end = Ptr(gdb.parse_and_eval('mblock_high_watermark'))
return (begin, end)
def heap_alloced(ptr):
def heap_alloced(ptr: Ptr):
w = ptr.cast(StgWord)
begin, end = heap_bounds()
return (w >= begin) and (w < end)
def print_addr(ptr):
def print_addr(ptr: Ptr) -> Text:
ptr = ptr.cast(StgPtr)
sym = gdb.find_pc_line(int(ptr.cast(StgWord)))
if sym.symtab:
......@@ -342,7 +342,7 @@ class PrintGhcStackCmd(CommandWithArgs):
sp = gdb.parse_and_eval(opts.sp if opts.sp else '$rbp').cast(StgPtr)
print(print_stack(sp, depth=opts.depth, max_frames=opts.frames))
def print_stack(sp, max_frames, depth=1):
def print_stack(sp, max_frames, depth: int=1):
assert sp.type == StgPtr
doc = VSep()
doc += Text('Sp = 0x%08x' % int(sp))
......