crashanalysis/crashanalyser/com.nokia.s60tools.crashanalyser/src/com/nokia/s60tools/crashanalyser/containers/Thread.java
changeset 4 615035072f7e
parent 0 5ad7ad99af01
child 16 72f198be1c1d
equal deleted inserted replaced
3:431bbaccaec8 4:615035072f7e
    38 	public static final String TAG_FULLNAME = "fullname";
    38 	public static final String TAG_FULLNAME = "fullname";
    39 	public static final String TAG_EXIT_INFO = "exit_info";
    39 	public static final String TAG_EXIT_INFO = "exit_info";
    40 	public static final String TAG_EXIT_TYPE = "exit_type";
    40 	public static final String TAG_EXIT_TYPE = "exit_type";
    41 	public static final String TAG_EXIT_CATEGORY = "exit_category";
    41 	public static final String TAG_EXIT_CATEGORY = "exit_category";
    42 	public static final String TAG_EXIT_REASON = "exit_reason";
    42 	public static final String TAG_EXIT_REASON = "exit_reason";
       
    43 	public static final String TAG_EXIT_DESCRIPTION = "exit_description";
    43 	public static final String TAG_LINK = "link";
    44 	public static final String TAG_LINK = "link";
    44 	public static final String ATTRIBUTE_SEG = "seg";
    45 	public static final String ATTRIBUTE_SEG = "seg";
    45 	public static final String SEGMENT_STACKS = "seg_stacks";
    46 	public static final String SEGMENT_STACKS = "seg_stacks";
    46 	public static final String SEGMENT_REGISTERS = "seg_registers";
    47 	public static final String SEGMENT_REGISTERS = "seg_registers";
    47 	
    48 	
    50 	private final int threadId;
    51 	private final int threadId;
    51 	private final String threadFullName;
    52 	private final String threadFullName;
    52 	private final String threadExitType;
    53 	private final String threadExitType;
    53 	private final String threadExitCategory;
    54 	private final String threadExitCategory;
    54 	private final String threadExitReason;
    55 	private final String threadExitReason;
       
    56 	private final String threadExitDescription;
    55 	private final String threadPanicDescription;
    57 	private final String threadPanicDescription;
    56 	// PC, SP and LR do not really belong to thread,
    58 	// PC, SP and LR do not really belong to thread,
    57 	// but these are taken from this thread's stack which
    59 	// but these are taken from this thread's stack which
    58 	// contains CPSR. So these are the most "interesting" 
    60 	// contains CPSR. So these are the most "interesting" 
    59 	// PC, SP and LR values for this thread, even though 
    61 	// PC, SP and LR values for this thread, even though 
    65 	private final List<Stack> threadStacks;
    67 	private final List<Stack> threadStacks;
    66 	private final List<RegisterSet> threadRegisters;
    68 	private final List<RegisterSet> threadRegisters;
    67 
    69 
    68 	private Thread(int id, String fullName, String exitType, String exitCategory, 
    70 	private Thread(int id, String fullName, String exitType, String exitCategory, 
    69 					String panicDescription, String programCounter, String stackPointer, String linkRegister, 
    71 					String panicDescription, String programCounter, String stackPointer, String linkRegister, 
    70 					String exitReason, List<Stack> stacks, List<RegisterSet> registers) {
    72 					String exitReason, String exitDescription, List<Stack> stacks, List<RegisterSet> registers) {
    71 		threadId = id;
    73 		threadId = id;
    72 		threadFullName = fullName;
    74 		threadFullName = fullName;
    73 		threadExitType = exitType;
    75 		threadExitType = exitType;
    74 		threadExitCategory = exitCategory;
    76 		threadExitCategory = exitCategory;
    75 		threadExitReason = exitReason;
    77 		threadExitReason = exitReason;
       
    78 		threadExitDescription = exitDescription;
    76 		threadProgramCounter = programCounter;
    79 		threadProgramCounter = programCounter;
    77 		threadStackPointer = stackPointer;
    80 		threadStackPointer = stackPointer;
    78 		threadLinkRegister = linkRegister;
    81 		threadLinkRegister = linkRegister;
    79 		threadStacks = stacks;
    82 		threadStacks = stacks;
    80 		threadPanicDescription = panicDescription;
    83 		threadPanicDescription = panicDescription;
    99 	
   102 	
   100 	public String getExitReason() {
   103 	public String getExitReason() {
   101 		return threadExitReason;
   104 		return threadExitReason;
   102 	}
   105 	}
   103 	
   106 	
       
   107 	public String getExitDescription() {
       
   108 		return threadExitDescription;
       
   109 	}
       
   110 
   104 	public String getProgramCounter() {
   111 	public String getProgramCounter() {
   105 		return threadProgramCounter;
   112 		return threadProgramCounter;
   106 	}
   113 	}
   107 	
   114 	
   108 	public String getStackPointer() {
   115 	public String getStackPointer() {
   142 		if ("Exception".equals(threadExitType)) {
   149 		if ("Exception".equals(threadExitType)) {
   143 			writeLine(out, "Exit Reason", threadExitReason);
   150 			writeLine(out, "Exit Reason", threadExitReason);
   144 		} else {
   151 		} else {
   145 			writeLine(out, "Exit Reason", threadExitCategory + " - " +threadExitReason);
   152 			writeLine(out, "Exit Reason", threadExitCategory + " - " +threadExitReason);
   146 		}
   153 		}
       
   154 		writeLine(out, "Exit Description", threadExitDescription);
   147 		
   155 		
   148 		writeLine(out, "");
   156 		writeLine(out, "");
   149 		if (threadRegisters != null && !threadRegisters.isEmpty()) {
   157 		if (threadRegisters != null && !threadRegisters.isEmpty()) {
   150 			for (int i = 0; i < threadRegisters.size(); i++) {
   158 			for (int i = 0; i < threadRegisters.size(); i++) {
   151 				RegisterSet registerSet = threadRegisters.get(i);
   159 				RegisterSet registerSet = threadRegisters.get(i);
   208 				return null;
   216 				return null;
   209 			
   217 			
   210 			String exitType = "";
   218 			String exitType = "";
   211 			String exitCategory = "";
   219 			String exitCategory = "";
   212 			String exitReason = "";
   220 			String exitReason = "";
       
   221 			String exitDescription = "";
   213 			// get child nodes such as exit_info, stacks, registers
   222 			// get child nodes such as exit_info, stacks, registers
   214 			NodeList childNodes = elementThread.getChildNodes();
   223 			NodeList childNodes = elementThread.getChildNodes();
   215 			if (childNodes == null || childNodes.getLength() < 1)
   224 			if (childNodes == null || childNodes.getLength() < 1)
   216 				return null;
   225 				return null;
   217 			
   226 			
   252 								if (exitReason == null)
   261 								if (exitReason == null)
   253 									exitReason = "";
   262 									exitReason = "";
   254 							} else {
   263 							} else {
   255 								exitReason = "";
   264 								exitReason = "";
   256 							}								
   265 							}								
       
   266 						} else if (TAG_EXIT_DESCRIPTION.equals(el.getNodeName())) {
       
   267 							// read exit description
       
   268 							firstChild = el.getFirstChild();
       
   269 							if (firstChild != null) {							
       
   270 								exitDescription = firstChild.getNodeValue();
       
   271 								if (exitDescription == null)
       
   272 									exitDescription = "";
       
   273 							} else {
       
   274 								exitDescription = "";
       
   275 							}								
   257 						}
   276 						}
   258 					}
   277 					}
   259 				}
   278 				}
   260 			}
   279 			}
   261 
   280 
   312 				}
   331 				}
   313 			}
   332 			}
   314 
   333 
   315 			return new Thread(id, fullName, exitType, exitCategory, 
   334 			return new Thread(id, fullName, exitType, exitCategory, 
   316 								panicDescription, programCounter, stackPointer, linkRegister,
   335 								panicDescription, programCounter, stackPointer, linkRegister,
   317 								exitReason, threadStacks, threadRegisters);
   336 								exitReason, exitDescription, threadStacks, threadRegisters);
   318 
   337 
   319 		} catch (Exception e) {
   338 		} catch (Exception e) {
   320 			return null;
   339 			return null;
   321 		}
   340 		}
   322 	}
   341 	}