mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Add debugger support for OpenBSD.
This commit is contained in:
@@ -103,6 +103,7 @@ data64_compiler_map: Dict[Optional[str], str] = {
|
|||||||
|
|
||||||
x86_compiler_map: Dict[Optional[str], str] = {
|
x86_compiler_map: Dict[Optional[str], str] = {
|
||||||
'GNU/Linux': 'gcc',
|
'GNU/Linux': 'gcc',
|
||||||
|
'OpenBSD': 'gcc',
|
||||||
'Windows': 'windows',
|
'Windows': 'windows',
|
||||||
# This may seem wrong, but Ghidra cspecs really describe the ABI
|
# This may seem wrong, but Ghidra cspecs really describe the ABI
|
||||||
'Cygwin': 'windows',
|
'Cygwin': 'windows',
|
||||||
@@ -110,6 +111,7 @@ x86_compiler_map: Dict[Optional[str], str] = {
|
|||||||
|
|
||||||
riscv_compiler_map: Dict[Optional[str], str] = {
|
riscv_compiler_map: Dict[Optional[str], str] = {
|
||||||
'GNU/Linux': 'gcc',
|
'GNU/Linux': 'gcc',
|
||||||
|
'OpenBSD': 'gcc',
|
||||||
'Cygwin': 'gcc',
|
'Cygwin': 'gcc',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ default_compiler_map: Dict[Optional[str], str] = {
|
|||||||
'freebsd': 'gcc',
|
'freebsd': 'gcc',
|
||||||
'linux': 'gcc',
|
'linux': 'gcc',
|
||||||
'netbsd': 'gcc',
|
'netbsd': 'gcc',
|
||||||
|
'openbsd': 'gcc',
|
||||||
'ps4': 'gcc',
|
'ps4': 'gcc',
|
||||||
'ios': 'gcc',
|
'ios': 'gcc',
|
||||||
'macosx': 'gcc',
|
'macosx': 'gcc',
|
||||||
|
|||||||
@@ -113,9 +113,10 @@ task buildFidHelpPdf(type: Exec) {
|
|||||||
// Check the OS before executing command.
|
// Check the OS before executing command.
|
||||||
doFirst {
|
doFirst {
|
||||||
if ( !(org.gradle.internal.os.OperatingSystem.current().isLinux()
|
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,
|
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.
|
// Check the OS before executing command.
|
||||||
doFirst {
|
doFirst {
|
||||||
if (!getCurrentPlatformName().startsWith("linux")) {
|
if (!(getCurrentPlatformName().startsWith("linux")
|
||||||
throw new TaskExecutionException( it, new Exception("The '$it.name' task only works on Linux."))
|
|| getCurrentPlatformName().startsWith("openbsd"))) {
|
||||||
|
throw new TaskExecutionException( it, new Exception("The '$it.name' task only works on Linux or OpenBSD."))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import ghidra.framework.OperatingSystem;
|
import ghidra.framework.OperatingSystem;
|
||||||
import ghidra.pty.linux.LinuxPtyFactory;
|
import ghidra.pty.linux.LinuxPtyFactory;
|
||||||
|
import ghidra.pty.openbsd.OpenBSDPtyFactory;
|
||||||
import ghidra.pty.macos.MacosPtyFactory;
|
import ghidra.pty.macos.MacosPtyFactory;
|
||||||
import ghidra.pty.windows.ConPtyFactory;
|
import ghidra.pty.windows.ConPtyFactory;
|
||||||
|
|
||||||
@@ -40,6 +41,8 @@ public interface PtyFactory {
|
|||||||
return MacosPtyFactory.INSTANCE;
|
return MacosPtyFactory.INSTANCE;
|
||||||
case LINUX:
|
case LINUX:
|
||||||
return LinuxPtyFactory.INSTANCE;
|
return LinuxPtyFactory.INSTANCE;
|
||||||
|
case OPEN_BSD:
|
||||||
|
return OpenBSDPtyFactory.INSTANCE;
|
||||||
case WINDOWS:
|
case WINDOWS:
|
||||||
return ConPtyFactory.INSTANCE;
|
return ConPtyFactory.INSTANCE;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user