'Run Python under gdb, corrupting variables in the inferior process
immediately before taking a backtrace.
Verify that the variable\'s representation is the expected failsafe
representation'

def assertSane(self, source, corruption, exprepr=None):

    if corruption:
        cmds_after_breakpoint = [corruption, 'backtrace']
    else:
        cmds_after_breakpoint = ['backtrace']
    (gdb_repr, gdb_output) = self.get_gdb_repr(source, cmds_after_breakpoint=cmds_after_breakpoint)
    if exprepr:
        if (gdb_repr == exprepr):
            return
    pattern = '<.*    at    remote    0x-?[0-9a-f]+>'
    m = re.match(pattern, gdb_repr)
    if (not m):
        self.fail(('Unexpected    gdb    representation:    %r\n%s' % (gdb_repr, gdb_output)))
