mirror of https://github.com/pwndbg/pwndbg.git
Add cpsr command
parent
0df5b7e39a
commit
bbcb5ba333
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import gdb
|
||||||
|
import pwndbg.arch
|
||||||
|
import pwndbg.color
|
||||||
|
import pwndbg.commands
|
||||||
|
import pwndbg.regs
|
||||||
|
|
||||||
|
@pwndbg.commands.Command
|
||||||
|
@pwndbg.commands.OnlyWhenRunning
|
||||||
|
def cpsr():
|
||||||
|
if pwndbg.arch.current != 'arm':
|
||||||
|
print("This is only available on ARM")
|
||||||
|
return
|
||||||
|
|
||||||
|
cpsr = pwndbg.regs.cpsr
|
||||||
|
|
||||||
|
N = cpsr & (1<<31)
|
||||||
|
Z = cpsr & (1<<30)
|
||||||
|
C = cpsr & (1<<29)
|
||||||
|
V = cpsr & (1<<28)
|
||||||
|
|
||||||
|
bold = pwndbg.color.bold
|
||||||
|
|
||||||
|
result = [
|
||||||
|
bold('N') if N else 'n',
|
||||||
|
bold('Z') if Z else 'z',
|
||||||
|
bold('C') if C else 'c',
|
||||||
|
bold('V') if V else 'v'
|
||||||
|
]
|
||||||
|
print('cpsr %#x [ %s ]' % (cpsr, ' '.join(result)))
|
||||||
Loading…
Reference in new issue