GDB: Improve tools to debug vm structures#1396
Open
franciscozdo wants to merge 8 commits intocahirwpz:masterfrom
Open
GDB: Improve tools to debug vm structures#1396franciscozdo wants to merge 8 commits intocahirwpz:masterfrom
franciscozdo wants to merge 8 commits intocahirwpz:masterfrom
Conversation
Merged
cahirwpz
reviewed
Aug 3, 2023
cahirwpz
reviewed
Aug 8, 2023
Owner
cahirwpz
left a comment
There was a problem hiding this comment.
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 |
Owner
There was a problem hiding this comment.
Should not it be NotImplementedError ?
| def __init__(self, pmap): | ||
| self._pmap = pmap | ||
|
|
||
| def print(self): |
Owner
There was a problem hiding this comment.
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") |
|
|
||
|
|
||
| def _segment_info(proc, segment): | ||
| MAX_SEGMENT_ID = 4096 |
Owner
There was a problem hiding this comment.
Shouldn't that be a global variable?
| @property | ||
| def pages(self): | ||
| size = self.end - self.start | ||
| return size // 4096 |
Owner
There was a problem hiding this comment.
Maybe define global variable PAGESIZE ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR I move all commands that operate on VM structures to be subcommands of
vmcommand 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_mapvm segment_proc-- see info about specified segment invm_mapof proc specified by pidvm freepages-- (replacekdump freepages)vm physseg-- (replacekdump physseg)