From c06fc18cc2a0f772d08c2dce99f501040416d2e7 Mon Sep 17 00:00:00 2001 From: d-millar <33498836+d-millar@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:19:48 +0000 Subject: [PATCH] GP-5083: print warnings --- .../src/main/py/src/ghidradbg/arch.py | 30 +++++++++++-------- .../src/main/py/src/ghidragdb/arch.py | 30 +++++++++++-------- .../src/main/py/src/ghidralldb/arch.py | 30 +++++++++++-------- 3 files changed, 51 insertions(+), 39 deletions(-) diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py index 94c76ecaf5..1a507fbd76 100644 --- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py +++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/src/ghidradbg/arch.py @@ -1,17 +1,17 @@ ## ### -# IP: GHIDRA -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# IP: GHIDRA +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ## from ghidratrace.client import Address, RegVal from pybag import pydbg @@ -182,13 +182,17 @@ def compute_ghidra_compiler(lang): # Check if the selected lang has specific compiler recommendations if not lang in compiler_map: + print(f"{lang} not found in compiler map") return 'default' comp_map = compiler_map[lang] + if comp_map == data64_compiler_map: + print(f"Using the DATA64 compiler map") osabi = get_osabi() if osabi in comp_map: return comp_map[osabi] if None in comp_map: return comp_map[None] + print(f"{osabi} not found in compiler map") return 'default' diff --git a/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/arch.py b/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/arch.py index 3c115c99d7..e4047369d5 100644 --- a/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/arch.py +++ b/Ghidra/Debug/Debugger-agent-gdb/src/main/py/src/ghidragdb/arch.py @@ -1,17 +1,17 @@ ## ### -# IP: GHIDRA -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# IP: GHIDRA +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ## from ghidratrace.client import Address, RegVal @@ -163,13 +163,17 @@ def compute_ghidra_compiler(lang): # Check if the selected lang has specific compiler recommendations if not lang in compiler_map: + print(f"{lang} not found in compiler map") return 'default' comp_map = compiler_map[lang] + if comp_map == data64_compiler_map: + print(f"Using the DATA64 compiler map") osabi = get_osabi() if osabi in comp_map: return comp_map[osabi] if None in comp_map: return comp_map[None] + print(f"{osabi} not found in compiler map") return 'default' diff --git a/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py b/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py index eca5ae3f04..87146b2730 100644 --- a/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py +++ b/Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py @@ -1,17 +1,17 @@ ## ### -# IP: GHIDRA -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# IP: GHIDRA +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ## from ghidratrace.client import Address, RegVal import lldb @@ -225,8 +225,11 @@ def compute_ghidra_compiler(lang): key=lambda l: compiler_map[l] ) if len(matched_lang) == 0: + print(f"{lang} not found in compiler map") return 'default' comp_map = compiler_map[matched_lang[0]] + if comp_map == data64_compiler_map: + print(f"Using the DATA64 compiler map") osabi = get_osabi() matched_osabi = sorted( (l for l in comp_map if l in osabi), @@ -236,6 +239,7 @@ def compute_ghidra_compiler(lang): return comp_map[matched_osabi[0]] if None in comp_map: return comp_map[None] + print(f"{osabi} not found in compiler map") return 'default'