Merge remote-tracking branch

'origin/GP-7047_d-millar_PR-9338_bsdkurt_obsd.debugger' (Closes #9338)
This commit is contained in:
Ryan Kurtz
2026-07-07 12:17:23 -04:00
9 changed files with 130 additions and 8 deletions

View File

@@ -103,6 +103,7 @@ data64_compiler_map: Dict[Optional[str], str] = {
x86_compiler_map: Dict[Optional[str], str] = {
'GNU/Linux': 'gcc',
'OpenBSD': 'gcc',
'Windows': 'windows',
# This may seem wrong, but Ghidra cspecs really describe the ABI
'Cygwin': 'windows',
@@ -110,6 +111,7 @@ x86_compiler_map: Dict[Optional[str], str] = {
riscv_compiler_map: Dict[Optional[str], str] = {
'GNU/Linux': 'gcc',
'OpenBSD': 'gcc',
'Cygwin': 'gcc',
}

View File

@@ -135,6 +135,7 @@ default_compiler_map: Dict[Optional[str], str] = {
'freebsd': 'gcc',
'linux': 'gcc',
'netbsd': 'gcc',
'openbsd': 'gcc',
'ps4': 'gcc',
'ios': 'gcc',
'macosx': 'gcc',

View File

@@ -113,9 +113,10 @@ task buildFidHelpPdf(type: Exec) {
// Check the OS before executing command.
doFirst {
if ( !(org.gradle.internal.os.OperatingSystem.current().isLinux()
|| org.gradle.internal.os.OperatingSystem.current().isMacOsX())) {
|| org.gradle.internal.os.OperatingSystem.current().isMacOsX()
|| org.gradle.internal.os.OperatingSystem.current().isOpenBSD())) {
throw new TaskExecutionException( it,
new Exception( "The '$it.name' task only works on Linux or Mac Os X" ))
new Exception( "The '$it.name' task only works on Linux, Mac Os X or OpenBSD" ))
}
}
@@ -177,8 +178,9 @@ task buildFidHelpHtml(type: Exec) {
// Check the OS before executing command.
doFirst {
if (!getCurrentPlatformName().startsWith("linux")) {
throw new TaskExecutionException( it, new Exception("The '$it.name' task only works on Linux."))
if (!(getCurrentPlatformName().startsWith("linux")
|| getCurrentPlatformName().startsWith("openbsd"))) {
throw new TaskExecutionException( it, new Exception("The '$it.name' task only works on Linux or OpenBSD."))
}
}

View File

@@ -4,9 +4,9 @@
* 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.
@@ -19,6 +19,7 @@ import java.io.IOException;
import ghidra.framework.OperatingSystem;
import ghidra.pty.linux.LinuxPtyFactory;
import ghidra.pty.openbsd.OpenBSDPtyFactory;
import ghidra.pty.macos.MacosPtyFactory;
import ghidra.pty.windows.ConPtyFactory;
@@ -40,6 +41,8 @@ public interface PtyFactory {
return MacosPtyFactory.INSTANCE;
case LINUX:
return LinuxPtyFactory.INSTANCE;
case OPEN_BSD:
return OpenBSDPtyFactory.INSTANCE;
case WINDOWS:
return ConPtyFactory.INSTANCE;
default:

View File

@@ -0,0 +1,38 @@
/* ###
* 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.
*/
package ghidra.pty.openbsd;
import ghidra.pty.unix.PosixC.Ioctls;
import ghidra.pty.unix.UnixPtySessionLeader;
public enum OpenBSDIoctls implements Ioctls {
INSTANCE;
@Override
public Class<? extends UnixPtySessionLeader> leaderClass() {
return OpenBSDPtySessionLeader.class;
}
@Override
public long TIOCSCTTY() {
return 0x20007461L;
}
@Override
public long TIOCSWINSZ() {
return 0x80087467L;
}
}

View File

@@ -0,0 +1,40 @@
/* ###
* 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.
*/
package ghidra.pty.openbsd;
import java.io.IOException;
import ghidra.pty.Pty;
import ghidra.pty.PtyFactory;
import ghidra.pty.unix.UnixPty;
public enum OpenBSDPtyFactory implements PtyFactory {
INSTANCE;
@Override
public Pty openpty(short cols, short rows) throws IOException {
UnixPty pty = UnixPty.openpty(OpenBSDIoctls.INSTANCE);
if (cols != 0 && rows != 0) {
pty.getChild().setWindowSize(cols, rows);
}
return pty;
}
@Override
public String getDescription() {
return "local (OpenBSD)";
}
}

View File

@@ -0,0 +1,33 @@
/* ###
* 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.
*/
package ghidra.pty.openbsd;
import ghidra.pty.unix.PosixC.Ioctls;
import ghidra.pty.unix.UnixPtySessionLeader;
public class OpenBSDPtySessionLeader extends UnixPtySessionLeader {
public static void main(String[] args) throws Exception {
OpenBSDPtySessionLeader leader = new OpenBSDPtySessionLeader();
leader.parseArgs(args);
leader.run();
}
@Override
protected Ioctls ioctls() {
return OpenBSDIoctls.INSTANCE;
}
}

View File

@@ -203,8 +203,8 @@ Ghidra supports running on the following additional platforms with user-built na
* Linux ARM 64-bit
* FreeBSD x86 64-bit (no debugger support)
* FreeBSD ARM 64-bit (no debugger support)
* OpenBSD x86 64-bit (no debugger support)
* OpenBSD ARM 64-bit (no debugger support)
* OpenBSD x86 64-bit
* OpenBSD ARM 64-bit
For supported systems where native binaries have not been supplied, or those that are supplied fail
to run properly, it may be necessary to build the native Ghidra binaries. In order to build native

View File

@@ -53,6 +53,9 @@ dependencies {
protocArtifact "com.google.protobuf:protoc:${version}:osx-aarch_64@exe"
}
}
if (isCurrentOpenBSD()) {
protocArtifact files('/usr/local/bin/protoc')
}
}
/*protobuf {