NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
49.06k stars 5.65k forks source link

Debugger "qemu + gdb" does not work #6634

Closed electricworry closed 2 weeks ago

electricworry commented 2 weeks ago

Describe the bug Attempting to open the "qemu + gdb" results in the following error:

Failed to launch 'target' due to an exception:
java.lang.ClassCastException: class java.lang.String cannot be cast to class ghidra.framework.plugintool.
AutoConfigState$PathIsFile (java.lang.String is in module java.base of loader 'bootstrap'; ghidra.framework.plugintool.AutoConfigState%PathIsFile is in unnamed module of loader ghidra.GhidraClassLoader ...)

To Reproduce Steps to reproduce the behavior:

  1. From the Ghidra active project window, drag a program onto the Debugger tool in the tool chest
  2. In Debugger, select the debugger tool icon > configure and launch 'target' using > qemu + gdb

Expected behavior The qemu+gdb parameter dialog should be displayed instead.

Environment (please complete the following information):

Additional context The problem seems to be with the environment variable GHIDRA_LANG_EXTTOOL_qemu in the file Ghidra/Debug/Debugger-agent-gdb/data/debugger-launchers/qemu-gdb.sh. Replacing all three instances of GHIDRA_LANG_EXTTOOL_qemu in that file with an alternative string resolves the issue. Is there something problematic about that choice of environment variable name?

nsadeveloper789 commented 2 weeks ago

Interesting. I think I know the right fix, but yeah, it's related to the env variable name. That name is "magical" in that the default value is derived from a property in the language spec. Looks like I forgot to convert that String default to a PathIsFile. The workaround you did should be fine. You just won't get a default value. I'll put a ticket in on our end.