• Hayato Ito's avatar
    Let gdbinit work in Python 3 · 4eac52c7
    Hayato Ito authored
    This is a quick fix for tools/gdb/gdbinit so it can be used in Python 3 environment too.
    
    I don't think we need to support Python 3 in chromium development environment, however,
    this is a very small fix so it could be okay.
    
    The issue what this CL fixes is:
    
    If user's `gdb` embeds Python 3, instead of Python 2, tools/gdb/gdbinit fails as follows:
    
    Traceback (most recent call last):
      File "<string>", line 61, in newobj_handler
      File "<string>", line 35, in load_libcxx_pretty_printers
      File "/usr/lib/python3.5/posixpath.py", line 89, in join
        genericpath._check_arg_types('join', a, *p)
      File "/usr/lib/python3.5/genericpath.py", line 145, in _check_arg_types
        raise TypeError("Can't mix strings and bytes in path components") from None
    TypeError: Can't mix strings and bytes in path components
    
    The reason of the failure is that stdout of subprocess is |byte|, instead of |string|,
    and Python 3 doesn't allow mixing strings and bytes in the following |os.path.join|.
    We have to convert |byte| to |str| explicitly in Python 3, which is harmless in Python 2.
    
    Change-Id: I5e66be86b61f8e715dc0c2165eb7c427b56d648b
    Reviewed-on: https://chromium-review.googlesource.com/c/1338593Reviewed-by: default avatarTakuto Ikuta <tikuta@chromium.org>
    Commit-Queue: Hayato Ito <hayato@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#608678}
    4eac52c7
gdbinit 2.07 KB