Merge remote-tracking branch 'origin/patch'

This commit is contained in:
Ryan Kurtz
2025-03-06 12:07:16 -05:00
4 changed files with 14 additions and 10 deletions

View File

@@ -306,6 +306,10 @@ import pdb # imports Python's pdb
import pdb_ # imports Ghidra's pdb import pdb_ # imports Ghidra's pdb
``` ```
## Change History ## Change History
__2.0.2:__
* [`pyghidra.open_program()`](#pyghidraopen_program) now properly throws an exception if the project
exists and is locked.
__2.0.1:__ __2.0.1:__
* PyGhidra now respects the `application.settingsdir` property set in Ghidra's `launch.properties` * PyGhidra now respects the `application.settingsdir` property set in Ghidra's `launch.properties`
file. file.

View File

@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
## ##
__version__ = "2.0.1" __version__ = "2.0.2"
# stub for documentation and typing # stub for documentation and typing
# this is mostly to hide the function parameter # this is mostly to hide the function parameter

View File

@@ -85,7 +85,7 @@ def _setup_project(
) -> Tuple["GhidraProject", "Program"]: ) -> Tuple["GhidraProject", "Program"]:
from ghidra.base.project import GhidraProject from ghidra.base.project import GhidraProject
from java.lang import ClassLoader # type:ignore @UnresolvedImport from java.lang import ClassLoader # type:ignore @UnresolvedImport
from java.io import IOException # type:ignore @UnresolvedImport from ghidra.framework.model import ProjectLocator # type:ignore @UnresolvedImport
if binary_path is not None: if binary_path is not None:
binary_path = Path(binary_path) binary_path = Path(binary_path)
if project_location: if project_location:
@@ -95,7 +95,6 @@ def _setup_project(
if not project_name: if not project_name:
project_name = f"{binary_path.name}_ghidra" project_name = f"{binary_path.name}_ghidra"
project_location /= project_name project_location /= project_name
project_location.mkdir(exist_ok=True, parents=True)
if isinstance(loader, str): if isinstance(loader, str):
from java.lang import ClassNotFoundException # type:ignore @UnresolvedImport from java.lang import ClassNotFoundException # type:ignore @UnresolvedImport
@@ -113,13 +112,14 @@ def _setup_project(
# Open/Create project # Open/Create project
program: "Program" = None program: "Program" = None
try: if ProjectLocator(project_location, project_name).exists():
project = GhidraProject.openProject(project_location, project_name, True) project = GhidraProject.openProject(project_location, project_name, True)
if binary_path is not None: else:
if project.getRootFolder().getFile(binary_path.name): project_location.mkdir(exist_ok=True, parents=True)
program = project.openProgram("/", binary_path.name, False) project = GhidraProject.createProject(project_location, project_name, False)
except IOException: if binary_path is not None:
project = GhidraProject.createProject(project_location, project_name, False) if project.getRootFolder().getFile(binary_path.name):
program = project.openProgram("/", binary_path.name, False)
# NOTE: GhidraProject.importProgram behaves differently when a loader is provided # NOTE: GhidraProject.importProgram behaves differently when a loader is provided
# loaderClass may not be null so we must use the correct method override # loaderClass may not be null so we must use the correct method override

View File

@@ -1327,7 +1327,7 @@ vselcond: "ge"
vselcond: "gt" vselcond: "gt"
is ((TMode=0 & c2021=0b11) is ((TMode=0 & c2021=0b11)
| (TMode=1 & thv_c2021=0b11)) | (TMode=1 & thv_c2021=0b11))
{ tmp:1 = (!ZR); export tmp; } { tmp:1 = (!ZR && NG==OV); export tmp; }
vselcond: "vs" vselcond: "vs"
is ((TMode=0 & c2021=0b01) is ((TMode=0 & c2021=0b01)
| (TMode=1 & thv_c2021=0b01)) | (TMode=1 & thv_c2021=0b01))