Fix a crash when gdb produces malformed output.
ClosedPublic

Authored by qi437103 on Feb 22 2017, 12:40 AM.

Details

Summary

Fix a crash when gdb produces malformed output. The crash was reported in https://bugs.kde.org/show_bug.cgi?id=376595.

It is actually a bug in gdb which can't handle invalid/out-of-scope watchpoints gracefully.

Instead of assert and crash the whole IDE, debugger errors are now reported to the user in a dialog.
And debug session will automatically end in this case.

Test Plan

A minimal test case from the reporter: https://bugs.kde.org/show_bug.cgi?id=376595#c20

Diff Detail

Repository
R32 KDevelop
Branch
debugger-error-handling
Lint
No Linters Available
Unit
No Unit Test Coverage
qi437103 created this revision.Feb 22 2017, 12:40 AM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptFeb 22 2017, 12:40 AM
qi437103 updated this revision to Diff 11611.Feb 22 2017, 12:47 AM

Simplify a bit

kfunk accepted this revision.Feb 22 2017, 8:49 AM
kfunk added a subscriber: kfunk.

LGTM, I just hope this doesn't lead to lots of undesired debugger exits? In other words, those 'wild replies' as you name them are very rare?

This revision is now accepted and ready to land.Feb 22 2017, 8:49 AM

I name it after "wild pointer" because both of them are dangling around :P

In most of the cases the whole IDE simply crashes, so the debug session can't continue anyway. There's one change of behavior though. Before this patch, KDevelop will ignore the reply without a pending command if the reply is a done/running. Now this will be reported and cause an exit of the debug session.

None of these should ever happen in theory, but if they do, some thing must be wrong in kdevelop or the debugger. So I think it's better to inform the user and encourage a bug report.

By the way, is it ok to land to 5.1 branch? Or maybe master is better?

kfunk added a comment.Feb 22 2017, 8:29 PM

By the way, is it ok to land to 5.1 branch? Or maybe master is better?

5.1 if it fixes crashes, for sure!

qi437103 closed this revision.Feb 22 2017, 8:32 PM