1
2
3 '''
4 GDB - Contains functions directly used by GDB for crash processing
5
6 @author: Christian Holler (:decoder)
7
8 @license:
9
10 This Source Code Form is subject to the terms of the Mozilla Public
11 License, v. 2.0. If a copy of the MPL was not distributed with this
12 file, You can obtain one at http://mozilla.org/MPL/2.0/.
13
14 @contact: choller@mozilla.com
15 '''
16
18 return not str(gdb.parse_and_eval("$rax"))=="void"
19
21 return not str(gdb.parse_and_eval("$r0"))=="void"
22
24 if is64bit():
25 mask = 0xffffffffffffffff
26 else:
27 mask = 0xffffffff
28 return "0x%x"%(int(str(gdb.parse_and_eval("$" + reg)),0) & mask)
29
31 return str(int(str(gdb.parse_and_eval("$" + reg)),0))
32
34 return str(gdb.parse_and_eval("$" + reg))
35
37 if is64bit():
38 regs = "rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11 r12 r13 r14 r15 rip".split(" ")
39 elif isARM():
40 regs = "r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 sp lr pc cpsr".split(" ")
41 else:
42 regs = "eax ebx ecx edx esi edi ebp esp eip".split(" ")
43
44 for reg in regs:
45 try:
46 print(reg + "\t" + regAsHexStr(reg) + "\t" + regAsIntStr(reg))
47 except:
48 print(reg + "\t" + regAsRaw(reg))
49