1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

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
This commit is contained in:
Jonah Graham 2016-11-20 11:00:27 +00:00 committed by Gerrit Code Review @ Eclipse.org
parent 352f47bc82
commit 01b791031c

View file

@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; 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.ImmediateDataRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor; import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor; import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
@ -353,9 +354,13 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
MIRegisterValue[] regValue = getData().getMIRegisterValues(); MIRegisterValue[] regValue = getData().getMIRegisterValues();
// If the list is empty just return empty handed. // 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) { if (regValue.length == 0) {
assert false : "Backend protocol error"; //$NON-NLS-1$ rm.setData(new RegisterData(frameDmc, miRegDmc.getName(), BLANK_STRING, false));
//done.setStatus(new Status(IStatus.ERROR, IDsfStatusConstants.INTERNAL_ERROR ,));
rm.done(); rm.done();
return; return;
} }
@ -411,9 +416,14 @@ public class MIRegisters extends AbstractDsfService implements IRegisters, ICach
MIRegisterValue[] regValue = getData().getMIRegisterValues(); MIRegisterValue[] regValue = getData().getMIRegisterValues();
// If the list is empty just return empty handed. // 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) { if (regValue.length == 0) {
assert false : "Backend protocol error"; //$NON-NLS-1$ rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID,
//done.setStatus(new Status(IStatus.ERROR, IDsfStatusConstants.INTERNAL_ERROR ,)); IDsfStatusConstants.REQUEST_FAILED,
"Encountered a GDB Error See http://eclip.se/506382#c7 for workarounds", null)); //$NON-NLS-1$
rm.done(); rm.done();
return; return;
} }