61 private final boolean currentStackPointer; |
61 private final boolean currentStackPointer; |
62 private final boolean accurate; |
62 private final boolean accurate; |
63 private final boolean xipSymbol; |
63 private final boolean xipSymbol; |
64 private final boolean registerBased; |
64 private final boolean registerBased; |
65 |
65 |
66 private StackEntry(String address, String value, String symbol, String object, String offset, String text, String source, |
66 private StackEntry(final String address, final String value, final String symbol, final String object, final String offset, final String text, final String source, |
67 String codeSegmentName, boolean outsideSB, boolean currentSP, boolean isAccurate, boolean xip, boolean register) { |
67 final String codeSegmentName, final boolean outsideSB, final boolean currentSP, final boolean isAccurate, final boolean xip, final boolean register) { |
68 stackEntryAddress = address; |
68 stackEntryAddress = address; |
69 stackEntryValue = value; |
69 stackEntryValue = value; |
70 stackEntrySymbol = symbol; |
70 stackEntrySymbol = symbol; |
71 stackEntryObject = object; |
71 stackEntryObject = object; |
72 stackEntryOffset = offset; |
72 stackEntryOffset = offset; |
143 * @param stackItems |
143 * @param stackItems |
144 * @param stack |
144 * @param stack |
145 * @param html |
145 * @param html |
146 * @throws IOException |
146 * @throws IOException |
147 */ |
147 */ |
148 public void writeTo(BufferedWriter out, StackItems stackItems, Stack stack, boolean html) throws IOException { |
148 public void writeTo(final BufferedWriter out, final StackItems stackItems, final Stack stack, final boolean html) throws IOException { |
149 if (currentStackPointer) { |
149 if (currentStackPointer) { |
150 writeLine(out, ""); |
150 writeLine(out, ""); |
151 if (html) |
151 if (html) |
152 writeLine(out, "</pre><a name=\"STACKPOINTER\"><h3><<<<<<<<<< CURRENT STACK POINTER >>>>>>>>>></h3></a><pre>"); |
152 writeLine(out, "</pre><a name=\"STACKPOINTER\"><h3><<<<<<<<<< CURRENT STACK POINTER >>>>>>>>>></h3></a><pre>"); |
153 else |
153 else |
204 * @param elementStackEntry |
204 * @param elementStackEntry |
205 * @param symbols |
205 * @param symbols |
206 * @param registers |
206 * @param registers |
207 * @return created stack entry or null |
207 * @return created stack entry or null |
208 */ |
208 */ |
209 public static StackEntry read(Element elementStackEntry, |
209 public static StackEntry read(final Element elementStackEntry, |
210 Map<Integer, Symbol> symbols, |
210 final Map<Integer, Symbol> symbols, |
211 Map<Integer, Register> registers) { |
211 final Map<Integer, Register> registers) { |
212 try { |
212 try { |
213 // read address if exists |
213 // read address if exists |
214 String address = XmlUtils.getTextValue(elementStackEntry, TAG_ADDRESS); |
214 String address = XmlUtils.getTextValue(elementStackEntry, TAG_ADDRESS); |
215 if (address == null) |
215 if (address == null) |
216 address = ""; |
216 address = ""; |
226 String object = ""; |
226 String object = ""; |
227 String source = ""; |
227 String source = ""; |
228 String codeSegment = ""; |
228 String codeSegment = ""; |
229 |
229 |
230 // try to read symbol & register information for this stack entry |
230 // try to read symbol & register information for this stack entry |
231 NodeList nl = elementStackEntry.getElementsByTagName(TAG_LINK); |
231 final NodeList nl = elementStackEntry.getElementsByTagName(TAG_LINK); |
232 if (nl != null && nl.getLength() > 0) { |
232 if (nl != null && nl.getLength() > 0) { |
233 for (int i = 0; i < nl.getLength(); i++) { |
233 for (int i = 0; i < nl.getLength(); i++) { |
234 Node linkNode = nl.item(i); |
234 final Node linkNode = nl.item(i); |
235 String nodeValue = XmlUtils.getNodeValue(linkNode); |
235 final String nodeValue = XmlUtils.getNodeValue(linkNode); |
236 NamedNodeMap attributes = linkNode.getAttributes(); |
236 final NamedNodeMap attributes = linkNode.getAttributes(); |
237 if (attributes != null && attributes.getLength() > 0) { |
237 if (attributes != null && attributes.getLength() > 0) { |
238 Node seg = attributes.getNamedItem(ATTRIBUTE_SEG); |
238 final Node seg = attributes.getNamedItem(ATTRIBUTE_SEG); |
239 // symbol id |
239 // symbol id |
240 if (SEGMENT_SYMBOLS.equals(XmlUtils.getNodeValue(seg))) { |
240 if (SEGMENT_SYMBOLS.equals(XmlUtils.getNodeValue(seg))) { |
241 try { |
241 try { |
242 int sId = Integer.parseInt(nodeValue); |
242 final int sId = Integer.parseInt(nodeValue); |
243 if (symbols.containsKey(sId)) { |
243 if (symbols.containsKey(sId)) { |
244 Symbol sym = symbols.get(sId); |
244 final Symbol sym = symbols.get(sId); |
245 symbol = sym.getName(); |
245 symbol = sym.getName(); |
246 object = sym.getObject(); |
246 object = sym.getObject(); |
247 source = sym.getSource(); |
247 source = sym.getSource(); |
248 xip = sym.xip(); |
248 xip = sym.xip(); |
249 codeSegment = sym.getCodeSegmentName(); |
249 codeSegment = sym.getCodeSegmentName(); |
252 e.printStackTrace(); |
252 e.printStackTrace(); |
253 } |
253 } |
254 // register id |
254 // register id |
255 } else if (SEGMENT_REGISTERS.equals(XmlUtils.getNodeValue(seg))) { |
255 } else if (SEGMENT_REGISTERS.equals(XmlUtils.getNodeValue(seg))) { |
256 registerBased = true; |
256 registerBased = true; |
257 int rId = Integer.parseInt(nodeValue); |
257 final int rId = Integer.parseInt(nodeValue); |
258 if (registers.containsKey(rId)) { |
258 if (registers.containsKey(rId)) { |
259 Register reg = registers.get(rId); |
259 final Register reg = registers.get(rId); |
260 if ("R14".equals(reg.getName())) { |
260 if ("R14".equals(reg.getName())) { |
261 address = "LR"; |
261 address = "LR"; |
262 } else if ("R15".equals(reg.getName())) { |
262 } else if ("R15".equals(reg.getName())) { |
263 address = "PC"; |
263 address = "PC"; |
264 } |
264 } |
266 } |
266 } |
267 } |
267 } |
268 } |
268 } |
269 } |
269 } |
270 |
270 |
271 boolean currentStackPointer = XmlUtils.containsNode(elementStackEntry, TAG_CURRENT_STACK_POINTER); |
271 final boolean currentStackPointer = XmlUtils.containsNode(elementStackEntry, TAG_CURRENT_STACK_POINTER); |
272 boolean accurate = XmlUtils.containsNode(elementStackEntry, TAG_ACCURATE); |
272 final boolean accurate = XmlUtils.containsNode(elementStackEntry, TAG_ACCURATE); |
273 boolean outsideStackBounds = XmlUtils.containsNode(elementStackEntry, TAG_OUTSIDE_STACK_BOUNDS); |
273 final boolean outsideStackBounds = XmlUtils.containsNode(elementStackEntry, TAG_OUTSIDE_STACK_BOUNDS); |
274 |
274 |
275 // read offset if exists |
275 // read offset if exists |
276 String offset = XmlUtils.getTextValue(elementStackEntry, TAG_OFFSET); |
276 String offset = XmlUtils.getTextValue(elementStackEntry, TAG_OFFSET); |
277 if (offset == null) |
277 if (offset == null) |
278 offset = ""; |
278 offset = ""; |