Bug 506382: Be more lenient with GDB protocol error

Due to a GDB bug present in numerous versions of GDB
https://sourceware.org/bugzilla/show_bug.cgi?id=19637
CDT can fail to display advanced memory info and
registers view properly.

This fix is more lenient, and if the user really wants
to see the registers, a workaround for GDB's bug is linked
to.

Change-Id: Ia78947e29a1e446837ef992d470dfd14f047bda2
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
index 7d13bc5..94b9b86 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIRegisters.java
@@ -22,6 +22,7 @@
 import java.util.Map;
 
 import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
 import org.eclipse.cdt.dsf.concurrent.ImmediateDataRequestMonitor;
 import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
 import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
@@ -353,9 +354,13 @@
                         MIRegisterValue[] regValue = getData().getMIRegisterValues();
     
                         // If the list is empty just return empty handed.
+                        // The only known case this happens is caused by a bug in GDB's Python
+                        // scripts. See https://sourceware.org/bugzilla/show_bug.cgi?id=19637
+                        // In this case, we know the register name anyway, we just guess that
+                        // it is not floating point. The matching code in getRegisterDataValue()
+                        // displays the error with link to a workaround
                         if (regValue.length == 0) {
-                            assert false : "Backend protocol error"; //$NON-NLS-1$
-                            //done.setStatus(new Status(IStatus.ERROR, IDsfStatusConstants.INTERNAL_ERROR ,));
+                            rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, false));
                             rm.done();
                             return;
                         }
@@ -411,9 +416,14 @@
                     MIRegisterValue[] regValue = getData().getMIRegisterValues();
 
                     // If the list is empty just return empty handed.
+                    // The only known case this happens is caused by a bug in GDB's Python
+                    // scripts. See https://sourceware.org/bugzilla/show_bug.cgi?id=19637
+                    // In the display data, we show link to Eclipse Bugzilla entry which has
+                    // a comment on how to fix this manually.
                     if (regValue.length == 0) {
-                        assert false : "Backend protocol error"; //$NON-NLS-1$
-                        //done.setStatus(new Status(IStatus.ERROR, IDsfStatusConstants.INTERNAL_ERROR ,));
+                        rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
+                                IDsfStatusConstants.REQUEST_FAILED,
+                                "Encountered a GDB Error See http://eclip.se/506382#c7 for workarounds", null)); //$NON-NLS-1$
                         rm.done();
                         return;
                     }