diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index 1976dfd6b064049c01751fc67d18af367725fb39..90ad64219f96c76d4b81147b113f5e9a7db9e6e9 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -18,6 +18,7 @@ class TopLevelParse: self.h_do_parse_parser = None self.vt_types = None self.parser_decombinator = None + self.debug_stop # DEBUG # If available, extracting the allocated bytes at h_do_parse entry/exit # TODO: doing it at h_do_parse gets a list of cumulative allocation sizes @@ -96,6 +97,7 @@ class TopLevelParse: self.cumulative_byte_differences.insert(0, newbytes - self.bytes_at_enter[-(len(self.cumulative_byte_differences)+1)]) # TODO: consistency. this is the third way of answering the question, "how deep are we in the stack" allocated_bytes = self.cumulative_byte_differences[-len(self.cumulative_byte_differences)] - self.cumulative_byte_differences[-(len(self.cumulative_byte_differences)-1)] # NB: len(self.cumulative_byte_differences) changed since the last line self.total_byte_differences.insert(-len(self.cumulative_byte_differences), allocated_bytes) + #print("adding mem use: parser:", str(parser_obj), "arena:", int(parser_stack.arena), "bytes:", allocated_bytes) # DEBUG parser_obj.add_mem_use(int(parser_stack.arena), allocated_bytes) # TODO: allocations can be attributed to individual h_do_parse(parser) calls, thus the same per-parser per-arena stats tracking can be done @@ -142,6 +144,8 @@ class TopLevelParse: # This is probably the slowest part of the code, or maybe the overhead adds up over many calls to h_arena_malloc_raw() if parser_obj is not None: # Caveat: parser_stack is assumed not to be None if we could get a parser_obj + if parser_obj.name == "ws": + print("breakpoint is adding", alloc_size, "bytes to ws") # DEBUG parser_obj.add_mem_use(int(parser_stack.arena), alloc_size) elif parser_stack is not None: #print("Allocation of " + str(alloc_size) + " bytes without a parser on the stack. (Happens before first call perform_lowlevel_parse to or after return from that call)")