diff --git a/gdb-port/breakpoint-manager.py b/gdb-port/breakpoint-manager.py index d94bd4686a47bb10b5dd40f2a846cce343fa7029..82abe9e73fe2dea7c94b31842be6064c350c6ca3 100644 --- a/gdb-port/breakpoint-manager.py +++ b/gdb-port/breakpoint-manager.py @@ -51,7 +51,7 @@ class BreakpointManager: plp_retq = self.locate_perform_lowlevel_parse_retq() perform_lowlevel_parse_ret = PerformLowLevelParseRetBreakpoint("*" + hex(plp_retq)) self.hammer_retq_breakpoints.append(perform_lowlevel_parse_ret) - hpp_retq = locate_h_packrat_parse_retq() + hpp_retq = self.locate_h_packrat_parse_retq() h_packrat_parse_ret = HPackratParseRetBreakpoint("*" + hex(hpp_retq)) self.hammer_retq_breakpoints.append(h_packrat_parse_ret) return self.hammer_retq_breakpoints diff --git a/gdb-port/parser-name-instrumentation-gdb.py b/gdb-port/parser-name-instrumentation-gdb.py index 250f250ade7590cc844ded08d515cab5de75aa3e..97bd0fd1dcbc47d2c1ef7e3d3fb913be3f4647fe 100644 --- a/gdb-port/parser-name-instrumentation-gdb.py +++ b/gdb-port/parser-name-instrumentation-gdb.py @@ -556,35 +556,6 @@ class HammerParserCurrentEnv(gdb.Command): HammerParserCurrentEnv() -#TODO: move all this to BreakpointManager? -# Call when execution stopped at breakpoint in main -def locate_perform_lowlevel_parse_retq(): - arch = gdb.selected_frame().architecture() - p_l_p_sym = gdb.lookup_symbol("perform_lowlevel_parse")[0] - p_l_p_address = int(p_l_p_sym.value().address) - # The choice of disassembling only 400 instructions from the start is arbitrary. (This function is 310 bytes long on this particular machine.) There is probably a way to find out where a function ends. - instructions = arch.disassemble(p_l_p_address, p_l_p_address+400) - results = [ ins["addr"] for ins in instructions if ins["asm"].startswith("ret") ] - return results[0] - -def locate_h_packrat_parse_retq(): - arch = gdb.selected_frame().architecture() - h_p_p_sym = gdb.lookup_symbol("h_packrat_parse")[0] - h_p_p_address = int(h_p_p_sym.value().address) - # Same as with perform_lowlevel_parse, +450 is arbitrary - instructions = arch.disassemble(h_p_p_address, h_p_p_address+450) - results = [ ins["addr"] for ins in instructions if ins["asm"].startswith("ret") ] - return results[0] - -def locate_init_parser_retq(): - arch = gdb.selected_frame().architecture() - i_p_sym = gdb.lookup_symbol("init_parser")[0] - i_p_address = int(i_p_sym.value().address) - # Same as with perform_lowlevel_parse, +16000 is arbitrary - instructions = arch.disassemble(i_p_address, i_p_address+16000) - results = [ ins["addr"] for ins in instructions if ins["asm"].startswith("ret") ] - return results[0] - def locate_retqs(symbol, length): arch = gdb.selected_frame().architecture() sym = gdb.lookup_symbol(symbol)[0]