prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  "show print elements 0" causes exceptions on stop
  ```
  pwndbg> show print elements
  Limit on string chars or array elements to print is unlimited.
  Traceback (most recent call last):
    File "/home/david/.pwndbg/pwndbg/events.py", line 111, in caller
      func()
    File "/home/david/.pwndbg/pwndbg/strings.py", line 34, in update_length
      length  = int(message)
    File "/home/david/.pwndbg/pwndbg/inthook.py", line 44, in __new__
      return _int(_int(value, *a, **kw))
  ValueError: invalid literal for int() with base 10: 'unlimited'
  Python Exception <class 'ValueError'> invalid literal for int() with base 10: 'unlimited': 
  ```
  
  </issue>
  <code>
  [start of pwndbg/strings.py]
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 """
  4 Functionality for resolving ASCII printable strings within
  5 the debuggee's address space.
  6 """
  7 from __future__ import absolute_import
  8 from __future__ import division
  9 from __future__ import print_function
  10 from __future__ import unicode_literals
  11 
  12 import string
  13 
  14 import gdb
  15 
  16 import pwndbg.events
  17 import pwndbg.memory
  18 import pwndbg.typeinfo
  19 
  20 length = 15
  21 
  22 @pwndbg.events.stop
  23 def update_length():
  24     r"""
  25     Unfortunately there's not a better way to get at this info.
  26 
  27     >>> gdb.execute('show print elements', from_tty=False, to_string=True)
  28     'Limit on string chars or array elements to print is 21.\n'
  29     """
  30     global length
  31     message = gdb.execute('show print elements', from_tty=False, to_string=True)
  32     message = message.split()[-1]
  33     message = message.strip('.')
  34     length  = int(message)
  35 
  36 def get(address, maxlen = None):
  37     if maxlen is None:
  38         maxlen = length
  39 
  40     try:
  41         sz = pwndbg.memory.string(address)
  42         sz = sz.decode('latin-1', 'replace')
  43 
  44         if not sz or not all(s in string.printable for s in sz):
  45             return None
  46     except Exception as e:
  47         return None
  48 
  49     if len(sz) < maxlen:
  50         return sz
  51 
  52     return sz[:maxlen] + '...'
  53
  [end of pwndbg/strings.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/strings.py b/pwndbg/strings.py
  --- a/pwndbg/strings.py
  +++ b/pwndbg/strings.py
  @@ -31,7 +31,10 @@
       message = gdb.execute('show print elements', from_tty=False, to_string=True)
       message = message.split()[-1]
       message = message.strip('.')
  -    length  = int(message)
  +    if message == 'unlimited':
  +        length = 0
  +    else:
  +        length = int(message)
   
   def get(address, maxlen = None):
       if maxlen is None:
  @@ -46,7 +49,7 @@
       except Exception as e:
           return None
   
  -    if len(sz) < maxlen:
  +    if len(sz) < maxlen or not maxlen:
           return sz
   
       return sz[:maxlen] + '...'
  
verification_info: {"golden_diff": "diff --git a/pwndbg/strings.py b/pwndbg/strings.py\n--- a/pwndbg/strings.py\n+++ b/pwndbg/strings.py\n@@ -31,7 +31,10 @@\n     message = gdb.execute('show print elements', from_tty=False, to_string=True)\n     message = message.split()[-1]\n     message = message.strip('.')\n-    length  = int(message)\n+    if message == 'unlimited':\n+        length = 0\n+    else:\n+        length = int(message)\n \n def get(address, maxlen = None):\n     if maxlen is None:\n@@ -46,7 +49,7 @@\n     except Exception as e:\n         return None\n \n-    if len(sz) < maxlen:\n+    if len(sz) < maxlen or not maxlen:\n         return sz\n \n     return sz[:maxlen] + '...'\n", "issue": "\"show print elements 0\" causes exceptions on stop\n```\r\npwndbg> show print elements\r\nLimit on string chars or array elements to print is unlimited.\r\nTraceback (most recent call last):\r\n  File \"/home/david/.pwndbg/pwndbg/events.py\", line 111, in caller\r\n    func()\r\n  File \"/home/david/.pwndbg/pwndbg/strings.py\", line 34, in update_length\r\n    length  = int(message)\r\n  File \"/home/david/.pwndbg/pwndbg/inthook.py\", line 44, in __new__\r\n    return _int(_int(value, *a, **kw))\r\nValueError: invalid literal for int() with base 10: 'unlimited'\r\nPython Exception <class 'ValueError'> invalid literal for int() with base 10: 'unlimited': \r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nFunctionality for resolving ASCII printable strings within\nthe debuggee's address space.\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport string\n\nimport gdb\n\nimport pwndbg.events\nimport pwndbg.memory\nimport pwndbg.typeinfo\n\nlength = 15\n\n@pwndbg.events.stop\ndef update_length():\n    r\"\"\"\n    Unfortunately there's not a better way to get at this info.\n\n    >>> gdb.execute('show print elements', from_tty=False, to_string=True)\n    'Limit on string chars or array elements to print is 21.\\n'\n    \"\"\"\n    global length\n    message = gdb.execute('show print elements', from_tty=False, to_string=True)\n    message = message.split()[-1]\n    message = message.strip('.')\n    length  = int(message)\n\ndef get(address, maxlen = None):\n    if maxlen is None:\n        maxlen = length\n\n    try:\n        sz = pwndbg.memory.string(address)\n        sz = sz.decode('latin-1', 'replace')\n\n        if not sz or not all(s in string.printable for s in sz):\n            return None\n    except Exception as e:\n        return None\n\n    if len(sz) < maxlen:\n        return sz\n\n    return sz[:maxlen] + '...'\n", "path": "pwndbg/strings.py"}]}