This can be done using the GDB Python interface:
import gdb class MyBreak(gdb.Breakpoint): def __init__(self, spec): gdb.Breakpoint.__init__(self, spec) self.silent = True def stop(self):
You need to be careful what you do in the stop callback, but not everything is legal. I do not mean that this will not work, but may lead to a crash and / or change in future versions, for example:
def stop(self): print gdb.selected_thread().is_running()
In the upcoming version 7.4 of GDB, FinishBreakpoint should be able to help you with your mocking features (just an example, I have not tested it):
class MyFinishBreakpoint (gdb.FinishBreakpoint) def __init__(self, param): gdb.FinishBreakpoint() self.param = param def stop (self):
Kevin source share