2013-04-16 02:45:21 -07:00
|
|
|
# Implement eo_break that'll break on a macro/subid/whatever.
|
|
|
|
|
|
|
|
import gdb
|
|
|
|
|
2014-05-06 03:41:17 -07:00
|
|
|
def symbol_equal_to_string(symbol, string):
|
|
|
|
return (symbol != None) and (symbol.name == string)
|
|
|
|
|
2012-12-12 05:16:49 -08:00
|
|
|
class Eo_step(gdb.Command):
|
2014-05-06 03:41:17 -07:00
|
|
|
STEP_LIMIT = 10
|
2012-12-12 05:16:49 -08:00
|
|
|
def __init__(self):
|
|
|
|
gdb.Command.__init__(self, "eo_step", gdb.COMMAND_OBSCURE)
|
2014-05-06 03:41:17 -07:00
|
|
|
self.START_FUNC = "_eo_call_resolve"
|
|
|
|
self.SKIP_FUNC = "_eo_do_start"
|
2012-12-12 05:16:49 -08:00
|
|
|
|
|
|
|
def invoke (self, arg, from_tty):
|
2014-05-06 03:41:17 -07:00
|
|
|
# Get to the call resolve function.
|
|
|
|
i = 0
|
|
|
|
while not symbol_equal_to_string(gdb.selected_frame().function(), self.START_FUNC):
|
|
|
|
if symbol_equal_to_string(gdb.selected_frame().function(), self.SKIP_FUNC):
|
|
|
|
gdb.execute("finish", False, to_string=True)
|
|
|
|
|
|
|
|
if i > Eo_step.STEP_LIMIT:
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
i += 1
|
|
|
|
gdb.execute("step", False, to_string=True)
|
|
|
|
|
|
|
|
# If we found the function, return from it, otherwise, fail.
|
|
|
|
if symbol_equal_to_string(gdb.selected_frame().function(), self.START_FUNC):
|
|
|
|
gdb.execute("finish", False, to_string=True)
|
|
|
|
else:
|
2015-04-14 16:55:03 -07:00
|
|
|
print("Search limit reached, you tried calling eo_step too far from an eo_do.")
|
2014-05-06 03:41:17 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
# Step until we move to a different function. FIXME: The hook can confuse us, needs to be solved.
|
|
|
|
cur_func = gdb.selected_frame().function()
|
|
|
|
while gdb.selected_frame().function() == cur_func:
|
2012-12-12 05:16:49 -08:00
|
|
|
gdb.execute("stepi", False, to_string=True)
|
|
|
|
|
2014-05-06 03:41:17 -07:00
|
|
|
# One last call to skip into the implementation
|
|
|
|
gdb.execute("step", True)
|
2012-12-12 05:16:49 -08:00
|
|
|
|
|
|
|
Eo_step()
|