1
/*******************************************************************************
2
* Copyright (c) 2000, 2006 QNX Software Systems and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* QNX Software Systems - Initial API and implementation
10
*******************************************************************************/
12
package org.eclipse.cdt.debug.mi.core.command;
14
import org.eclipse.cdt.debug.mi.core.MIException;
15
import org.eclipse.cdt.debug.mi.core.MIFormat;
16
import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo;
17
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
18
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
22
* -data-read-memory [ -o BYTE-OFFSET ]
23
* ADDRESS WORD-FORMAT WORD-SIZE
24
* NR-ROWS NR-COLS [ ASCHAR ]
29
* An expression specifying the address of the first memory word to be
30
* read. Complex expressions containing embedded white space should
31
* be quoted using the C convention.
34
* The format to be used to print the memory words. The notation is
35
* the same as for GDB's `print' command (*note Output formats:
39
* The size of each memory word in bytes.
42
* The number of rows in the output table.
45
* The number of columns in the output table.
48
* If present, indicates that each row should include an ASCII dump.
49
* The value of ASCHAR is used as a padding character when a byte is
50
* not a member of the printable ASCII character set (printable ASCII
51
* characters are those whose code is between 32 and 126,
58
public class MIDataReadMemory extends MICommand {
60
public MIDataReadMemory(
69
super(miVersion, "-data-read-memory"); //$NON-NLS-1$
71
setOptions(new String[] { "-o", Long.toString(offset)}); //$NON-NLS-1$
74
String format = "x"; //$NON-NLS-1$
76
case MIFormat.UNSIGNED :
77
format = "u"; //$NON-NLS-1$
81
format = "f"; //$NON-NLS-1$
84
case MIFormat.ADDRESS :
85
format = "a"; //$NON-NLS-1$
88
case MIFormat.INSTRUCTION :
89
format = "i"; //$NON-NLS-1$
93
format = "c"; //$NON-NLS-1$
96
case MIFormat.STRING :
97
format = "s"; //$NON-NLS-1$
100
case MIFormat.DECIMAL :
101
format = "d"; //$NON-NLS-1$
104
case MIFormat.BINARY :
105
format = "t"; //$NON-NLS-1$
108
case MIFormat.OCTAL :
109
format = "o"; //$NON-NLS-1$
112
case MIFormat.HEXADECIMAL :
114
format = "x"; //$NON-NLS-1$
118
if (asChar == null) {
123
Integer.toString(wordSize),
124
Integer.toString(rows),
125
Integer.toString(cols)});
131
Integer.toString(wordSize),
132
Integer.toString(rows),
133
Integer.toString(cols),
138
public MIDataReadMemoryInfo getMIDataReadMemoryInfo() throws MIException {
139
return (MIDataReadMemoryInfo)getMIInfo();
142
public MIInfo getMIInfo() throws MIException {
144
MIOutput out = getMIOutput();
146
info = new MIDataReadMemoryInfo(out);
147
if (info.isError()) {
148
throwMIException(info, out);