-
Notifications
You must be signed in to change notification settings - Fork 48
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
GDB: Improve tools to debug vm structures #1396
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks left. What do you think about employing argparse
to parse arguments in __call__
method. It'd be nice if help user-defined
showed all subcommands, so the user does not have to consult the source code to know how to use a command.
if arch in gdb.architecture_names(): | ||
return arch | ||
print('Current architecture is not supported') | ||
raise KeyError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not it be NotImplementedError
?
def __init__(self, pmap): | ||
self._pmap = pmap | ||
|
||
def print(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't plan to add more methods to the class in this PR I suggest you convert it to a function. Right now the class looks like an overkill.
class PageTableAArch64(): | ||
def __init__(self, pmap): | ||
self._pmap = pmap | ||
print("Page table not implemented for AArch64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise NotImplementedError
?
|
||
|
||
def _segment_info(proc, segment): | ||
MAX_SEGMENT_ID = 4096 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be a global variable?
@property | ||
def pages(self): | ||
size = self.end - self.start | ||
return size // 4096 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe define global variable PAGESIZE
?
In this PR I move all commands that operate on VM structures to be subcommands of
vm
command and create new onesCommands added in this PR
vm map
-- (replacekdump vm_map
) and interpret optional argument - pid of process we want to see the vm mapvm pmap_kernel
-- (replacekdump pmap
)vm pmap_user
-- dump pmap of specified proc (for current if not specified)vm segment
-- see info about specified segment in current procvm_map
vm segment_proc
-- see info about specified segment invm_map
of proc specified by pidvm freepages
-- (replacekdump freepages
)vm physseg
-- (replacekdump physseg
)