-
Notifications
You must be signed in to change notification settings - Fork 21
Snippets
For the good and lazy programmers, this section documents the library following the approach "a function - an example".
For every features exposed by the library you will find a brief explanation and an example of how to use it. Let's start.
This function try to read from the process memory an ascii string, no longer than count bytes. So you can provide a large count value since the function recognizes the NULL terminating character.
Example:
rax_address = gdb.parse_and_eval("$rax")
string = gdb_utils.read_string(rax_address, 1024)
print string
In the example we first read the address of the string pointed by RAX register, and then read the actual string passing the numeric address to the function. The result can be safely printed.
This is perhaps the most important function of the library, on which the majority of the other functions are built.
Its behavior is very similar to gdb.execute(), since both functions allow to execute a GDB command, but execute_output also returns the output of the command.