Skip to content

Commit

Permalink
Add exception cause decoding with description
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Nov 17, 2016
1 parent e66f869 commit 3913ab3
Showing 1 changed file with 57 additions and 8 deletions.
65 changes: 57 additions & 8 deletions src/EspExceptionDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,43 @@ public class EspExceptionDecoder implements Tool, DocumentListener {
File tool;
File elf;

private static String[] exceptions = {
"Illegal instruction",
"SYSCALL instruction",
"InstructionFetchError: Processor internal physical address or data error during instruction fetch",
"LoadStoreError: Processor internal physical address or data error during load or store",
"Level1Interrupt: Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register",
"Alloca: MOVSP instruction, if caller's registers are not in the register file",
"IntegerDivideByZero: QUOS, QUOU, REMS, or REMU divisor operand is zero",
"reserved",
"Privileged: Attempt to execute a privileged operation when CRING ? 0",
"LoadStoreAlignmentCause: Load or store to an unaligned address",
"reserved",
"reserved",
"InstrPIFDataError: PIF data error during instruction fetch",
"LoadStorePIFDataError: Synchronous PIF data error during LoadStore access",
"InstrPIFAddrError: PIF address error during instruction fetch",
"LoadStorePIFAddrError: Synchronous PIF address error during LoadStore access",
"InstTLBMiss: Error during Instruction TLB refill",
"InstTLBMultiHit: Multiple instruction TLB entries matched",
"InstFetchPrivilege: An instruction fetch referenced a virtual address at a ring level less than CRING",
"reserved",
"InstFetchProhibited: An instruction fetch referenced a page mapped with an attribute that does not permit instruction fetch",
"reserved",
"reserved",
"reserved",
"LoadStoreTLBMiss: Error during TLB refill for a load or store",
"LoadStoreTLBMultiHit: Multiple TLB entries matched for a load or store",
"LoadStorePrivilege: A load or store referenced a virtual address at a ring level less than CRING",
"reserved",
"LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads",
"StoreProhibited: A store referenced a page mapped with an attribute that does not permit stores"
};

public void init(Editor editor) {
this.editor = editor;
}


public String getMenuTitle() {
return "ESP Exception Decoder";
}
Expand Down Expand Up @@ -312,6 +344,19 @@ public void run() {
createAndUpload();
}

private void parseException(){
String content = inputArea.getText();
Pattern p = Pattern.compile("Exception \\(([0-9]*)\\):");
Matcher m = p.matcher(content);
if(m.find()){
int exception = Integer.parseInt(m.group(1));
if(exception < 0 || exception > 29){
return;
}
outputText += "<b><font color=red>Exception "+exception+": "+exceptions[exception]+"</font></b>\n";
}
}

private void parseText(){
String content = inputArea.getText();
Pattern p = Pattern.compile("40[0-2](\\d|[a-f]){5}\\b");
Expand All @@ -333,25 +378,29 @@ private void parseText(){
while(m.find()) {
command[i++] = content.substring(m.start(), m.end());
}
outputText = "<html><pre><i>Decoding "+count+" results</i>\n";
outputText += "<i>Decoding "+count+" results</i>\n";
sysExec(command);
}

private void runParser(){
outputText = "<html><pre>\n";
parseException();
parseText();
}

private class CommitAction extends AbstractAction {
public void actionPerformed(ActionEvent ev) {
parseText();
}
public void actionPerformed(ActionEvent ev) {
runParser();
}
}

public void changedUpdate(DocumentEvent ev) {
//parseText();
}

public void removeUpdate(DocumentEvent ev) {
//parseText();
}

public void insertUpdate(DocumentEvent ev) {
parseText();
runParser();
}
}

0 comments on commit 3913ab3

Please sign in to comment.