From a08cc01f5652940139be3074fafc335b194bc695 Mon Sep 17 00:00:00 2001 From: John Dallaway Date: Fri, 17 Nov 2017 21:15:59 +0000 Subject: [PATCH] Bug 527419: Process async output with no variable Change-Id: I4deb2b9db4421016b27e01353b0ae4745b139361 Signed-off-by: John Dallaway --- .../mi/service/command/output/MIParser.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java index d7812f10279..464f2828be9 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. + * Copyright (c) 2000, 2017 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,6 +9,7 @@ * QNX Software Systems - Initial API and implementation * Wind River Systems - Modified for new DSF Reference Implementation * Mathias Kunter - Don't always parse backslashes (Bug 367456, Bug 307311) + * John Dallaway - Process async output with no variable (Bug 527419) *******************************************************************************/ package org.eclipse.cdt.dsf.mi.service.command.output; @@ -283,19 +284,22 @@ public class MIParser { MIResult result = new MIResult(); int equal; if (buffer.length() > 0 && Character.isLetter(buffer.charAt(0)) && (equal = buffer.indexOf('=')) != -1) { + // Result is a variable and value String variable = buffer.substring(0, equal); result.setVariable(variable); buffer.delete(0, equal + 1); MIValue value = processMIValue(buffer); result.setMIValue(value); - } else if(buffer.length()>0 && buffer.charAt(0)=='"') { - // This an error but we just swallow it and move on. - MIValue value = processMIValue(buffer); - result.setMIValue(value); } else { - result.setVariable(buffer.toString()); - result.setMIValue(new MIConst()); // Empty string:??? - buffer.setLength(0); + MIValue value = processMIValue(buffer); + if (value != null) { + // Result is a value only (bug 527419) + result.setMIValue(value); + } else { + result.setVariable(buffer.toString()); + result.setMIValue(new MIConst()); // Empty string:??? + buffer.setLength(0); + } } return result; }