'Save current working gdb session to file as a script
Args:
- filename: target file (String)
Returns:
- True if success to save (Bool)'

def save_session(self, filename=None):

    session = ''
    if (not filename):
        filename = self.get_config_filename('session')
    out = self.execute_redirect('show    exec-wrapper')
    wrapper = out.split('"')[1]
    if wrapper:
        session += ('set    exec-wrapper    %s\n' % wrapper)
    try:
        self.save_breakpoints(filename)
        fd = open(filename, 'a+')
        fd.write(('\n' + session))
        fd.close()
        return True
    except:
        return False
