Merge remote-tracking branch 'origin/GP-0_d-millar_accidental_reversion_in_GP-4686' into patch

This commit is contained in:
Ryan Kurtz 2024-11-19 12:37:29 -05:00
commit fc7b0ef327
2 changed files with 18 additions and 23 deletions

View File

@ -9,9 +9,9 @@
::@menu-group local ::@menu-group local
::@icon icon.debugger ::@icon icon.debugger
::@help TraceRmiLauncherServicePlugin#dbgeng_attach ::@help TraceRmiLauncherServicePlugin#dbgeng_attach
::@env OPT_PYTHON_EXE:file="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH." ::@env OPT_PYTHON_EXE:file!="python" "Python command" "The path to the Python 3 interpreter. Omit the full path to resolve using the system PATH."
::@env OPT_TARGET_PID:str="" "Process id" "The target process id" ::@env OPT_TARGET_PID:int=0 "Process id" "The target process id"
::@env OPT_ATTACH_FLAGS:str="0" "Attach flags" "Attach flags" ::@env OPT_ATTACH_FLAGS:int=0 "Attach flags" "Attach flags"
::@env OPT_USE_DBGMODEL:bool=true "Use dbgmodel" "Load and use dbgmodel.dll if it is available." ::@env OPT_USE_DBGMODEL:bool=true "Use dbgmodel" "Load and use dbgmodel.dll if it is available."
::@env WINDBG_DIR:dir="" "Path to dbgeng.dll directory" "Path containing dbgeng and associated DLLS (if not Windows Kits)." ::@env WINDBG_DIR:dir="" "Path to dbgeng.dll directory" "Path containing dbgeng and associated DLLS (if not Windows Kits)."

View File

@ -1,17 +1,17 @@
## ### ## ###
# IP: GHIDRA # IP: GHIDRA
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
## ##
from ghidratrace.client import Address, RegVal from ghidratrace.client import Address, RegVal
from pybag import pydbg from pybag import pydbg
@ -204,16 +204,11 @@ class DefaultMemoryMapper(object):
self.defaultSpace = defaultSpace self.defaultSpace = defaultSpace
def map(self, proc: int, offset: int): def map(self, proc: int, offset: int):
if proc == 0: space = self.defaultSpace
space = self.defaultSpace
else:
space = f'{self.defaultSpace}{proc}'
return self.defaultSpace, Address(space, offset) return self.defaultSpace, Address(space, offset)
def map_back(self, proc: int, address: Address) -> int: def map_back(self, proc: int, address: Address) -> int:
if address.space == self.defaultSpace and proc == 0: if address.space == self.defaultSpace:
return address.offset
if address.space == f'{self.defaultSpace}{proc}':
return address.offset return address.offset
raise ValueError(f"Address {address} is not in process {proc}") raise ValueError(f"Address {address} is not in process {proc}")