'Define a user-defined command, overwrite the old content
Args:
- cmd: user-defined command (String)
- code: gdb script code to append (String)
Returns:
- True if success to define (Bool)'

def define_user_command(self, cmd, code):

    commands = ((('define    %s\n' % cmd) + code) + '\nend\n')
    tmp = tmpfile(is_binary_file=False)
    tmp.write(commands)
    tmp.flush()
    result = self.execute(('source    %s' % tmp.name))
    tmp.close()
    return result
