9
votes

I am using the "layout src" tui feature within gdb (amazing if you haven't used it) which allows you to step through the source code, showing the surrounding code in the terminal whilst you step through.

However, occasionally/bordering on frequently I encounter an issue where the terminal output becomes corrupted. The output on the screen becomes mixed, with source code from previous and current stack frames showing. I have seen this on Red Hat 6.5 and CentOS 6. The GDB version is 7.11

The latest instance of this occurring (5 mins ago) seems to have been triggered when I stepped over code which output to the screen.

I have seen this problem in various different code bases, at different companies and its a shame because the gdb tui mode is very helpful.

Does anyone know how to fix this/what causes it?

1
Try refresh command or CTRL+L. This is known issue when program output is getting mixed with tui output.ks1322
Is this what you are seeing: stackoverflow.com/questions/4021329/…?ks1322
@ks1322 thanks, that did it! Put it as an answer and i'll accept.user997112

1 Answers

8
votes

What you describe is likely a known issue when program output is getting mixed with tui output. When this happens you can "fix" tui windows by refreshing them either using command refresh or CTRL+L keyboard shortcut. See documentation:

refresh

    Refresh the screen. This is similar to typing C-L.