-
-
Notifications
You must be signed in to change notification settings - Fork 803
Use target remote for remote connections
#1151
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
Open
hugsy
wants to merge
43
commits into
main
Choose a base branch
from
hugsy/revisit-target-remote
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 25 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
d28c4a3
added ruff linter + fixes
hugsy cde95b3
checkpoint
hugsy b83586e
removed `Set` and `Tuple` types (replaced with `tuple` and `set`)
hugsy 32311d7
`Union` type -> `|`
hugsy 741ce7c
removed Tuple in tests
hugsy 854912b
Merge branch 'main' into hugsy/lint-fmt
hugsy f47f51e
fixed type typo
hugsy d5d544d
`Optional` is optional
hugsy 60be6a1
fixed ruff toml
hugsy dc28938
revert changes, only focus on py3.10 improvements
hugsy 417ac63
final fixes
hugsy 9fb1d71
added `untracked` dir to gitignore
hugsy a277661
checkpoint: added new remote modes, gdbserver & gdbserver-multi work
hugsy 6d166f0
checkpoint: added very basic pytests
hugsy 771a598
removed all obsolete code
hugsy 79447be
fixed `gef-remote` from tests, using only `target remote`
hugsy ea873bb
use `NotImplementedError`
hugsy 4ae683f
plop
hugsy 8130895
minor lint
hugsy 7973a3f
allow mock mem layout for old qemu versions
hugsy 8cc2231
added repr for Gef class
hugsy 2ba9ac7
[tests] use `gdb-multiarch` by default
hugsy 437cbe2
added regression for issue #1131
hugsy e5a02b1
constantify all the things
hugsy 68fcc1d
officially deprecating `gef-remote`
hugsy e8527ad
duplicate test line
hugsy 14c35bd
allow gef to save temporary values
hugsy 03f9cf9
Merge branch 'main' into hugsy/revisit-target-remote
hugsy 2a5c585
test fix
hugsy 36c953c
oops
hugsy 68505a6
bleh
hugsy 02af4d4
revert
hugsy c89c280
damnit
hugsy 77aa954
restored gdb-multiarch as default for tests
hugsy 1d9f897
minor
hugsy 623ebf1
test
hugsy 532e45d
asd
hugsy fd0bf0a
Merge branch 'hugsy/revisit-target-remote' of https://github.com/hugs…
hugsy d262ca5
Merge branch 'main' into hugsy/revisit-target-remote
hugsy 7a9e494
Update generate-coverage-docs.sh
hugsy b9f564f
Update generate-coverage-docs.sh
hugsy 7ea8588
Update coverage.yml
hugsy 7d2ef17
Merge branch 'main' into hugsy/revisit-target-remote
hugsy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ debug.log | |
| htmlcov | ||
| .benchmarks | ||
| site/ | ||
| untracked/ | ||
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [lint.per-file-ignores] | ||
| "gef.py" = ["E701"] |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| """ | ||
| `target remote/extended-remote` test module. | ||
| """ | ||
|
|
||
|
|
||
| from tests.base import RemoteGefUnitTestGeneric | ||
| from tests.utils import debug_target, gdbserver_session, gdbserver_multi_session, get_random_port, qemuuser_session | ||
|
|
||
|
|
||
| class GefRemoteApi(RemoteGefUnitTestGeneric): | ||
|
|
||
| def setUp(self) -> None: | ||
| self._target = debug_target("default") | ||
| return super().setUp() | ||
|
|
||
| def test_gef_remote_test_gdbserver(self): | ||
| """Test `gdbserver file`""" | ||
| _gdb = self._gdb | ||
| _gef = self._gef | ||
| _root = self._conn.root | ||
| port = get_random_port() | ||
|
|
||
| with gdbserver_session(port=port): | ||
| assert not _root.eval("is_target_remote()") | ||
| assert not _root.eval("is_target_remote_or_extended()") | ||
| assert not _root.eval("is_running_in_gdbserver()") | ||
| assert not _root.eval("is_running_in_rr()") | ||
| assert not _root.eval("is_running_in_qemu()") | ||
|
|
||
| _gdb.execute(f"target remote :{port}") | ||
|
|
||
| assert _root.eval("is_target_remote()") | ||
| assert _root.eval("is_target_remote_or_extended()") | ||
| assert _root.eval("is_running_in_gdbserver()") | ||
| assert _root.eval("is_running_in_gdbserver()") | ||
hugsy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| assert not _root.eval("is_target_extended_remote()") | ||
| assert not _root.eval("is_running_in_qemu()") | ||
| assert not _root.eval("is_running_in_qemu_system()") | ||
| assert not _root.eval("is_running_in_qemu_user()") | ||
| assert not _root.eval("is_running_in_rr()") | ||
|
|
||
| assert hasattr(_gef.session, "remote") | ||
| assert "GDBSERVER" in str(_gef.session.remote) | ||
| assert "GDBSERVER_MULTI" not in str(_gef.session.remote) | ||
|
|
||
| def test_gef_remote_test_gdbserver_multi(self): | ||
| """Test `gdbserver --multi file`""" | ||
| _gdb = self._gdb | ||
| _gef = self._gef | ||
| _root = self._conn.root | ||
| port = get_random_port() | ||
|
|
||
| with gdbserver_multi_session(port=port): | ||
| assert not _root.eval("is_target_remote()") | ||
| assert not _root.eval("is_target_remote_or_extended()") | ||
| assert not _root.eval("is_running_in_gdbserver()") | ||
| assert not _root.eval("is_running_in_rr()") | ||
| assert not _root.eval("is_running_in_qemu()") | ||
|
|
||
| _gdb.execute(f"target extended-remote :{port}") | ||
| _gdb.execute(f"set remote exec-file {self._target}") | ||
| _gdb.execute(f"file {self._target}") | ||
| _gdb.execute(f"start {self._target}") | ||
|
|
||
| assert _root.eval("is_target_remote_or_extended()") | ||
| assert _root.eval("is_target_extended_remote()") | ||
| assert _root.eval("is_running_in_gdbserver()") | ||
| assert not _root.eval("is_target_remote()") | ||
|
|
||
| assert not _root.eval("is_running_in_qemu()") | ||
| assert not _root.eval("is_running_in_qemu_system()") | ||
| assert not _root.eval("is_running_in_qemu_user()") | ||
| assert not _root.eval("is_running_in_rr()") | ||
|
|
||
| assert hasattr(_gef.session, "remote") | ||
| assert "GDBSERVER_MULTI" in str(_gef.session.remote) | ||
|
|
||
| def test_gef_remote_test_qemuuser(self): | ||
| """Test `qemu-user -g`""" | ||
| _gdb = self._gdb | ||
| _gef = self._gef | ||
| _root = self._conn.root | ||
| port = get_random_port() | ||
|
|
||
| with qemuuser_session(port=port): | ||
| assert not _root.eval("is_target_remote()") | ||
| assert not _root.eval("is_target_remote_or_extended()") | ||
| assert not _root.eval("is_running_in_gdbserver()") | ||
|
|
||
| _gdb.execute(f"target remote :{port}") | ||
|
|
||
| assert _root.eval("is_target_remote()") | ||
| assert _root.eval("is_target_remote_or_extended()") | ||
| assert _root.eval("is_running_in_qemu()") | ||
| assert _root.eval("is_running_in_qemu_user()") | ||
|
|
||
| assert not _root.eval("is_target_extended_remote()") | ||
| assert not _root.eval("is_running_in_qemu_system()") | ||
| assert not _root.eval("is_running_in_gdbserver()") | ||
| assert not _root.eval("is_running_in_rr()") | ||
|
|
||
| assert hasattr(_gef.session, "remote") | ||
| assert "QEMU_USER" in str(_gef.session.remote) | ||
|
|
||
| # TODO add tests for | ||
| # - [ ] qemu-system | ||
| # - [ ] rr | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I guess it'll be the next release