-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User-specified offset #57
Comments
This is what I currently came up with: import subprocess
import tempfile
# To use, add source /path/to/script.py to your $HOME/.gdbinit file.
class Hexyl(gdb.Command):
"""
Run hexyl on provided symbol/address. Takes the number of bytes to print as an optional parameter
"""
def __init__(self):
super(Hexyl, self).__init__("hexyl", gdb.COMMAND_USER)
self.long_int = gdb.lookup_type("long")
def invoke(self, arg, from_tty):
argv = gdb.string_to_argv(arg)
count = 0x100
if argv and len(argv) > 0:
address = argv[0]
if len(argv) > 1:
count = argv[1]
else:
address = "$sp"
with tempfile.NamedTemporaryFile(suffix='.bin', delete=True) as f:
gdb.execute("dump binary memory %s %s (%s + %s)" % (f.name, address, address, count))
subprocess.call(["hexyl", f.name])
return False
Hexyl() Usage:
|
Thank you very much for your feedback! Integrating Can you go into a little bit more detail what kind of feature you would like to see in |
A parameter that allows to add an offset to the number reported by hexyl on the left-side would be sufficient. This way the addresses by gdb would match up with hexyl offsets. This would useful for cases where we only pass a subset of the data to hexyl, which is not limited to GDB. |
Ok, so this would be similar to |
So, if I understand it correctly, this is just a display option, right? i.e. hexyl still reads the binary from the start of the file, but it display them as if the file is started from a certain virtual address. For example: File content:
|
closed via #72 by @tommilligan |
I would like to integrate hexyl in GDB using the python API. Therefore it would be useful if I could supply a different offset, so that input offsets in hexyl matches with the addresses in virtual memory in the process.
The text was updated successfully, but these errors were encountered: