34 |
34 |
35 // XML tags |
35 // XML tags |
36 public static final String TAG_ID = "id"; |
36 public static final String TAG_ID = "id"; |
37 public static final String TAG_RANGE = "range"; |
37 public static final String TAG_RANGE = "range"; |
38 public static final String TAG_HASH = "hash"; |
38 public static final String TAG_HASH = "hash"; |
|
39 public static final String TAG_DETAILED_HASH = "detailed_hash"; |
39 public static final String TAG_LINK = "link"; |
40 public static final String TAG_LINK = "link"; |
40 public static final String TAG_STACK_ENTRY = "stack_entry"; |
41 public static final String TAG_STACK_ENTRY = "stack_entry"; |
41 public static final String ATTRIBUTE_SEG = "seg"; |
42 public static final String ATTRIBUTE_SEG = "seg"; |
42 public static final String SEGMENT_REGISTERS = "seg_registers"; |
43 public static final String SEGMENT_REGISTERS = "seg_registers"; |
43 |
44 |
46 // Data |
47 // Data |
47 private final int stackId; |
48 private final int stackId; |
48 private final String stackType; |
49 private final String stackType; |
49 private final String stackRange; |
50 private final String stackRange; |
50 private final String stackHash; |
51 private final String stackHash; |
|
52 private final String stackDetailedHash; |
51 private final String stackLinkRegister; |
53 private final String stackLinkRegister; |
52 private final String stackStackPointer; |
54 private final String stackStackPointer; |
53 private final String stackProgramCounter; |
55 private final String stackProgramCounter; |
54 private final boolean stackContainsAccurateStackEntries; |
56 private final boolean stackContainsAccurateStackEntries; |
55 private final boolean stackRegisterContainsCpsr; |
57 private final boolean stackRegisterContainsCpsr; |
66 * @param containsAccurateStackEntries defines if this stack was constructed with accurate (true) |
68 * @param containsAccurateStackEntries defines if this stack was constructed with accurate (true) |
67 * or heuristic (false) method |
69 * or heuristic (false) method |
68 * @param data stack entries |
70 * @param data stack entries |
69 * @param cpsrStack defines whether this stack contains cpsr register |
71 * @param cpsrStack defines whether this stack contains cpsr register |
70 */ |
72 */ |
71 private Stack(int id, String type, String range, String hash, String linkRegister, String stackPointer, |
73 private Stack(int id, String type, String range, String hash, String detailedHash, String linkRegister, String stackPointer, |
72 String programCounter, boolean containsAccurateStackEntries, List<StackEntry> data, |
74 String programCounter, boolean containsAccurateStackEntries, List<StackEntry> data, |
73 boolean cpsrStack) { |
75 boolean cpsrStack) { |
74 stackId = id; |
76 stackId = id; |
75 stackType = type; |
77 stackType = type; |
76 stackRange = range; |
78 stackRange = range; |
77 stackHash = hash; |
79 stackHash = hash; |
|
80 stackDetailedHash = detailedHash; |
78 stackLinkRegister = linkRegister; |
81 stackLinkRegister = linkRegister; |
79 stackStackPointer = stackPointer; |
82 stackStackPointer = stackPointer; |
80 stackProgramCounter = programCounter; |
83 stackProgramCounter = programCounter; |
81 stackContainsAccurateStackEntries = containsAccurateStackEntries; |
84 stackContainsAccurateStackEntries = containsAccurateStackEntries; |
82 stackData = data; |
85 stackData = data; |
116 } |
119 } |
117 |
120 |
118 public String getHash() { |
121 public String getHash() { |
119 return stackHash; |
122 return stackHash; |
120 } |
123 } |
121 |
124 |
|
125 public String getDetailedHash() { |
|
126 return stackDetailedHash; |
|
127 } |
|
128 |
122 /** |
129 /** |
123 * Writes stack data into given buffer (i.e. text file) |
130 * Writes stack data into given buffer (i.e. text file) |
124 * @param out buffer to write to |
131 * @param out buffer to write to |
125 * @param stackItems |
132 * @param stackItems |
126 * @param html write in html format |
133 * @param html write in html format |
130 writeLine(out,""); |
137 writeLine(out,""); |
131 writeLine(out, "STACK:"); |
138 writeLine(out, "STACK:"); |
132 writeLine(out, "--------"); |
139 writeLine(out, "--------"); |
133 writeLine(out, "Stack Type", stackType); |
140 writeLine(out, "Stack Type", stackType); |
134 writeLine(out, "Stack Range", stackRange); |
141 writeLine(out, "Stack Range", stackRange); |
135 writeLine(out, "Stack Hash", stackHash); |
142 writeLine(out, "Defect Hash", stackHash); |
|
143 writeLine(out, "Detailed Defect Hash", stackDetailedHash); |
136 |
144 |
137 if (stackData != null && !stackData.isEmpty()) { |
145 if (stackData != null && !stackData.isEmpty()) { |
138 writeLine(out, ""); |
146 writeLine(out, ""); |
139 writeLine(out, "**********************************************"); |
147 writeLine(out, "**********************************************"); |
140 for (int i = 0; i < stackData.size(); i++) { |
148 for (int i = 0; i < stackData.size(); i++) { |
218 // read defect hash if exists |
226 // read defect hash if exists |
219 String hash = XmlUtils.getTextValue(elementThreadStack, TAG_HASH); |
227 String hash = XmlUtils.getTextValue(elementThreadStack, TAG_HASH); |
220 if (hash == null) |
228 if (hash == null) |
221 hash = ""; |
229 hash = ""; |
222 |
230 |
|
231 // read detailed defect hash if exists |
|
232 String detailedHash = XmlUtils.getTextValue(elementThreadStack, TAG_DETAILED_HASH); |
|
233 if (detailedHash == null) |
|
234 detailedHash = ""; |
|
235 |
223 // read stack entries |
236 // read stack entries |
224 List<StackEntry> entries = null; |
237 List<StackEntry> entries = null; |
225 NodeList stackEntries = elementThreadStack.getElementsByTagName(TAG_STACK_ENTRY); |
238 NodeList stackEntries = elementThreadStack.getElementsByTagName(TAG_STACK_ENTRY); |
226 if (stackEntries != null && stackEntries.getLength() > 0) { |
239 if (stackEntries != null && stackEntries.getLength() > 0) { |
227 for (int i = 0; i < stackEntries.getLength(); i++) { |
240 for (int i = 0; i < stackEntries.getLength(); i++) { |
244 break; |
257 break; |
245 } |
258 } |
246 } |
259 } |
247 } |
260 } |
248 |
261 |
249 return new Stack(id, type, range, hash, linkRegister, stackPointer, programCounter, |
262 return new Stack(id, type, range, hash, detailedHash, linkRegister, stackPointer, programCounter, |
250 containsAccurateStackEntries, entries, cpsrStack); |
263 containsAccurateStackEntries, entries, cpsrStack); |
251 } catch (Exception e) { |
264 } catch (Exception e) { |
252 return null; |
265 return null; |
253 } |
266 } |
254 } |
267 } |