Ghidra-Switch-Loader icon indicating copy to clipboard operation
Ghidra-Switch-Loader copied to clipboard

error: cannot find symbol getMsgCount() on ghidra 9.2.2

Open H0neyBadger opened this issue 3 years ago • 2 comments

Hello, I'm having the following error during the build of the Ghidra-Switch-Loader:

bash ./gradlew -PGHIDRA_INSTALL_DIR=/var/home/h0neybadger/Documents/switch/ghidra/ghidra_9.2.2_PUBLIC                      
Starting a Gradle Daemon (subsequent builds will be faster)                                                                                                             
                                                                                                                                                                        
> Task :compileJava                                                                                                                                                     
/var/home/h0neybadger/Documents/switch/ghidra/Ghidra-Switch-Loader/src/main/java/adubbz/nx/loader/common/MemoryBlockHelper.java:127: error: cannot find symbol          
        if (this.log.getMsgCount() > 0)                                                                                                                                 
                    ^                                                                                                                                                   
  symbol:   method getMsgCount()                                                                                                                                        
  location: variable log of type MessageLog                                                                                                                             
Note: /var/home/h0neybadger/Documents/switch/ghidra/Ghidra-Switch-Loader/src/main/java/adubbz/nx/analyzer/ipc/IPCEmulator.java uses or overrides a deprecated API.      
Note: Recompile with -Xlint:deprecation for details.                                                                                                                    
Note: /var/home/h0neybadger/Documents/switch/ghidra/Ghidra-Switch-Loader/src/main/java/adubbz/nx/analyzer/IPCAnalyzer.java uses unchecked or unsafe operations.         
Note: Recompile with -Xlint:unchecked for details.                                                                                                                      
1 error                                                                                                                                                                 
                                                                                                                                                                        
> Task :compileJava FAILED                                                                                                                                              
                                                                                                                                                                        
FAILURE: Build failed with an exception.                                                                                                                                
                                                                                                                                                                        
* What went wrong:                                                                                                                                                      
Execution failed for task ':compileJava'.                                                                                                                               
> Compilation failed; see the compiler error output for details.                                                                                                        
                                                                                                                                                                        
* Try:                                                                                                                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.                    
                                                                                                                                                                        
* Get more help at https://help.gradle.org                                                                                                                              
                                                                                                                                                                        
BUILD FAILED in 44s

After a quick investigation, I replaced the this.log.getMsgCount() > 0 condition by this.log.hasMessages()

diff --git a/src/main/java/adubbz/nx/loader/common/MemoryBlockHelper.java b/src/main/java/adubbz/nx/loader/common/MemoryBlockHelper.java
index b51e29c..c0b34b1 100644
--- a/src/main/java/adubbz/nx/loader/common/MemoryBlockHelper.java
+++ b/src/main/java/adubbz/nx/loader/common/MemoryBlockHelper.java
@@ -124,7 +124,7 @@ public class MemoryBlockHelper
     
     public void flushLog()
     {
-        if (this.log.getMsgCount() > 0)
+        if (this.log.hasMessages())
         {
             Msg.info(this, this.log.toString());
             this.log.clear();

But I'm not sure if my setup is correct https://github.com/NationalSecurityAgency/ghidra/blob/cbe83dcd7853dc09e7c05113a4cf9a5fb0fb1fad/Ghidra/Framework/Generic/src/main/java/ghidra/app/util/importer/MessageLog.java#L115

Let me know if I can help.

H0neyBadger avatar Mar 20 '21 13:03 H0neyBadger

This is due to this API being changed recently by Ghidra and I haven't updated this to support it yet.

Adubbz avatar Mar 21 '21 00:03 Adubbz

Compiled with your fix- works fine, plugin loads correctly. Please open pull request for @Adubbz or maybe we can send pre-compiled plugin to host on release if this change breaks the earlier Ghidra versions

MaKiPL avatar Apr 16 '21 08:04 MaKiPL