diff --git a/pwnlib/data/templates/pwnup.mako b/pwnlib/data/templates/pwnup.mako index 81307d12b..4e85cd88e 100644 --- a/pwnlib/data/templates/pwnup.mako +++ b/pwnlib/data/templates/pwnup.mako @@ -132,9 +132,9 @@ def start(argv=[], *a, **kw): gdbscript = ''' %if ctx.binary: %if 'main' in ctx.binary.symbols: -break *0x{exe.symbols.main:x} - %else: -break *0x{exe.entry:x} +tbreak main + %elif 'DYN' != ctx.binary.elftype: +tbreak *0x{exe.entry:x} %endif %endif continue diff --git a/pwnlib/gdb.py b/pwnlib/gdb.py index 5bd866a58..b0a15b364 100644 --- a/pwnlib/gdb.py +++ b/pwnlib/gdb.py @@ -464,9 +464,9 @@ def debug(args, gdbscript=None, exe=None, ssh=None, env=None, sysroot=None, **kw # gdbserver outputs a message when a client connects garbage = gdbserver.recvline(timeout=1) - - if "Remote debugging from host" not in garbage: - gdbserver.unrecv(garbage) + + # Some versions of gdbserver output an additional message + garbage2 = gdbserver.recvline_startswith("Remote debugging from host ", timeout=1) return gdbserver