diff --git a/src/main/java/golanganalyzerextension/StructureManager.java b/src/main/java/golanganalyzerextension/StructureManager.java index bdf2f2f..d5f7538 100644 --- a/src/main/java/golanganalyzerextension/StructureManager.java +++ b/src/main/java/golanganalyzerextension/StructureManager.java @@ -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())); } } } diff --git a/src/main/java/golanganalyzerextension/gobinary/GolangBinary.java b/src/main/java/golanganalyzerextension/gobinary/GolangBinary.java index 21eb006..6d3e890 100644 --- a/src/main/java/golanganalyzerextension/gobinary/GolangBinary.java +++ b/src/main/java/golanganalyzerextension/gobinary/GolangBinary.java @@ -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) { @@ -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)); diff --git a/src/main/java/golanganalyzerextension/string/StringExtractor.java b/src/main/java/golanganalyzerextension/string/StringExtractor.java index 436e922..068ef88 100644 --- a/src/main/java/golanganalyzerextension/string/StringExtractor.java +++ b/src/main/java/golanganalyzerextension/string/StringExtractor.java @@ -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; } @@ -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)) { @@ -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()) { @@ -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())); } } }