**# и только вызывает те конструкторы, которые делают. C: /opt/extend/source/development/devices/prod_dev/blood_gas_board/script/gcov_init_all_v2.py
**# call_filtered_gcov_ctors
callfilteredgcovctors (gdb.comnd):
callfilteredgcovctors (gdb.comnd):
callfilteredgcovctor global__Sub_i_65535_0 * Конструкторы, которые вызывают __GCOV_INIT. "" "
Код: Выделить всё
def __init__(self):
super(CallFilteredGcovCtors, self).__init__("call_filtered_gcov_ctors", gdb.COMMAND_USER)
def invoke(self, arg, from_tty):
print "[gcov-init] Searching for coverage-related constructors..."
functions = gdb.execute("info functions _GLOBAL__sub_I_", to_string=True)
found = 0
called = 0
for line in functions.splitlines():
match = re.search(r'(_GLOBAL__sub_I_65535_0_\w+)', line)
if match:
sym = match.group(1)
found += 1
try:
asm = gdb.execute("disassemble %s" % sym, to_string=True)
if "__gcov_init" in asm:
print "[gcov-init] Calling %s..." % sym
gdb.execute("call %s" % sym)
called += 1
else:
print "[gcov-init] Skipping %s (no __gcov_init)" % sym
except gdb.error as e:
print "[gcov-init] Error calling %s: %s" % (sym, str(e))
print "[gcov-init] Done. %d of %d constructors called." % (called, found)
Подробнее здесь: https://stackoverflow.com/questions/796 ... eabi-4-9-3