Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Dallaway2021-05-12 18:54:56 +0000
committerJohn Dallaway2021-05-13 17:45:26 +0000
commit00204a3c4c1dc22a7e14d7cbfe60a142bbbff062 (patch)
treeaae0364bec502f32ee12e7647302963ef382b75e
parent39a517931196b94d6b755ed564129fa58cb9cb5b (diff)
downloadorg.eclipse.cdt-00204a3c4c1dc22a7e14d7cbfe60a142bbbff062.tar.gz
org.eclipse.cdt-00204a3c4c1dc22a7e14d7cbfe60a142bbbff062.tar.xz
org.eclipse.cdt-00204a3c4c1dc22a7e14d7cbfe60a142bbbff062.zip
Bug 573506: Fix counting of opcode bytes
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
index 3fdcfae2cd6..7207534908f 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 QNX Software Systems and others.
+ * Copyright (c) 2000, 2021 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,7 @@
* Ericsson - Adapted for DSF
* Dmitry Kozlov (Mentor Graphics) - Add tab symbols parsing (Bug 391115)
* William Riley (Renesas) - Add raw Opcode parsing (Bug 357270)
+ * John Dallaway - Fix counting of opcode bytes (Bug 573506)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
@@ -165,7 +166,9 @@ public class MIInstruction extends AbstractInstruction {
try {
rawOpcodeString = str;
rawOpcodes = decodeOpcodes(str);
- opcodeSize = Integer.valueOf(str.replace(" ", "").length() / 2); //$NON-NLS-1$//$NON-NLS-2$
+
+ // count the space-separated bytes (do not assume 8 bits per byte)
+ opcodeSize = (int) str.chars().filter(ch -> (' ' == ch)).count() + 1;
} catch (NumberFormatException e) {
}
continue;

Back to the top