Skip to content

Commit 159d7d4

Browse files
committed
doc: fix typos and test errors
1 parent 28ecdf8 commit 159d7d4

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

pwnlib/gdb.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -1078,18 +1078,19 @@ def attach(target, gdbscript = '', exe = None, gdb_args = None, ssh = None, sysr
10781078
b'This will be echoed back\n'
10791079
>>> io.close()
10801080
1081-
As for attaching to remote gdbserver, assuming you have a socat server delivering
1082-
gdbserver: ``socat TCP-LISTEN:1336,reuseaddr,fork 'EXEC:"gdbserver :1337 /bin/bash"'``,
1083-
we can connect to gdbserver and attach to it: (Note that when connection with gdbserver
1084-
established, ``/bin/bash`` will stop at _start, waiting our gdb to attach.)
1085-
1086-
>>> io = remote('127.0.0.1', 1336)
1087-
>>> _ = gdb.attach(('127.0.0.1', 1337), exe='/bin/bash')
1081+
To attach to remote gdbserver, assume you have a socat server delivering gdbserver
1082+
with ``socat TCP-LISTEN:1336,reuseaddr,fork 'EXEC:"gdbserver :1337 /bin/bash"'``,
1083+
then you can connect to gdbserver and attach to it by:
1084+
(When connection with gdbserver established, ``/bin/bash`` will pause at ``_start``,
1085+
waiting for our gdb to attach.)
1086+
1087+
>>> io = remote('127.0.0.1', 1336) # doctest: +SKIP
1088+
>>> _ = gdb.attach(('127.0.0.1', 1337), exe='/bin/bash') # doctest: +SKIP
10881089
>>> # press 'c' in gdb then
1089-
>>> io.sendline(b'echo Hello')
1090-
>>> io.recvline()
1090+
>>> io.sendline(b'echo Hello') # doctest: +SKIP
1091+
>>> io.recvline() # doctest: +SKIP
10911092
b'Hello\n'
1092-
>>> io.close()
1093+
>>> io.close() # doctest: +SKIP
10931094
"""
10941095
if context.noptrace:
10951096
log.warn_once("Skipping debug attach since context.noptrace==True")

0 commit comments

Comments
 (0)