gdbgui icon indicating copy to clipboard operation
gdbgui copied to clipboard

gdbgui fails with an unhandled UnicodeDecodeError

Open j-mckim opened this issue 4 years ago • 1 comments

When debugging some c++ code via gdbgui, gdbgui ceases to work and I get a popup informing that "The connection to the gdb session has been closed. This tab will no longer function as expected". I have to restart gdbgui to recover.

The terminal in which gdbgui is running offers these diagnostics:

'utf-8' codec can't decode byte 0x90 in position 2006: invalid start byte Traceback (most recent call last): File "/home/jim/.local/pipx/venvs/gdbgui/lib/python3.8/site-packages/gdbgui/server/app.py", line 284, in check_and_forward_pty_output response = debug_session.pty_for_debugged_program.read() File "/home/jim/.local/pipx/venvs/gdbgui/lib/python3.8/site-packages/gdbgui/server/ptylib.py", line 78, in read response = os.read(self.stdout, self.max_read_bytes).decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2006: invalid start byte

Patching the relevant section in ptylib.py to intercept that error as demonstrated in the attached patch prevents the utf8 conversion issue from crashing gdbgui. But maybe there's a better fix I'm not aware of.

ptylib.patch.txt

j-mckim avatar Nov 08 '21 15:11 j-mckim

Can you create a PR with that, please?

GitMensch avatar Dec 30 '21 21:12 GitMensch