Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java')
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java50
1 files changed, 35 insertions, 15 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java
index 7dd40aa7307..e8ad471a1b7 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIDataDisassemble.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 QNX Software Systems and others.
+ * Copyright (c) 2000, 2011 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
@@ -8,6 +8,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ericsson - Modified for DSF Reference Implementation
+ * Daniel Thomas (Broadcom corp.) - Added support for mode 2 and 3 (Bug 357073)
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
@@ -46,35 +47,54 @@ import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
* END-ADDR, only the lines up to END-ADDR are displayed.
*
* '-- MODE'
- * is either 0 (meaning only disassembly) or 1 (meaning mixed source
- * and disassembly).
+ * - 0 disassembly
+ * - 1 mixed source and disassembly
+ * - 2 disassembly with raw opcodes
+ * - 3 mixed source and disassembly with raw opcodes
+ * Note: Modes 2 and 3 are only available starting with GDB 7.3
*/
public class MIDataDisassemble extends MICommand<MIDataDisassembleInfo> {
- public MIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, boolean mode) {
- super(ctx, "-data-disassemble"); //$NON-NLS-1$
+ private static final int MIN_MODE = 0;
+ private static final int MAX_MODE = 3;
+ private static final String MODE_OUT_OF_RANGE = "Mode out of range: "; //$NON-NLS-1$
+
+ public MIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, boolean mode) {
+ this(ctx, start, end, mode ? 1 : 0);
+ }
+
+ /** @since 4.1 */
+ public MIDataDisassemble(IDisassemblyDMContext ctx, String start, String end, int mode) {
+ super(ctx, "-data-disassemble"); //$NON-NLS-1$
setOptions(new String[]{"-s", start, "-e", end}); //$NON-NLS-1$ //$NON-NLS-2$
- String mixed = "0"; //$NON-NLS-1$
- if (mode) {
- mixed = "1"; //$NON-NLS-1$
+
+ if (mode >= MIN_MODE && mode <= MAX_MODE) {
+ setParameters(new String[] { Integer.toString(mode) });
+ } else {
+ throw new IllegalArgumentException(MODE_OUT_OF_RANGE + mode);
}
- setParameters(new String[]{mixed});
- }
+ }
public MIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, boolean mode) {
+ this(ctx, file, linenum, lines, mode ? 1 : 0);
+ }
+
+ /** @since 4.1 */
+ public MIDataDisassemble(IDisassemblyDMContext ctx, String file, int linenum, int lines, int mode) {
super(ctx, "-data-disassemble"); //$NON-NLS-1$
setOptions(new String[]{"-f", file, "-l", //$NON-NLS-1$ //$NON-NLS-2$
Integer.toString(linenum), "-n", Integer.toString(lines)}); //$NON-NLS-1$
- String mixed = "0"; //$NON-NLS-1$
- if (mode) {
- mixed = "1"; //$NON-NLS-1$
+
+ if (mode >= MIN_MODE && mode <= MAX_MODE) {
+ setParameters(new String[] { Integer.toString(mode) });
+ } else {
+ throw new IllegalArgumentException(MODE_OUT_OF_RANGE + mode);
}
- setParameters(new String[]{mixed});
}
/*
- * GDB the -data-disassemble uses "--" as a separator wit only the MODE
+ * -data-disassemble uses "--" as a separator with only the MODE
* So override the MICommand
*/
@Override

Back to the top