18 lines
619 B
Python
18 lines
619 B
Python
# set args 0x1FF80 0x80 0x30
|
|
# source gdb/z.py
|
|
|
|
import gdb
|
|
import sys
|
|
|
|
# Parse arguments from the GDB command
|
|
args = gdb.string_to_argv(gdb.parameter("args"))
|
|
if len(args) != 3:
|
|
print("Usage: source gdb/zero_with_params.py <start_address> <num_bytes> <pattern>")
|
|
else:
|
|
start_address = int(args[0], 16) # Convert start address from hex to int
|
|
num_bytes = int(args[1], 16) # Convert number of bytes from hex to int
|
|
pattern = int(args[2], 16) # Convert pattern from hex to int
|
|
|
|
for i in range(num_bytes):
|
|
gdb.execute("set *((char*)%d + %d) = %d" % (start_address, i, pattern))
|