'Work around implementation for gdb.parse_and_eval with enhancements
Args:
- exp: expression to evaluate (String)
Returns:
- value of expression'

def parse_and_eval(self, exp):

    regs = sum(REGISTERS.values(), [])
    for r in regs:
        if ((('$' + r) not in exp) and (('e' + r) not in exp) and (('r' + r) not in exp)):
            exp = exp.replace(r, ('$%s' % r))
    p = re.compile('(.*)\\[(.*)\\]')
    matches = p.search(exp)
    if (not matches):
        p = re.compile('(.*).s:(0x.*)')
        matches = p.search(exp)
    if matches:
        mod = 'w'
        if ('BYTE' in matches.group(1)):
            mod = 'b'
        elif ('QWORD' in matches.group(1)):
            mod = 'g'
        elif ('DWORD' in matches.group(1)):
            mod = 'w'
        elif ('WORD' in matches.group(1)):
            mod = 'h'
        out = self.execute_redirect(('x/%sx    %s' % (mod, matches.group(2))))
        if (not out):
            return None
        else:
            return out.split(': DCTB ')[(-1)].strip()
    else:
        out = self.execute_redirect(('print    %s' % exp))
    if (not out):
        return None
    else:
        out = gdb.history(0).__str__()
        out = out.encode('ascii', 'ignore')
        out = decode_string_escape(out)
        return out.strip()
