-
-
Notifications
You must be signed in to change notification settings - Fork 710
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
gef-remote
broken
#685
Comments
ok, this is the issue (or at least one of them):
one detail I don't quite understand in the code is why the executable gets downloaded twice anyway (gdb automatically does that when executing EDIT: Line 6168 in 48a9fd7
gdb .
|
the solution appears to be quite simple: move that line down to after |
I created a PR for it but it is still missing better tests. I have to come up with something but I need to do some other things first. EDIT: EDIT: |
I am not sure how to go about testing |
We have a docker container for a reason. It can be annoying managing subprocesses like this, but gef remote has regressed before. I think it's worth adding tests. I've seen some nice integration tests that actually manage individual containers. We might not need that, but I think subprocess calls to a remote is a reasonable start, especially if we don't need to worry about getting anything back from the gdbserver call. |
so something like this? def test_cmd_gef_remote(self):
def start_gdbserver(exe, port=1234):
return subprocess.Popen(["gdbserver", ":{}".format(port), exe], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
def stop_gdbserver(gdbserver):
""" stops the gdbserver and waits until it is terminated if it was still running. Needed to make the used port available again """
if gdbserver.poll() is None:
gdbserver.kill()
gdbserver.wait()
return
# For each test something like:
gdbserver = start_gdbserver("/some/path")
# ... e.g. res = gdb_start_silent_cmd("vmmap", before=["gef-remote :1234]"])
# self.assertNotException(res)
stop_gdbserver(gdbserver)) EDIT: this implies that |
@Grazfather what do you think of my suggested way of testing? |
Yep! That works, at least as a stop gap. In the future we can mount the docker sock into the container of the test runner so that that container itself can start and stop containers as needed. If gdbserver isn't already in the container we can just add it. |
dev
branch?gdb -nx
the closed ones) - and the PR?
Environment
Problem
gef-remote
command is broken. Instead of downloading the executable it downloads a invalid memory map of the binary as ASCII text. Furthermore that breaks all kind of other commands in a remote debugging session up to the point where debugging is not possible.Steps to reproduce and minimalist test case
gdbserver localhost:1337 ./test
gdb -q -ex "gef-remote localhost:1337"
file /tmp/gef/<PID>/</path/to/test>
Example Output:
Observed Results
Sometimes you can still step through the binary and sometimes everything crashes and
gdb
/GEF has to be killed.Expected results
Some nice debugging sessions
Reason
Yet another fault caused by the new argparsing.
git bisect
reveals that the error was introduced in commit 782dd88 .It appears better tests are also needed here to prevent such a regression next time around :)
The text was updated successfully, but these errors were encountered: