From 01b791031c53c8ccb51f55b9bf92048667a1b7a8 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Sun, 20 Nov 2016 11:00:27 +0000 Subject: [PATCH] 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 --- .../cdt/dsf/mi/service/MIRegisters.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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 7d13bc5477e..94b9b865bf3 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.List; 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 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach 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 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach 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; }