prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  xuntil doesn't work with PIE binaries before being run
  `xuntil` was added in #604 and works except that it doesn't work with PIE binaries before being run.
  This is because it expects an int argument. I'll look into using sloppy parsing.
  
  </issue>
  <code>
  [start of pwndbg/commands/peda.py]
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 from __future__ import absolute_import
  4 from __future__ import division
  5 from __future__ import print_function
  6 from __future__ import unicode_literals
  7 
  8 import argparse
  9 import sys
  10 
  11 import gdb
  12 
  13 import pwndbg.auxv
  14 import pwndbg.color.message as message
  15 import pwndbg.commands
  16 import pwndbg.commands.context
  17 import pwndbg.commands.telescope
  18 import pwndbg.proc
  19 
  20 
  21 @pwndbg.commands.ArgparsedCommand("Gets the current file.")
  22 @pwndbg.commands.OnlyWhenRunning
  23 def getfile():
  24     print(repr(pwndbg.auxv.get().AT_EXECFN))
  25 
  26 @pwndbg.commands.ArgparsedCommand("Get the pid.")
  27 @pwndbg.commands.OnlyWhenRunning
  28 def getpid():
  29     print(pwndbg.proc.pid)
  30 
  31 
  32 parser = argparse.ArgumentParser(description='Continue execution until an address or function.')
  33 parser.add_argument('target', help='Address or function to stop execution at')
  34 
  35 
  36 @pwndbg.commands.ArgparsedCommand(parser)
  37 def xuntil(target):
  38     addr = int(target)
  39 
  40     if not pwndbg.memory.peek(addr):
  41         print(message.error('Invalid address %#x' % addr))
  42         return
  43 
  44     spec = "*%#x" % (addr)
  45     b = gdb.Breakpoint(spec, temporary=True)
  46     if pwndbg.proc.alive:
  47         gdb.execute("continue", from_tty=False)
  48     else:
  49         gdb.execute("run", from_tty=False)
  50 
  51 xinfo = pwndbg.commands.context.context
  52 xprint = pwndbg.commands.telescope.telescope
  53
  [end of pwndbg/commands/peda.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/pwndbg/commands/peda.py b/pwndbg/commands/peda.py
  --- a/pwndbg/commands/peda.py
  +++ b/pwndbg/commands/peda.py
  @@ -30,18 +30,27 @@
   
   
   parser = argparse.ArgumentParser(description='Continue execution until an address or function.')
  -parser.add_argument('target', help='Address or function to stop execution at')
  -
  +parser.add_argument('target', type=str, help='Address or function to stop execution at')
   
   @pwndbg.commands.ArgparsedCommand(parser)
   def xuntil(target):
  -    addr = int(target)
  -
  -    if not pwndbg.memory.peek(addr):
  -        print(message.error('Invalid address %#x' % addr))
  -        return
  +    try:
  +        addr = int(target,0)
  +        
  +        if not pwndbg.memory.peek(addr):
  +            print(message.error('Invalid address %#x' % addr))
  +            return
  +
  +        spec = "*%#x" % (addr)
  +    except (TypeError, ValueError):
  +        #The following gdb command will throw an error if the symbol is not defined.
  +        try:
  +            result = gdb.execute('info address %s' % target, to_string=True, from_tty=False)
  +        except gdb.error:
  +            print(message.error("Unable to resolve %s" % target))
  +            return    
  +        spec = target
   
  -    spec = "*%#x" % (addr)
       b = gdb.Breakpoint(spec, temporary=True)
       if pwndbg.proc.alive:
           gdb.execute("continue", from_tty=False)
  
verification_info: {"golden_diff": "diff --git a/pwndbg/commands/peda.py b/pwndbg/commands/peda.py\n--- a/pwndbg/commands/peda.py\n+++ b/pwndbg/commands/peda.py\n@@ -30,18 +30,27 @@\n \n \n parser = argparse.ArgumentParser(description='Continue execution until an address or function.')\n-parser.add_argument('target', help='Address or function to stop execution at')\n-\n+parser.add_argument('target', type=str, help='Address or function to stop execution at')\n \n @pwndbg.commands.ArgparsedCommand(parser)\n def xuntil(target):\n-    addr = int(target)\n-\n-    if not pwndbg.memory.peek(addr):\n-        print(message.error('Invalid address %#x' % addr))\n-        return\n+    try:\n+        addr = int(target,0)\n+        \n+        if not pwndbg.memory.peek(addr):\n+            print(message.error('Invalid address %#x' % addr))\n+            return\n+\n+        spec = \"*%#x\" % (addr)\n+    except (TypeError, ValueError):\n+        #The following gdb command will throw an error if the symbol is not defined.\n+        try:\n+            result = gdb.execute('info address %s' % target, to_string=True, from_tty=False)\n+        except gdb.error:\n+            print(message.error(\"Unable to resolve %s\" % target))\n+            return    \n+        spec = target\n \n-    spec = \"*%#x\" % (addr)\n     b = gdb.Breakpoint(spec, temporary=True)\n     if pwndbg.proc.alive:\n         gdb.execute(\"continue\", from_tty=False)\n", "issue": "xuntil doesn't work with PIE binaries before being run\n`xuntil` was added in #604 and works except that it doesn't work with PIE binaries before being run.\r\nThis is because it expects an int argument. I'll look into using sloppy parsing.\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport argparse\nimport sys\n\nimport gdb\n\nimport pwndbg.auxv\nimport pwndbg.color.message as message\nimport pwndbg.commands\nimport pwndbg.commands.context\nimport pwndbg.commands.telescope\nimport pwndbg.proc\n\n\n@pwndbg.commands.ArgparsedCommand(\"Gets the current file.\")\n@pwndbg.commands.OnlyWhenRunning\ndef getfile():\n    print(repr(pwndbg.auxv.get().AT_EXECFN))\n\n@pwndbg.commands.ArgparsedCommand(\"Get the pid.\")\n@pwndbg.commands.OnlyWhenRunning\ndef getpid():\n    print(pwndbg.proc.pid)\n\n\nparser = argparse.ArgumentParser(description='Continue execution until an address or function.')\nparser.add_argument('target', help='Address or function to stop execution at')\n\n\n@pwndbg.commands.ArgparsedCommand(parser)\ndef xuntil(target):\n    addr = int(target)\n\n    if not pwndbg.memory.peek(addr):\n        print(message.error('Invalid address %#x' % addr))\n        return\n\n    spec = \"*%#x\" % (addr)\n    b = gdb.Breakpoint(spec, temporary=True)\n    if pwndbg.proc.alive:\n        gdb.execute(\"continue\", from_tty=False)\n    else:\n        gdb.execute(\"run\", from_tty=False)\n\nxinfo = pwndbg.commands.context.context\nxprint = pwndbg.commands.telescope.telescope\n", "path": "pwndbg/commands/peda.py"}]}