mirror of https://github.com/pwndbg/pwndbg.git
Add test for setflags command (#2056)
parent
8a09a89c34
commit
5be38a5bf3
@ -0,0 +1,33 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import gdb
|
||||
|
||||
import pwndbg.gdblib.regs
|
||||
import tests
|
||||
|
||||
REFERENCE_BINARY = tests.binaries.get("reference-binary.out")
|
||||
|
||||
|
||||
def test_flags_command(start_binary):
|
||||
start_binary(REFERENCE_BINARY)
|
||||
|
||||
old_eflags = pwndbg.gdblib.regs.eflags
|
||||
|
||||
# Verify CF is not set
|
||||
assert old_eflags & 0x1 == 0
|
||||
|
||||
gdb.execute("setflag cf 1")
|
||||
|
||||
# Verify CF is set and no other flags have changed
|
||||
assert (old_eflags | 1) == pwndbg.gdblib.regs.eflags
|
||||
|
||||
gdb.execute("setflag cf 0")
|
||||
|
||||
# Verify CF is not set and no other flags have changed
|
||||
assert old_eflags == pwndbg.gdblib.regs.eflags
|
||||
|
||||
# Test setting an invalid value
|
||||
gdb.execute("setflag cf 2")
|
||||
|
||||
# Verify no flags have changed
|
||||
assert old_eflags == pwndbg.gdblib.regs.eflags
|
||||
Loading…
Reference in new issue