Skip to content
Snippets Groups Projects
Commit c7fda1ae authored by pompolic's avatar pompolic
Browse files

Printing cleanup

parent 77405206
No related branches found
No related tags found
No related merge requests found
......@@ -222,9 +222,10 @@ class HammerParseApply(FlowControlWithPrint):
print(":: hammer-parse-apply")
def invoke(self, arg, from_tty):
#profiler = cProfile.Profile() # DEBUG
#profiler.enable() # DEBUG
with cProfile.Profile() as profiler: # DEBUG
##profiler = cProfile.Profile() # DEBUG
##profiler.enable() # DEBUG
#with cProfile.Profile() as profiler: # DEBUG
if True:
top_level_parse.setup_ast_stack_index(0) #TODO: is it a problem if this command overwrites it? would it better to use a convenience variable, as with parse-step?
showmap_old = top_level_parse.show_input_map_after_apply
top_level_parse.show_input_map_after_apply = False
......@@ -237,13 +238,13 @@ class HammerParseApply(FlowControlWithPrint):
top_level_parse.clear_ast_stack_index()
self.conditionally_print_backtrace()
profiler.print_stats(sort='tottime') # DEBUG
#profiler.disable() # DEBUG
#s = io.StringIO() # DEBUG
#sortby = SortKey.CUMULATIVE # DEBUG
#ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # DEBUG
#ps.print_stats() # DEBUG
#print(s.getvalue()) # DEBUG
#profiler.print_stats(sort='tottime') # DEBUG
##profiler.disable() # DEBUG
##s = io.StringIO() # DEBUG
##sortby = SortKey.CUMULATIVE # DEBUG
##ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # DEBUG
##ps.print_stats() # DEBUG
##print(s.getvalue()) # DEBUG
HammerParseApply()
......@@ -253,9 +254,10 @@ class HammerParseApplyAndShowAST(FlowControlWithPrint):
print(":: hammer-parse-apply-and-show-ast")
def invoke(self, arg, from_tty):
#profiler = cProfile.Profile() # DEBUG
#profiler.enable() # DEBUG
with cProfile.Profile() as profiler: # DEBUG
##profiler = cProfile.Profile() # DEBUG
##profiler.enable() # DEBUG
#with cProfile.Profile() as profiler: # DEBUG
if True:
top_level_parse.setup_ast_stack_index(0) #TODO: is it a problem if this command overwrites it? would it better to use a convenience variable, as with parse-step?
showmap_old = top_level_parse.show_input_map_after_apply
top_level_parse.show_input_map_after_apply = True
......@@ -268,12 +270,12 @@ class HammerParseApplyAndShowAST(FlowControlWithPrint):
top_level_parse.clear_ast_stack_index()
self.conditionally_print_backtrace()
profiler.print_stats(sort='tottime') # DEBUG
#profiler.disable() # DEBUG
#s = io.StringIO() # DEBUG
#sortby = SortKey.CUMULATIVE # DEBUG
#ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # DEBUG
#ps.print_stats() # DEBUG
#print(s.getvalue()) # DEBUG
#profiler.print_stats(sort='tottime') # DEBUG
##profiler.disable() # DEBUG
##s = io.StringIO() # DEBUG
##sortby = SortKey.CUMULATIVE # DEBUG
##ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # DEBUG
##ps.print_stats() # DEBUG
##print(s.getvalue()) # DEBUG
HammerParseApplyAndShowAST()
......@@ -96,7 +96,7 @@ class HDoParseRetBreakpoint(gdb.Breakpoint):
ast_manager.print_ast()
#print(top_level_parse.peek_parserstack().p_stack) #TODO:sometimes the hammer-parser-backtrace gets messed up
top_level_parse.input_ptr = parse_state['input_stream']['input']
if top_level_parse.show_input_map_after_apply:
if top_level_parse.show_input_map_after_apply and ast_manager.top_node:
top_level_parse.print_input_map(ast_manager.top_node.ast)
#print(top_level_parse.peek_parserstack().p_stack)
# Do not stop at this breakpoint, but stop at the next HDoParseBreakpoint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment