Skip to content

Commit

Permalink
Suppress logs
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Feb 19, 2023
1 parent 5ac189e commit 497d416
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/java/golanganalyzerextension/StructureManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public void modify() {
GolangDatatype go_datatype=datatype_holder.get_go_datatype_by_key(key);
go_datatype.modify(datatype_holder);

go_bin.add_datatype(go_datatype.get_category_path(), go_datatype.get_datatype());
go_bin.add_datatype(go_datatype.get_category_path(), go_datatype.get_struct_datatype());

go_bin.set_comment(go_datatype.get_addr(), ghidra.program.model.listing.CodeUnit.PLATE_COMMENT, make_datatype_comment(go_datatype, datatype_holder));
}catch(Exception e) {
Logger.append_message(String.format("Error: %s", e.getMessage()));
Logger.append_message(String.format("Failed to add datatype to manager: message=%s", e.getMessage()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public String read_string(Address addr, int size) throws BinaryAccessException,
int tmp_len=str.length();
str=str.replaceAll("[^\\x09\\x0a\\x0d\\x20-\\x7e]", "");
if(str.length()!=tmp_len) {
Logger.append_message(String.format("Invalid char: %x %x %s", addr.getOffset(), size, str));
// Logger.append_message(String.format("Invalid char: %x %x %s", addr.getOffset(), size, str));
}
return str;
} catch (MemoryAccessException e) {
Expand Down Expand Up @@ -537,7 +537,7 @@ public boolean compare_register(Register cmp1, Register cmp2) {

public void create_label(Address addr, String str) throws BinaryAccessException {
try {
str=str.replace(" ", "_");
str=str.replaceAll("[ \n\t]", "_");
program.getSymbolTable().createLabel(addr, str, ghidra.program.model.symbol.SourceType.USER_DEFINED);
} catch (IllegalArgumentException | InvalidInputException e) {
throw new BinaryAccessException(String.format("Create label: addr=%s, label=%s", addr, str));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void search_memory() {

search_addr=go_bin.get_address(search_addr, pointer_size);
} catch (InvalidBinaryStructureException e) {
Logger.append_message(String.format("Failed to search string in memory: message=%s", e.getMessage()));
// Logger.append_message(String.format("Failed to search string in memory: message=%s", e.getMessage()));
} catch (BinaryAccessException e) {
return;
}
Expand Down Expand Up @@ -190,7 +190,7 @@ private void check_insts(Instruction inst) {
GolangString str=GolangString.create_string(go_bin, data, string_len);
string_map.put(data.getOffset(), str);
} catch (InvalidBinaryStructureException e) {
Logger.append_message(String.format("Failed to get string: %s", e.getMessage()));
// Logger.append_message(String.format("Failed to get string: %s", e.getMessage()));
}
}
} else if (is_move_reg_to_addr_reg_scalar(check_inst)) {
Expand All @@ -202,7 +202,7 @@ private void check_insts(Instruction inst) {
GolangString str=GolangString.create_string(go_bin, data, string_len);
string_map.put(data.getOffset(), str);
} catch (InvalidBinaryStructureException e) {
Logger.append_message(String.format("Failed to get string: %s", e.getMessage()));
// Logger.append_message(String.format("Failed to get string: %s", e.getMessage()));
}
}
} else if (check_inst.getFlowType().isCall() || check_inst.getFlowType().isTerminal()) {
Expand All @@ -213,7 +213,7 @@ private void check_insts(Instruction inst) {
GolangString str=GolangString.create_string(go_bin, arg_str_addr, string_len);
string_map.put(arg_str_addr.getOffset(), str);
} catch (InvalidBinaryStructureException e) {
Logger.append_message(String.format("Failed to get string: %s", e.getMessage()));
// Logger.append_message(String.format("Failed to get string: %s", e.getMessage()));
}
}
}
Expand Down

0 comments on commit 497d416

Please sign in to comment.