since my smoketest failed again today, i've distracted myself a bit with GDB Python scripting, the result of which is a command that can break when an exception is thrown, but only if a certain function (which is given as parameter) is on the stack.

seems to work, but it is quite slow: finding the smoketest exception in SfxBaseModel::getTitle takes GDB 4 minutes of CPU time.

now probably somebody will tell me that i'm too stupid to RTFM and there is a much simpler way to do this :)

regards,
 michael
import gdb

class FunCatchpoint (gdb.Breakpoint):

    #__init__ spec [type] [wp_class] [internal]
    def __init__(self, arg):
        super (FunCatchpoint, self).__init__("__cxa_throw")
        self.active = arg

    def stop (self):
#        print "stop called for: " + self.active
        frame = gdb.newest_frame()
        while frame:
#            print frame.name()
            if frame.name() == self.active:
                return True
            frame = frame.older()
        return False

class FunCatch(gdb.Command):
    """catch exceptions (but only when inside the given function)

       example:  fcatch SfxBaseModel::getTitle"""

    def __init__ (self):
        super (FunCatch, self).__init__ (
            "fcatch", gdb.COMMAND_BREAKPOINTS)
        #not a good idea: need names, not symbols, gdb.COMPLETE_SYMBOL)

    def invoke (self, arg, from_tty):
        FunCatchpoint(arg)

FunCatch()

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to