pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

edb-debugger: Clone openbsd support bits to new netbsd target



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Thu Jan 7 04:05:22 2016 +0100
Changeset:	0de79580b5b5c74ac1fc97d250a201882536f99c

Modified Files:
	edb-debugger/distinfo
Added Files:
	edb-debugger/patches/patch-plugins_DebuggerCore_DebuggerCore.pro
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp
	edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h
	edb-debugger/patches/patch-plugins_plugins.pri
	edb-debugger/patches/patch-src_src.pro

Log Message:
edb-debugger: Clone openbsd support bits to new netbsd target

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=0de79580b5b5c74ac1fc97d250a201882536f99c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 edb-debugger/distinfo                              |  11 +
 .../patch-plugins_DebuggerCore_DebuggerCore.pro    |  16 +
 ...ugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp | 741 +++++++++++++++++++++
 ...plugins_DebuggerCore_unix_netbsd_DebuggerCore.h | 111 +++
 ...gins_DebuggerCore_unix_netbsd_PlatformEvent.cpp | 264 ++++++++
 ...lugins_DebuggerCore_unix_netbsd_PlatformEvent.h |  67 ++
 ...ins_DebuggerCore_unix_netbsd_PlatformRegion.cpp | 101 +++
 ...ugins_DebuggerCore_unix_netbsd_PlatformRegion.h |  73 ++
 ...gins_DebuggerCore_unix_netbsd_PlatformState.cpp | 398 +++++++++++
 ...lugins_DebuggerCore_unix_netbsd_PlatformState.h |  73 ++
 edb-debugger/patches/patch-plugins_plugins.pri     |  18 +
 edb-debugger/patches/patch-src_src.pro             |  56 ++
 12 files changed, 1929 insertions(+)

diffs:
diff --git a/edb-debugger/distinfo b/edb-debugger/distinfo
index d9ab5ce..5146d8c 100644
--- a/edb-debugger/distinfo
+++ b/edb-debugger/distinfo
@@ -6,6 +6,17 @@ SHA512 (debugger-0.9.20.tgz) = c65c023c351ee7aee47dbb743a6e84e9b9c680e9eef39caa1
 Size (debugger-0.9.20.tgz) = 791820 bytes
 SHA1 (patch-plugins_BinaryInfo_ELF32.cpp) = bf9ea68d80be00f4ccfdbeecdb774916a8491954
 SHA1 (patch-plugins_BinaryInfo_ELF64.cpp) = 255a25419ec7eaaa3231eb168c7dac2c92430fbe
+SHA1 (patch-plugins_DebuggerCore_DebuggerCore.pro) = 2afec83ad714818d6535327f6f0b64a448d3b77c
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp) = 8142fc93bf5afdffa3c5d469bb7d805e2133cd4b
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h) = 1e841035c6238d2f36e588306b44991b0cebcefa
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp) = e4d386f0f7f2bacdb419d6811ca853913b14a6ac
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h) = 047ea37f192c5da8a96e4f1ee7d0c21fe72a6d6e
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp) = d760076ead3167e1b04a072b1d61321c7f8ea148
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h) = b41a91d68f9d649a967fc60be08939d3dea92c85
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp) = 4ae2040b5ce27747f37ba472ddf76d49a1459505
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h) = 3affef2a2462fc7952e7eee38cba19ee7d0fa2bc
 SHA1 (patch-plugins_HeapAnalyzer_DialogHeap.cpp) = 7e58098de5024568ad5db428d772507283d83d31
 SHA1 (patch-plugins_ProcessProperties_DialogProcessProperties.cpp) = b115da629d9cc9342d360765866c6d5059fd774b
+SHA1 (patch-plugins_plugins.pri) = fe6aa23cdba0938e01a465475517eca8499af78e
 SHA1 (patch-src_Debugger.cpp) = ba7425b45916b72e6ed81f01b413d03989dcac9f
+SHA1 (patch-src_src.pro) = 2f1515fcb18544080eb846ea1337610a400ecc89
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_DebuggerCore.pro b/edb-debugger/patches/patch-plugins_DebuggerCore_DebuggerCore.pro
new file mode 100644
index 0000000..b4e6d16
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_DebuggerCore.pro
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/DebuggerCore.pro.orig	2013-07-26 01:50:18.000000000 +0000
++++ plugins/DebuggerCore/DebuggerCore.pro
+@@ -13,6 +13,11 @@ unix {
+ 		INCLUDEPATH += unix/linux
+ 	}
+ 
++	netbsd-* {
++		VPATH       += unix/netbsd
++		INCLUDEPATH += unix/netbsd
++	}
++
+ 	openbsd-* {
+ 		VPATH       += unix/openbsd
+ 		INCLUDEPATH += unix/openbsd
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp
new file mode 100644
index 0000000..208f447
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp
@@ -0,0 +1,741 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/DebuggerCore.cpp.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/DebuggerCore.cpp
+@@ -0,0 +1,736 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#include "DebuggerCore.h"
++#include "PlatformEvent.h"
++#include "PlatformRegion.h"
++#include "PlatformState.h"
++#include "State.h"
++#include "string_hash.h"
++
++#include <QDebug>
++#include <QMessageBox>
++
++#include <cerrno>
++#include <cstring>
++
++#include <fcntl.h>
++#include <kvm.h>
++#include <machine/reg.h>
++#include <paths.h>
++#include <signal.h>
++#include <sys/exec.h>
++#include <sys/lock.h>
++#include <sys/mman.h>
++#include <sys/param.h>
++#include <sys/ptrace.h>
++#include <sys/types.h>
++#include <sys/user.h>
++#include <sys/wait.h>
++#include <unistd.h>
++#include <uvm/uvm.h>
++
++#define __need_process
++#include <sys/sysctl.h>
++#include <sys/proc.h>
++
++namespace DebuggerCore {
++
++namespace {
++int resume_code(int status) {
++	if(WIFSIGNALED(status)) {
++		return WTERMSIG(status);
++	} else if(WIFSTOPPED(status)) {
++		return WSTOPSIG(status);
++	}
++	return 0;
++}
++
++#if defined(OpenBSD) && (OpenBSD > 201205)
++//------------------------------------------------------------------------------
++// Name: load_vmmap_entries
++// Desc: Download vmmap_entries from the kernel into our address space.
++//       We fix up the addr tree while downloading.
++//       Returns the size of the tree on success, or -1 on failure.
++//       On failure, *rptr needs to be passed to unload_vmmap_entries to free
++//       the lot.
++//------------------------------------------------------------------------------
++ssize_t load_vmmap_entries(kvm_t *kd, u_long kptr, struct vm_map_entry **rptr, struct vm_map_entry *parent) {
++	struct vm_map_entry *entry;
++	u_long left_kptr;
++	u_long right_kptr;
++	ssize_t left_sz;
++	ssize_t right_sz;
++
++	if (kptr == 0)
++		return 0;
++
++	/* Need space. */
++	entry = (struct vm_map_entry *)malloc(sizeof(*entry));
++	if (entry == NULL)
++		return -1;
++
++	/* Download entry at kptr. */
++	if (!kvm_read(kd, kptr, (char *)entry, sizeof(*entry))) {
++		free(entry);
++		return -1;
++	}
++
++	/*
++	 * Update addr pointers to have sane values in this address space.
++	 * We save the kernel pointers in {left,right}_kptr, so we have them
++	 * available to download children.
++	 */
++	left_kptr = (u_long) RB_LEFT(entry, daddrs.addr_entry);
++	right_kptr = (u_long) RB_RIGHT(entry, daddrs.addr_entry);
++	RB_LEFT(entry, daddrs.addr_entry) = RB_RIGHT(entry, daddrs.addr_entry) = NULL;
++	/* Fill in parent pointer. */
++	RB_PARENT(entry, daddrs.addr_entry) = parent;
++
++	/*
++	 * Consistent state reached, fill in *rptr.
++	 */
++	*rptr = entry;
++
++	/*
++	 * Download left, right.
++	 * On failure, our map is in a state that can be handled by
++	 * unload_vmmap_entries.
++	 */
++	left_sz = load_vmmap_entries(kd, left_kptr, &RB_LEFT(entry, daddrs.addr_entry), entry);
++	if (left_sz == -1)
++		return -1;
++	right_sz = load_vmmap_entries(kd, right_kptr, &RB_RIGHT(entry, daddrs.addr_entry), entry);
++	if (right_sz == -1)
++		return -1;
++
++	return 1 + left_sz + right_sz;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc: Free the vmmap entries in the given tree.
++//------------------------------------------------------------------------------
++void unload_vmmap_entries(struct vm_map_entry *entry) {
++	if (entry == NULL)
++		return;
++
++	unload_vmmap_entries(RB_LEFT(entry, daddrs.addr_entry));
++	unload_vmmap_entries(RB_RIGHT(entry, daddrs.addr_entry));
++	free(entry);
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc: Don't implement address comparison.
++//------------------------------------------------------------------------------
++int no_impl(void *p, void *q) {
++	Q_UNUSED(p);
++	Q_UNUSED(q);
++	Q_ASSERT(0); /* Should not be called. */
++	return 0;
++}
++#endif
++}
++
++#if defined(OpenBSD) && (OpenBSD > 201205)
++RB_GENERATE(uvm_map_addr, vm_map_entry, daddrs.addr_entry, no_impl)
++#endif
++
++//------------------------------------------------------------------------------
++// Name: DebuggerCore
++// Desc: constructor
++//------------------------------------------------------------------------------
++DebuggerCore::DebuggerCore() {
++#if defined(_SC_PAGESIZE)
++	page_size_ = sysconf(_SC_PAGESIZE);
++#elif defined(_SC_PAGE_SIZE)
++	page_size_ = sysconf(_SC_PAGE_SIZE);
++#else
++	page_size_ = PAGE_SIZE;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc: 
++//------------------------------------------------------------------------------
++bool DebuggerCore::has_extension(quint64 ext) const {
++	return false;
++}
++
++//------------------------------------------------------------------------------
++// Name: page_size
++// Desc: returns the size of a page on this system
++//------------------------------------------------------------------------------
++edb::address_t DebuggerCore::page_size() const {
++	return page_size_;
++}
++
++//------------------------------------------------------------------------------
++// Name: ~DebuggerCore
++// Desc:
++//------------------------------------------------------------------------------
++DebuggerCore::~DebuggerCore() {
++	detach();
++}
++
++//------------------------------------------------------------------------------
++// Name: wait_debug_event
++// Desc: waits for a debug event, msecs is a timeout
++//      it will return false if an error or timeout occurs
++//------------------------------------------------------------------------------
++IDebugEvent::const_pointer DebuggerCore::wait_debug_event(int msecs) {
++	if(attached()) {
++		int status;
++		bool timeout;
++
++		const edb::tid_t tid = native::waitpid_timeout(pid(), &status, 0, msecs, &timeout);
++		if(!timeout) {
++			if(tid > 0) {
++
++				// normal event
++				PlatformEvent *const e = new PlatformEvent;
++
++				e->pid    = pid();
++				e->tid    = tid;
++				e->status = status;
++
++				char errbuf[_POSIX2_LINE_MAX];
++				if(kvm_t *const kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) {
++					int rc;
++					struct kinfo_proc *const kiproc = kvm_getprocs(kd, KERN_PROC_PID, pid(), sizeof(struct kinfo_proc), &rc);
++
++					struct proc proc;
++					kvm_read(kd, kiproc->p_paddr, &proc, sizeof(proc));
++
++					e->fault_code_    = proc.p_sicode;
++					e->fault_address_ = proc.p_sigval.sival_ptr;
++
++					//printf("ps_sig   : %d\n", sigacts.ps_sig);
++					//printf("ps_type  : %d\n", sigacts.ps_type);
++
++					kvm_close(kd);
++				} else {
++					e->fault_code_    = 0;
++					e->fault_address_ = 0;
++				}
++
++
++				active_thread_       = tid;
++				threads_[tid].status = status;
++				return IDebugEvent::const_pointer(e);
++			}
++		}
++	}
++	return IDebugEvent::const_pointer();
++}
++
++//------------------------------------------------------------------------------
++// Name: read_data
++// Desc:
++//------------------------------------------------------------------------------
++long DebuggerCore::read_data(edb::address_t address, bool *ok) {
++
++	Q_ASSERT(ok);
++	
++	errno = 0;
++	const long v = ptrace(PT_READ_D, pid(), reinterpret_cast<char*>(address), 0);
++	SET_OK(*ok, v);
++	return v;
++}
++
++//------------------------------------------------------------------------------
++// Name: write_data
++// Desc:
++//------------------------------------------------------------------------------
++bool DebuggerCore::write_data(edb::address_t address, long value) {
++	return ptrace(PT_WRITE_D, pid(), reinterpret_cast<char*>(address), value) != -1;
++}
++
++//------------------------------------------------------------------------------
++// Name: attach
++// Desc:
++//------------------------------------------------------------------------------
++bool DebuggerCore::attach(edb::pid_t pid) {
++	detach();
++
++	const long ret = ptrace(PT_ATTACH, pid, 0, 0);
++	if(ret == 0) {
++		pid_           = pid;
++		active_thread_ = pid;
++		threads_.clear();
++		threads_.insert(pid, thread_info());
++
++		// TODO: attach to all of the threads
++	}
++
++	return ret == 0;
++}
++
++//------------------------------------------------------------------------------
++// Name: detach
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::detach() {
++	if(attached()) {
++	
++		// TODO: do i need to stop each thread first, and wait for them?
++	
++		clear_breakpoints();
++		ptrace(PT_DETACH, pid(), 0, 0);
++		pid_ = 0;
++		threads_.clear();
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: kill
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::kill() {
++	if(attached()) {
++		clear_breakpoints();
++		ptrace(PT_KILL, pid(), 0, 0);
++		native::waitpid(pid(), 0, WAIT_ANY);
++		pid_ = 0;
++		threads_.clear();
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: pause
++// Desc: stops *all* threads of a process
++//------------------------------------------------------------------------------
++void DebuggerCore::pause() {
++	if(attached()) {
++		for(threadmap_t::const_iterator it = threads_.begin(); it != threads_.end(); ++it) {
++			::kill(it.key(), SIGSTOP);
++		}
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: resume
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::resume(edb::EVENT_STATUS status) {
++	// TODO: assert that we are paused
++
++	if(attached()) {
++		if(status != edb::DEBUG_STOP) {
++			const edb::tid_t tid = active_thread();
++			const int code = (status == edb::DEBUG_EXCEPTION_NOT_HANDLED) ? resume_code(threads_[tid].status) : 0;
++			ptrace(PT_CONTINUE, tid, reinterpret_cast<caddr_t>(1), code);
++		}
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: step
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::step(edb::EVENT_STATUS status) {
++	// TODO: assert that we are paused
++
++	if(attached()) {
++		if(status != edb::DEBUG_STOP) {
++			const edb::tid_t tid = active_thread();
++			const int code = (status == edb::DEBUG_EXCEPTION_NOT_HANDLED) ? resume_code(threads_[tid].status) : 0;
++			ptrace(PT_STEP, tid, reinterpret_cast<caddr_t>(1), code);
++		}
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: get_state
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::get_state(State *state) {
++	
++	Q_ASSERT(state);
++	
++	// TODO: assert that we are paused
++	PlatformState *const state_impl = static_cast<PlatformState *>(state->impl_);
++
++	if(attached()) {
++		if(ptrace(PT_GETREGS, active_thread(), reinterpret_cast<char*>(&state_impl->regs_), 0) != -1) {
++			// TODO
++			state_impl->gs_base = 0;
++			state_impl->fs_base = 0;
++		}
++
++		if(ptrace(PT_GETFPREGS, active_thread(), reinterpret_cast<char*>(&state_impl->fpregs_), 0) != -1) {
++		}
++
++		// TODO: Debug Registers
++
++	} else {
++		state->clear();
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: set_state
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::set_state(const State &state) {
++
++	// TODO: assert that we are paused
++	PlatformState *const state_impl = static_cast<PlatformState *>(state.impl_);
++
++	if(attached()) {
++		ptrace(PT_SETREGS, active_thread(), reinterpret_cast<char*>(&state_impl->regs_), 0);
++
++		// TODO: FPU
++		// TODO: Debug Registers
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: open
++// Desc:
++//------------------------------------------------------------------------------
++bool DebuggerCore::open(const QString &path, const QString &cwd, const QList<QByteArray> &args, const QString &tty) {
++	detach();
++	pid_t pid;
++
++	switch(pid = fork()) {
++	case 0:
++		// we are in the child now...
++
++		// set ourselves (the child proc) up to be traced
++		ptrace(PT_TRACE_ME, 0, 0, 0);
++
++		// redirect it's I/O
++		if(!tty.isEmpty()) {
++			FILE *const std_out = freopen(qPrintable(tty), "r+b", stdout);
++			FILE *const std_in  = freopen(qPrintable(tty), "r+b", stdin);
++			FILE *const std_err = freopen(qPrintable(tty), "r+b", stderr);
++
++			Q_UNUSED(std_out);
++			Q_UNUSED(std_in);
++			Q_UNUSED(std_err);
++		}
++
++		// do the actual exec
++		execute_process(path, cwd, args);
++
++		// we should never get here!
++		abort();
++		break;
++	case -1:
++		// error!
++		pid_ = 0;
++		return false;
++	default:
++		// parent
++		do {
++			threads_.clear();
++
++			int status;
++			if(native::waitpid(pid, &status, 0) == -1) {
++				return false;
++			}
++
++			// the very first event should be a STOP of type SIGTRAP
++			if(!WIFSTOPPED(status) || WSTOPSIG(status) != SIGTRAP) {
++				detach();
++				return false;
++			}
++
++			// setup the first event data for the primary thread
++			threads_.insert(pid, thread_info());
++			pid_                 = pid;
++			active_thread_       = pid;
++			threads_[pid].status = status;
++			return true;
++		} while(0);
++		break;
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: set_active_thread
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::set_active_thread(edb::tid_t tid) {
++	Q_ASSERT(threads_.contains(tid));
++	active_thread_ = tid;
++}
++
++
++//------------------------------------------------------------------------------
++// Name: create_state
++// Desc:
++//------------------------------------------------------------------------------
++IState *DebuggerCore::create_state() const {
++	return new PlatformState;
++}
++
++//------------------------------------------------------------------------------
++// Name: enumerate_processes
++// Desc:
++//------------------------------------------------------------------------------
++QMap<edb::pid_t, Process> DebuggerCore::enumerate_processes() const {
++	QMap<edb::pid_t, Process> ret;
++	
++	char ebuffer[_POSIX2_LINE_MAX];
++	int numprocs;
++
++	if(kvm_t *const kaccess = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, ebuffer)) {
++		if(struct kinfo_proc *const kprocaccess = kvm_getprocs(kaccess, KERN_PROC_ALL, 0, sizeof *kprocaccess, &numprocs)) {
++			for(int i = 0; i < numprocs; ++i) {
++				Process procInfo;
++				procInfo.pid  = kprocaccess[i].p_pid;
++				procInfo.uid  = kprocaccess[i].p_uid;
++				procInfo.name = kprocaccess[i].p_comm;
++
++				ret.insert(procInfo.pid, procInfo);
++			}
++		}
++		kvm_close(kaccess);
++	} else {
++		QMessageBox::warning(0, "Error Listing Processes", ebuffer);
++	}
++	
++	return ret;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc:
++//------------------------------------------------------------------------------
++QString DebuggerCore::process_exe(edb::pid_t pid) const {
++	QString ret;
++
++	char errbuf[_POSIX2_LINE_MAX];
++	if(kvm_t *kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) {
++		char p_comm[KI_MAXCOMLEN] = "";
++		int rc;
++		if(struct kinfo_proc *const proc = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &rc)) {
++			memcpy(p_comm, proc->p_comm, sizeof(p_comm));
++		}
++
++		kvm_close(kd);
++		return p_comm;
++	}
++
++	return ret;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc:
++//------------------------------------------------------------------------------
++QString DebuggerCore::process_cwd(edb::pid_t pid) const {
++	// TODO: implement this
++	return QString();
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc:
++//------------------------------------------------------------------------------
++edb::pid_t DebuggerCore::parent_pid(edb::pid_t pid) const {
++	edb::pid_t ret = 0;
++	char errbuf[_POSIX2_LINE_MAX];
++	if(kvm_t *kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) {
++		int rc;
++		struct kinfo_proc *const proc = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof *proc, &rc);
++		ret = proc->p_ppid;
++		kvm_close(kd);
++	}
++	return ret;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc:
++//------------------------------------------------------------------------------
++QList<IRegion::pointer> DebuggerCore::memory_regions() const {
++
++	QList<IRegion::pointer> regions;
++
++	if(pid_ != 0) {
++
++		char err_buf[_POSIX2_LINE_MAX];
++		if(kvm_t *const kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, err_buf)) {
++			int rc;
++			struct kinfo_proc *const proc = kvm_getprocs(kd, KERN_PROC_PID, pid_, sizeof *proc, &rc);
++			Q_ASSERT(proc);
++
++			struct vmspace vmsp;
++			
++
++			kvm_read(kd, proc->p_vmspace, &vmsp, sizeof vmsp);
++
++#if defined(OpenBSD) && (OpenBSD > 201205)
++			uvm_map_addr root;
++			RB_INIT(&root);
++			if (load_vmmap_entries(kd, (u_long)RB_ROOT(&vmsp.vm_map.addr), &RB_ROOT(&root), NULL) == -1)
++				goto do_unload;
++
++			struct vm_map_entry *e;
++			RB_FOREACH(e, uvm_map_addr, &root) {
++				const edb::address_t start               = e->start;
++				const edb::address_t end                 = e->end;
++				const edb::address_t base                = e->offset;
++				const QString name                       = QString();
++				const IRegion::permissions_t permissions = 
++					((e->protection & VM_PROT_READ)    ? PROT_READ  : 0) |
++					((e->protection & VM_PROT_WRITE)   ? PROT_WRITE : 0) |
++					((e->protection & VM_PROT_EXECUTE) ? PROT_EXEC  : 0);
++
++				regions.push_back(IRegion::pointer(new PlatformRegion(start, end, base, name, permissions)));
++			}
++			
++do_unload:
++			unload_vmmap_entries(RB_ROOT(&root));
++#else
++			struct vm_map_entry e;
++			if(vmsp.vm_map.header.next != 0) {
++				kvm_read(kd, (u_long)vmsp.vm_map.header.next, &e, sizeof(e));
++				while(e.next != vmsp.vm_map.header.next) {
++				
++					const edb::address_t start               = e.start;
++					const edb::address_t end                 = e.end;
++					const edb::address_t base                = e.offset;
++					const QString name                       = QString();
++					const IRegion::permissions_t permissions = 
++						((e.protection & VM_PROT_READ)    ? PROT_READ  : 0) |
++						((e.protection & VM_PROT_WRITE)   ? PROT_WRITE : 0) |
++						((e.protection & VM_PROT_EXECUTE) ? PROT_EXEC  : 0);
++
++					regions.push_back(IRegion::pointer(new PlatformRegion(start, end, base, name, permissions)));
++					kvm_read(kd, (u_long)e.next, &e, sizeof(e));
++				}
++			}
++#endif
++			kvm_close(kd);
++		} else {
++			fprintf(stderr, "sync: %s\n", err_buf);
++			return QList<IRegion::pointer>();
++		}
++	}
++
++	return regions;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++// Desc:
++//------------------------------------------------------------------------------
++QList<QByteArray> DebuggerCore::process_args(edb::pid_t pid) const {
++	QList<QByteArray> ret;
++	if(pid != 0) {
++
++		// TODO: assert attached!
++		char errbuf[_POSIX2_LINE_MAX];
++		if(kvm_t *kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) {
++			int rc;
++			if(struct kinfo_proc *const proc = kvm_getprocs(kd, KERN_PROC_PID, sizeof *proc, pid, &rc)) {
++				char **argv = kvm_getargv(kd, proc, 0);
++				char **p = argv;
++				while(*p) {
++					ret << *p++;
++				}
++			}
++			kvm_close(kd);
++		}
++
++	}
++	return ret;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++edb::address_t DebuggerCore::process_code_address() const {
++	qDebug() << "TODO: implement DebuggerCore::process_code_address";
++	return 0;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++edb::address_t DebuggerCore::process_data_address() const {
++	qDebug() << "TODO: implement DebuggerCore::process_data_address";
++	return 0;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QList<Module> DebuggerCore::loaded_modules() const {
++    QList<Module> modules;
++	qDebug() << "TODO: implement DebuggerCore::loaded_modules";
++    return modules;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QDateTime DebuggerCore::process_start(edb::pid_t pid) const {
++	qDebug() << "TODO: implement DebuggerCore::process_start";
++	return QDateTime();
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++quint64 DebuggerCore::cpu_type() const {
++#ifdef EDB_X86
++	return edb::string_hash<'x', '8', '6'>::value;
++#elif defined(EDB_X86_64)
++	return edb::string_hash<'x', '8', '6', '-', '6', '4'>::value;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QWidget *DebuggerCore::create_register_view() const {
++	return 0;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QString DebuggerCore::format_pointer(edb::address_t address) const {
++	char buf[32];
++#ifdef EDB_X86
++	qsnprintf(buf, sizeof(buf), "%08x", address);
++#elif defined(EDB_X86_64)
++	qsnprintf(buf, sizeof(buf), "%016llx", address);
++#endif
++	return buf;
++}
++
++#if QT_VERSION < 0x050000
++Q_EXPORT_PLUGIN2(DebuggerCore, DebuggerCore)
++#endif
++
++}
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h
new file mode 100644
index 0000000..f1791e0
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h
@@ -0,0 +1,111 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/DebuggerCore.h.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/DebuggerCore.h
+@@ -0,0 +1,106 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#ifndef DEBUGGERCORE_20090529_H_
++#define DEBUGGERCORE_20090529_H_
++
++#include "DebuggerCoreUNIX.h"
++#include <QHash>
++
++namespace DebuggerCore {
++
++class DebuggerCore : public DebuggerCoreUNIX {
++	Q_OBJECT
++	Q_INTERFACES(IDebuggerCore)
++	Q_CLASSINFO("author", "Evan Teran")
++	Q_CLASSINFO("url", "http://www.codef00.com";)
++
++public:
++	DebuggerCore();
++	virtual ~DebuggerCore();
++
++public:
++	virtual edb::address_t page_size() const;
++	virtual bool has_extension(quint64 ext) const;
++	virtual IDebugEvent::const_pointer wait_debug_event(int msecs);
++	virtual bool attach(edb::pid_t pid);
++	virtual void detach();
++	virtual void kill();
++	virtual void pause();
++	virtual void resume(edb::EVENT_STATUS status);
++	virtual void step(edb::EVENT_STATUS status);
++	virtual void get_state(State *state);
++	virtual void set_state(const State &state);
++	virtual bool open(const QString &path, const QString &cwd, const QList<QByteArray> &args, const QString &tty);
++
++public:
++	// thread support stuff (optional)
++	virtual QList<edb::tid_t> thread_ids() const { return threads_.keys(); }
++	virtual edb::tid_t active_thread() const     { return active_thread_; }
++	virtual void set_active_thread(edb::tid_t);
++
++public:
++	virtual QList<IRegion::pointer> memory_regions() const;
++	virtual edb::address_t process_code_address() const;
++	virtual edb::address_t process_data_address() const;
++
++public:
++	virtual IState *create_state() const;
++	virtual QWidget *create_register_view() const;
++
++public:
++	// process properties
++	virtual QList<QByteArray> process_args(edb::pid_t pid) const;
++	virtual QString process_exe(edb::pid_t pid) const;
++	virtual QString process_cwd(edb::pid_t pid) const;
++	virtual edb::pid_t parent_pid(edb::pid_t pid) const;
++	virtual QDateTime process_start(edb::pid_t pid) const;
++	virtual quint64 cpu_type() const;
++
++private:
++	virtual QMap<edb::pid_t, Process> enumerate_processes() const;
++	virtual QList<Module> loaded_modules() const;
++
++public:
++	virtual QString format_pointer(edb::address_t address) const;
++
++private:
++	virtual long read_data(edb::address_t address, bool *ok);
++	virtual bool write_data(edb::address_t address, long value);
++
++private:
++	struct thread_info {
++	public:
++		thread_info() : status(0) {
++		}
++
++		thread_info(int s) : status(s) {
++		}
++
++		int status;
++	};
++
++	typedef QHash<edb::tid_t, thread_info> threadmap_t;
++
++	edb::address_t page_size_;
++	threadmap_t    threads_;
++};
++
++}
++
++#endif
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp
new file mode 100644
index 0000000..61f2870
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp
@@ -0,0 +1,264 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformEvent.cpp.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformEvent.cpp
+@@ -0,0 +1,259 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#include "PlatformEvent.h"
++#include "edb.h"
++#include <cstdio>
++#include <cstring>
++#include <fcntl.h>
++#include <kvm.h>
++#include <sys/exec.h>
++#include <sys/mman.h>
++#include <sys/param.h>
++#include <sys/proc.h>
++#include <sys/ptrace.h>
++#include <sys/signalvar.h>
++#include <sys/sysctl.h>
++#include <sys/types.h>
++#include <sys/wait.h>
++#include <unistd.h>
++#include <uvm/uvm.h>
++#include <uvm/uvm_amap.h>
++#include <signal.h> // for the SIG* definitions
++
++namespace DebuggerCore {
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++PlatformEvent::PlatformEvent() : status(0), pid(-1), tid(-1), fault_address_(0), fault_code_(0) {
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++PlatformEvent *PlatformEvent::clone() const {
++	return new PlatformEvent(*this);
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++IDebugEvent::Message PlatformEvent::error_description() const {
++	Q_ASSERT(is_error());
++
++	const edb::address_t fault_address = reinterpret_cast<edb::address_t>(fault_address_);
++
++	switch(code()) {
++	case SIGSEGV:
++		return Message(
++			tr("Illegal Access Fault"),
++			tr(
++				"<p>The debugged application encountered a segmentation fault.<br />The address <strong>0x%1</strong> could not be accessed.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>").arg(edb::v1::format_pointer(fault_address))
++			);
++	case SIGILL:
++		return Message(
++			tr("Illegal Instruction Fault"),
++			tr(
++				"<p>The debugged application attempted to execute an illegal instruction.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++			);
++	case SIGFPE:
++		switch(fault_code_) {
++		case FPE_INTDIV:
++		return Message(
++			tr("Divide By Zero"),
++			tr(
++				"<p>The debugged application tried to divide an integer value by an integer divisor of zero.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++			);
++		default:
++			return Message(
++				tr("Floating Point Exception"),
++				tr(
++					"<p>The debugged application encountered a floating-point exception.</p>"
++					"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++				);
++		}
++
++	case SIGABRT:
++		return Message(
++			tr("Application Aborted"),
++			tr(
++				"<p>The debugged application has aborted.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++			);
++	case SIGBUS:
++		return Message(
++			tr("Bus Error"),
++			tr(
++				"<p>The debugged application tried to read or write data that is misaligned.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++			);
++#ifdef SIGSTKFLT
++	case SIGSTKFLT:
++		return Message(
++			tr("Stack Fault"),
++			tr(
++				"<p>The debugged application encountered a stack fault.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++			);
++#endif
++	case SIGPIPE:
++		return Message(
++			tr("Broken Pipe Fault"),
++			tr(
++				"<p>The debugged application encountered a broken pipe fault.</p>"
++				"<p>If you would like to pass this exception to the application press Shift+[F7/F8/F9]</p>")
++			);
++	default:
++		return Message();
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++IDebugEvent::REASON PlatformEvent:: reason() const {
++	// this basically converts our value into a 'switchable' value for convenience
++
++	if(stopped()) {
++		return EVENT_STOPPED;
++	} else if(terminated()) {
++		return EVENT_TERMINATED;
++	} else if(exited()) {
++		return EVENT_EXITED;
++	} else {
++		return EVENT_UNKNOWN;
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++IDebugEvent::TRAP_REASON PlatformEvent::trap_reason() const {
++	switch(fault_code_) {
++	case TRAP_TRACE: return TRAP_STEPPING;
++	default:         return TRAP_BREAKPOINT;
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::exited() const {
++	return WIFEXITED(status) != 0;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::is_error() const {
++	if(stopped()) {
++		switch(code()) {
++		case SIGTRAP:
++		case SIGSTOP:
++			return false;
++		case SIGSEGV:
++		case SIGILL:
++		case SIGFPE:
++		case SIGABRT:
++		case SIGBUS:
++#ifdef SIGSTKFLT
++		case SIGSTKFLT:
++#endif
++		case SIGPIPE:
++			return true;
++		default:
++			return false;
++		}
++	} else {
++		return false;
++	}
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::is_kill() const {
++	return stopped() && code() == SIGKILL;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::is_stop() const {
++	return stopped() && code() == SIGSTOP;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::is_trap() const {
++	return stopped() && code() == SIGTRAP;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::terminated() const {
++	return WIFSIGNALED(status) != 0;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++bool PlatformEvent::stopped() const {
++	return WIFSTOPPED(status) != 0;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++edb::pid_t PlatformEvent::process() const {
++	return pid;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++edb::tid_t PlatformEvent::thread() const {
++	return tid;
++}
++
++//------------------------------------------------------------------------------
++// Name: 
++//------------------------------------------------------------------------------
++int PlatformEvent::code() const {
++	if(stopped()) {
++		return WSTOPSIG(status);
++	}
++	
++	if(terminated()) {
++		return WTERMSIG(status);
++	}
++	
++	if(exited()) {
++		return WEXITSTATUS(status);
++	}
++	
++	return 0;
++}
++
++}
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h
new file mode 100644
index 0000000..02eacc0
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h
@@ -0,0 +1,67 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformEvent.h.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformEvent.h
+@@ -0,0 +1,62 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#ifndef PLATFORM_EVENT_20121005_H_
++#define PLATFORM_EVENT_20121005_H_
++
++#include <QCoreApplication>
++#include "IDebugEvent.h"
++
++namespace DebuggerCore {
++
++class PlatformEvent : IDebugEvent {
++	Q_DECLARE_TR_FUNCTIONS(PlatformEvent)
++	friend class DebuggerCore;
++
++public:
++	PlatformEvent();
++
++public:
++	virtual PlatformEvent *clone() const;
++	
++public:
++	virtual Message error_description() const;
++	virtual REASON reason() const;
++	virtual TRAP_REASON trap_reason() const;
++	virtual bool exited() const;
++	virtual bool is_error() const;
++	virtual bool is_kill() const;
++	virtual bool is_stop() const;
++	virtual bool is_trap() const;
++	virtual bool terminated() const;
++	virtual bool stopped() const;
++	virtual edb::pid_t process() const;
++	virtual edb::tid_t thread() const;
++	virtual int code() const;
++	
++private:
++	int        status;
++	edb::pid_t pid;
++	edb::tid_t tid;
++	void *     fault_address_;
++	long       fault_code_;
++};
++
++}
++
++#endif
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp
new file mode 100644
index 0000000..803a057
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp
@@ -0,0 +1,101 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformRegion.cpp.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformRegion.cpp
+@@ -0,0 +1,96 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#include "PlatformRegion.h"
++
++#include "MemoryRegions.h"
++#include "edb.h"
++#include "IDebuggerCore.h"
++#include "State.h"
++#include "IDebugEventHandler.h"
++#include <QMessageBox>
++#include <sys/syscall.h>
++#include <sys/mman.h>
++
++namespace DebuggerCore {
++
++PlatformRegion::PlatformRegion(edb::address_t start, edb::address_t end, edb::address_t base, const QString &name, permissions_t permissions) : start_(start), end_(end), base_(base), name_(name), permissions_(permissions) {
++}
++
++PlatformRegion::~PlatformRegion() {
++}
++
++IRegion *PlatformRegion::clone() const {
++	return new PlatformRegion(start_, end_, base_, name_, permissions_);
++}
++
++bool PlatformRegion::accessible() const {
++	return readable() || writable() || executable();
++}
++
++bool PlatformRegion::readable() const {
++	return (permissions_ & PROT_READ) != 0;
++}
++
++bool PlatformRegion::writable() const {
++	return (permissions_ & PROT_WRITE) != 0;
++}
++
++bool PlatformRegion::executable() const {
++	return (permissions_ & PROT_EXEC) != 0;
++}
++
++edb::address_t PlatformRegion::size() const {
++	return end_ - start_;
++}
++
++void PlatformRegion::set_permissions(bool read, bool write, bool execute) {
++	Q_UNUSED(read);
++	Q_UNUSED(write);
++	Q_UNUSED(execute);
++}
++
++edb::address_t PlatformRegion::start() const {
++	return start_;
++}
++
++edb::address_t PlatformRegion::end() const {
++	return end_;
++}
++
++edb::address_t PlatformRegion::base() const {
++	return base_;
++}
++
++QString PlatformRegion::name() const {
++	return name_;
++}
++
++IRegion::permissions_t PlatformRegion::permissions() const {
++	return permissions_;
++}
++
++void PlatformRegion::set_start(edb::address_t address) {
++	start_ = address;
++}
++
++void PlatformRegion::set_end(edb::address_t address) {
++	end_ = address;
++}
++
++}
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h
new file mode 100644
index 0000000..4dad9e3
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h
@@ -0,0 +1,73 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformRegion.h.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformRegion.h
+@@ -0,0 +1,68 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#ifndef PLATFORM_REGION_20120330_H_
++#define PLATFORM_REGION_20120330_H_
++
++#include "IRegion.h"
++#include <QString>
++#include <QCoreApplication>
++
++namespace DebuggerCore {
++
++class PlatformRegion : public IRegion {
++	Q_DECLARE_TR_FUNCTIONS(PlatformRegion)
++	
++public:
++	PlatformRegion(edb::address_t start, edb::address_t end, edb::address_t base, const QString &name, permissions_t permissions);
++	virtual ~PlatformRegion();
++
++public:
++	virtual IRegion *clone() const;
++
++public:
++	virtual bool accessible() const;
++	virtual bool readable() const;
++	virtual bool writable() const;
++	virtual bool executable() const;
++	virtual edb::address_t size() const;
++	
++public:
++	virtual void set_permissions(bool read, bool write, bool execute);
++	virtual void set_start(edb::address_t address);
++	virtual void set_end(edb::address_t address);
++	
++public:
++	virtual edb::address_t start() const;
++	virtual edb::address_t end() const;
++	virtual edb::address_t base() const;
++	virtual QString name() const;
++	virtual permissions_t permissions() const;
++	
++private:
++	edb::address_t start_;
++	edb::address_t end_;
++	edb::address_t base_;
++	QString        name_;
++	permissions_t  permissions_;
++};
++
++}
++
++#endif
++
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp
new file mode 100644
index 0000000..e1075d2
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp
@@ -0,0 +1,398 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformState.cpp.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformState.cpp
+@@ -0,0 +1,393 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#include "PlatformState.h"
++
++namespace DebuggerCore {
++
++//------------------------------------------------------------------------------
++// Name: PlatformState
++// Desc:
++//------------------------------------------------------------------------------
++PlatformState::PlatformState() {
++	memset(&regs_, 0, sizeof(regs_));
++	memset(&fpregs_, 0, sizeof(fpregs_));
++	memset(&dr_, 0, sizeof(dr_));
++	fs_base = 0;
++	gs_base = 0;
++}
++
++//------------------------------------------------------------------------------
++// Name: PlatformState::clone
++// Desc: makes a copy of the state object
++//------------------------------------------------------------------------------
++IState *PlatformState::clone() const {
++	return new PlatformState(*this);
++}
++
++//------------------------------------------------------------------------------
++// Name: flags_to_string
++// Desc: returns the flags in a string form appropriate for this platform
++//------------------------------------------------------------------------------
++QString PlatformState::flags_to_string(edb::reg_t flags) const {
++	char buf[14];
++	qsnprintf(
++		buf,
++		sizeof(buf),
++		"%c %c %c %c %c %c %c",
++		((flags & 0x001) ? 'C' : 'c'),
++		((flags & 0x004) ? 'P' : 'p'),
++		((flags & 0x010) ? 'A' : 'a'),
++		((flags & 0x040) ? 'Z' : 'z'),
++		((flags & 0x080) ? 'S' : 's'),
++		((flags & 0x400) ? 'D' : 'd'),
++		((flags & 0x800) ? 'O' : 'o'));
++
++	return buf;
++}
++
++//------------------------------------------------------------------------------
++// Name: flags_to_string
++// Desc: returns the flags in a string form appropriate for this platform
++//------------------------------------------------------------------------------
++QString PlatformState::flags_to_string() const {
++	return flags_to_string(flags());
++}
++
++//------------------------------------------------------------------------------
++// Name: value
++// Desc: returns a Register object which represents the register with the name
++//       supplied
++//------------------------------------------------------------------------------
++Register PlatformState::value(const QString &reg) const {
++	const QString lreg = reg.toLower();
++
++#if defined(EDB_X86)
++	if(lreg == "eax")          return Register("eax", regs_.r_eax, Register::TYPE_GPR);
++	else if(lreg == "ebx")     return Register("ebx", regs_.r_ebx, Register::TYPE_GPR);
++	else if(lreg == "ecx")     return Register("ecx", regs_.r_ecx, Register::TYPE_GPR);
++	else if(lreg == "edx")     return Register("edx", regs_.r_edx, Register::TYPE_GPR);
++	else if(lreg == "ebp")     return Register("ebp", regs_.r_ebp, Register::TYPE_GPR);
++	else if(lreg == "esp")     return Register("esp", regs_.r_esp, Register::TYPE_GPR);
++	else if(lreg == "esi")     return Register("esi", regs_.r_esi, Register::TYPE_GPR);
++	else if(lreg == "edi")     return Register("edi", regs_.r_edi, Register::TYPE_GPR);
++	else if(lreg == "eip")     return Register("eip", regs_.r_eip, Register::TYPE_IP);
++	else if(lreg == "ax")      return Register("ax", regs_.r_eax & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "bx")      return Register("bx", regs_.r_ebx & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "cx")      return Register("cx", regs_.r_ecx & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "dx")      return Register("dx", regs_.r_edx & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "bp")      return Register("bp", regs_.r_ebp & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "sp")      return Register("sp", regs_.r_esp & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "si")      return Register("si", regs_.r_esi & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "di")      return Register("di", regs_.r_edi & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "al")      return Register("al", regs_.r_eax & 0xff, Register::TYPE_GPR);
++	else if(lreg == "bl")      return Register("bl", regs_.r_ebx & 0xff, Register::TYPE_GPR);
++	else if(lreg == "cl")      return Register("cl", regs_.r_ecx & 0xff, Register::TYPE_GPR);
++	else if(lreg == "dl")      return Register("dl", regs_.r_edx & 0xff, Register::TYPE_GPR);
++	else if(lreg == "ah")      return Register("ah", (regs_.r_eax >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "bh")      return Register("bh", (regs_.r_ebx >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "ch")      return Register("ch", (regs_.r_ecx >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "dh")      return Register("dh", (regs_.r_edx >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "cs")      return Register("cs", regs_.r_cs, Register::TYPE_SEG);
++	else if(lreg == "ds")      return Register("ds", regs_.r_ds, Register::TYPE_SEG);
++	else if(lreg == "es")      return Register("es", regs_.r_es, Register::TYPE_SEG);
++	else if(lreg == "fs")      return Register("fs", regs_.r_fs, Register::TYPE_SEG);
++	else if(lreg == "gs")      return Register("gs", regs_.r_gs, Register::TYPE_SEG);
++	else if(lreg == "ss")      return Register("ss", regs_.r_ss, Register::TYPE_SEG);
++	else if(lreg == "fs_base") return Register("fs_base", fs_base, Register::TYPE_SEG);
++	else if(lreg == "gs_base") return Register("gs_base", gs_base, Register::TYPE_SEG);
++	else if(lreg == "eflags")  return Register("eflags", regs_.r_eflags, Register::TYPE_COND);
++#elif defined(EDB_X86_64)
++	if(lreg == "rax")          return Register("rax", regs_.r_rax, Register::TYPE_GPR);
++	else if(lreg == "rbx")     return Register("rbx", regs_.r_rbx, Register::TYPE_GPR);
++	else if(lreg == "rcx")     return Register("rcx", regs_.r_rcx, Register::TYPE_GPR);
++	else if(lreg == "rdx")     return Register("rdx", regs_.r_rdx, Register::TYPE_GPR);
++	else if(lreg == "rbp")     return Register("rbp", regs_.r_rbp, Register::TYPE_GPR);
++	else if(lreg == "rsp")     return Register("rsp", regs_.r_rsp, Register::TYPE_GPR);
++	else if(lreg == "rsi")     return Register("rsi", regs_.r_rsi, Register::TYPE_GPR);
++	else if(lreg == "rdi")     return Register("rdi", regs_.r_rdi, Register::TYPE_GPR);
++	else if(lreg == "rip")     return Register("rip", regs_.r_rip, Register::TYPE_IP);
++	else if(lreg == "r8")      return Register("r8", regs_.r_r8, Register::TYPE_GPR);
++	else if(lreg == "r9")      return Register("r9", regs_.r_r9, Register::TYPE_GPR);
++	else if(lreg == "r10")     return Register("r10", regs_.r_r10, Register::TYPE_GPR);
++	else if(lreg == "r11")     return Register("r11", regs_.r_r11, Register::TYPE_GPR);
++	else if(lreg == "r12")     return Register("r12", regs_.r_r12, Register::TYPE_GPR);
++	else if(lreg == "r13")     return Register("r13", regs_.r_r13, Register::TYPE_GPR);
++	else if(lreg == "r14")     return Register("r14", regs_.r_r14, Register::TYPE_GPR);
++	else if(lreg == "r15")     return Register("r15", regs_.r_r15, Register::TYPE_GPR);
++	else if(lreg == "eax")     return Register("eax", regs_.r_rax & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "ebx")     return Register("ebx", regs_.r_rbx & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "ecx")     return Register("ecx", regs_.r_rcx & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "edx")     return Register("edx", regs_.r_rdx & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "ebp")     return Register("ebp", regs_.r_rbp & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "esp")     return Register("esp", regs_.r_rsp & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "esi")     return Register("esi", regs_.r_rsi & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "edi")     return Register("edi", regs_.r_rdi & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r8d")     return Register("r8d", regs_.r_r8 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r9d")     return Register("r9d", regs_.r_r9 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r10d")    return Register("r10d", regs_.r_r10 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r11d")    return Register("r11d", regs_.r_r11 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r12d")    return Register("r12d", regs_.r_r12 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r13d")    return Register("r13d", regs_.r_r13 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r14d")    return Register("r14d", regs_.r_r14 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "r15d")    return Register("r15d", regs_.r_r15 & 0xffffffff, Register::TYPE_GPR);
++	else if(lreg == "ax")      return Register("ax", regs_.r_rax & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "bx")      return Register("bx", regs_.r_rbx & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "cx")      return Register("cx", regs_.r_rcx & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "dx")      return Register("dx", regs_.r_rdx & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "bp")      return Register("bp", regs_.r_rbp & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "sp")      return Register("sp", regs_.r_rsp & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "si")      return Register("si", regs_.r_rsi & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "di")      return Register("di", regs_.r_rdi & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r8w")     return Register("r8w", regs_.r_r8 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r9w")     return Register("r9w", regs_.r_r9 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r10w")    return Register("r10w", regs_.r_r10 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r11w")    return Register("r11w", regs_.r_r11 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r12w")    return Register("r12w", regs_.r_r12 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r13w")    return Register("r13w", regs_.r_r13 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r14w")    return Register("r14w", regs_.r_r14 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "r15w")    return Register("r15w", regs_.r_r15 & 0xffff, Register::TYPE_GPR);
++	else if(lreg == "al")      return Register("al", regs_.r_rax & 0xff, Register::TYPE_GPR);
++	else if(lreg == "bl")      return Register("bl", regs_.r_rbx & 0xff, Register::TYPE_GPR);
++	else if(lreg == "cl")      return Register("cl", regs_.r_rcx & 0xff, Register::TYPE_GPR);
++	else if(lreg == "dl")      return Register("dl", regs_.r_rdx & 0xff, Register::TYPE_GPR);
++	else if(lreg == "ah")      return Register("ah", (regs_.r_rax >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "bh")      return Register("bh", (regs_.r_rbx >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "ch")      return Register("ch", (regs_.r_rcx >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "dh")      return Register("dh", (regs_.r_rdx >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "spl")     return Register("spl", (regs_.r_rsp >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "bpl")     return Register("bpl", (regs_.r_rbp >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "sil")     return Register("sil", (regs_.r_rsi >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "dil")     return Register("dil", (regs_.r_rdi >> 8) & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r8b")     return Register("r8b", regs_.r_r8 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r9b")     return Register("r9b", regs_.r_r9 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r10b")    return Register("r10b", regs_.r_r10 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r11b")    return Register("r11b", regs_.r_r11 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r12b")    return Register("r12b", regs_.r_r12 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r13b")    return Register("r13b", regs_.r_r13 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r14b")    return Register("r14b", regs_.r_r14 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "r15b")    return Register("r15b", regs_.r_r15 & 0xff, Register::TYPE_GPR);
++	else if(lreg == "cs")      return Register("cs", regs_.r_cs, Register::TYPE_SEG);
++	else if(lreg == "ds")      return Register("ds", regs_.r_ds, Register::TYPE_SEG);
++	else if(lreg == "es")      return Register("es", regs_.r_es, Register::TYPE_SEG);
++	else if(lreg == "fs")      return Register("fs", regs_.r_fs, Register::TYPE_SEG);
++	else if(lreg == "gs")      return Register("gs", regs_.r_gs, Register::TYPE_SEG);
++	else if(lreg == "ss")      return Register("ss", regs_.r_ss, Register::TYPE_SEG);
++	else if(lreg == "fs_base") return Register("fs_base", fs_base, Register::TYPE_SEG);
++	else if(lreg == "gs_base") return Register("gs_base", gs_base, Register::TYPE_SEG);
++	else if(lreg == "rflags")  return Register("rflags", regs_.r_rflags, Register::TYPE_COND);
++#endif
++
++	return Register();
++}
++
++//------------------------------------------------------------------------------
++// Name: frame_pointer
++// Desc: returns what is conceptually the frame pointer for this platform
++//------------------------------------------------------------------------------
++edb::address_t PlatformState::frame_pointer() const {
++#if defined(EDB_X86)
++	return regs_.r_ebp;
++#elif defined(EDB_X86_64)
++	return regs_.r_rbp;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: instruction_pointer
++// Desc: returns the instruction pointer for this platform
++//------------------------------------------------------------------------------
++edb::address_t PlatformState::instruction_pointer() const {
++#if defined(EDB_X86)
++	return regs_.r_eip;
++#elif defined(EDB_X86_64)
++	return regs_.r_rip;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: stack_pointer
++// Desc: returns the stack pointer for this platform
++//------------------------------------------------------------------------------
++edb::address_t PlatformState::stack_pointer() const {
++#if defined(EDB_X86)
++	return regs_.r_esp;
++#elif defined(EDB_X86_64)
++	return regs_.r_rsp;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: debug_register
++// Desc:
++//------------------------------------------------------------------------------
++edb::reg_t PlatformState::debug_register(int n) const {
++	return dr_[n];
++}
++
++//------------------------------------------------------------------------------
++// Name: flags
++// Desc:
++//------------------------------------------------------------------------------
++edb::reg_t PlatformState::flags() const {
++#if defined(EDB_X86)
++	return regs_.r_eflags;
++#elif defined(EDB_X86_64)
++	return regs_.r_rflags;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: fpu_register
++// Desc:
++//------------------------------------------------------------------------------
++long double PlatformState::fpu_register(int n) const {
++	return reinterpret_cast<const long double *>(&fpregs_)[n];
++}
++
++//------------------------------------------------------------------------------
++// Name: adjust_stack
++// Desc:
++//------------------------------------------------------------------------------
++void PlatformState::adjust_stack(int bytes) {
++#if defined(EDB_X86)
++	regs_.r_esp += bytes;
++#elif defined(EDB_X86_64)
++	regs_.r_rsp += bytes;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: clear
++// Desc:
++//------------------------------------------------------------------------------
++void PlatformState::clear() {
++	memset(&regs_, 0, sizeof(regs_));
++	memset(&fpregs_, 0, sizeof(fpregs_));
++	memset(&dr_, 0, sizeof(dr_));
++#if defined(EDB_X86)
++	fs_base = 0;
++	gs_base = 0;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: set_debug_register
++// Desc:
++//------------------------------------------------------------------------------
++void PlatformState::set_debug_register(int n, edb::reg_t value) {
++	dr_[n] = value;
++}
++
++//------------------------------------------------------------------------------
++// Name: set_flags
++// Desc:
++//------------------------------------------------------------------------------
++void PlatformState::set_flags(edb::reg_t flags) {
++#if defined(EDB_X86)
++	regs_.r_eflags = flags;
++#elif defined(EDB_X86_64)
++	regs_.r_rflags = flags;
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name: set_instruction_pointer
++// Desc:
++//------------------------------------------------------------------------------
++void PlatformState::set_instruction_pointer(edb::address_t value) {
++#if defined(EDB_X86)
++	regs_.r_eip = value;
++#elif defined(EDB_X86_64)
++	regs_.r_rip = value;
++#endif
++
++}
++
++//------------------------------------------------------------------------------
++// Name: set_register
++// Desc:
++//------------------------------------------------------------------------------
++void PlatformState::set_register(const QString &name, edb::reg_t value) {
++
++	const QString lreg = name.toLower();
++#if defined(EDB_X86)
++	if(lreg == "eax") { regs_.r_eax = value; }
++	else if(lreg == "ebx") { regs_.r_ebx = value; }
++	else if(lreg == "ecx") { regs_.r_ecx = value; }
++	else if(lreg == "edx") { regs_.r_edx = value; }
++	else if(lreg == "ebp") { regs_.r_ebp = value; }
++	else if(lreg == "esp") { regs_.r_esp = value; }
++	else if(lreg == "esi") { regs_.r_esi = value; }
++	else if(lreg == "edi") { regs_.r_edi = value; }
++	else if(lreg == "eip") { regs_.r_eip = value; }
++	else if(lreg == "cs") { regs_.r_cs = value; }
++	else if(lreg == "ds") { regs_.r_ds = value; }
++	else if(lreg == "es") { regs_.r_es = value; }
++	else if(lreg == "fs") { regs_.r_fs = value; }
++	else if(lreg == "gs") { regs_.r_gs = value; }
++	else if(lreg == "ss") { regs_.r_ss = value; }
++	else if(lreg == "eflags") { regs_.r_eflags = value; }
++#elif defined(EDB_X86_64)
++	if(lreg == "rax") { regs_.r_rax = value; }
++	else if(lreg == "rbx") { regs_.r_rbx = value; }
++	else if(lreg == "rcx") { regs_.r_rcx = value; }
++	else if(lreg == "rdx") { regs_.r_rdx = value; }
++	else if(lreg == "rbp") { regs_.r_rbp = value; }
++	else if(lreg == "rsp") { regs_.r_rsp = value; }
++	else if(lreg == "rsi") { regs_.r_rsi = value; }
++	else if(lreg == "rdi") { regs_.r_rdi = value; }
++	else if(lreg == "r8") { regs_.r_r8 = value; }
++	else if(lreg == "r9") { regs_.r_r9 = value; }
++	else if(lreg == "r10") { regs_.r_r10 = value; }
++	else if(lreg == "r11") { regs_.r_r11 = value; }
++	else if(lreg == "r12") { regs_.r_r12 = value; }
++	else if(lreg == "r13") { regs_.r_r13 = value; }
++	else if(lreg == "r14") { regs_.r_r14 = value; }
++	else if(lreg == "r15") { regs_.r_r15 = value; }
++	else if(lreg == "rip") { regs_.r_rip = value; }
++	else if(lreg == "cs") { regs_.r_cs = value; }
++	else if(lreg == "ds") { regs_.r_ds = value; }
++	else if(lreg == "es") { regs_.r_es = value; }
++	else if(lreg == "fs") { regs_.r_fs = value; }
++	else if(lreg == "gs") { regs_.r_gs = value; }
++	else if(lreg == "ss") { regs_.r_ss = value; }
++	else if(lreg == "rflags") { regs_.r_rflags = value; }
++#endif
++}
++
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++quint64 PlatformState::mmx_register(int n) const {
++	Q_UNUSED(n);
++	return 0;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QByteArray PlatformState::xmm_register(int n) const {
++	Q_UNUSED(n);
++	return QByteArray();
++}
++
++}
diff --git a/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h
new file mode 100644
index 0000000..4f01725
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h
@@ -0,0 +1,73 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformState.h.orig	2016-01-07 03:04:04.000000000 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformState.h
+@@ -0,0 +1,68 @@
++/*
++Copyright (C) 2006 - 2014 Evan Teran
++                          eteran%alum.rit.edu@localhost
++
++This program is free software: you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation, either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program.  If not, see <http://www.gnu.org/licenses/>.
++*/
++
++#ifndef PLATFORMSTATE_20110330_H_
++#define PLATFORMSTATE_20110330_H_
++
++#include "IState.h"
++#include "Types.h"
++#include <sys/types.h>
++#include <machine/reg.h>
++
++namespace DebuggerCore {
++
++class PlatformState : public IState {
++	friend class DebuggerCore;
++
++public:
++	PlatformState();
++
++public:
++	virtual IState *clone() const;
++
++public:
++	virtual QString flags_to_string() const;
++	virtual QString flags_to_string(edb::reg_t flags) const;
++	virtual Register value(const QString &reg) const;
++	virtual edb::address_t frame_pointer() const;
++	virtual edb::address_t instruction_pointer() const;
++	virtual edb::address_t stack_pointer() const;
++	virtual edb::reg_t debug_register(int n) const;
++	virtual edb::reg_t flags() const;
++	virtual long double fpu_register(int n) const;
++	virtual void adjust_stack(int bytes);
++	virtual void clear();
++	virtual void set_debug_register(int n, edb::reg_t value);
++	virtual void set_flags(edb::reg_t flags);
++	virtual void set_instruction_pointer(edb::address_t value);
++	virtual void set_register(const QString &name, edb::reg_t value);
++	virtual quint64 mmx_register(int n) const;
++	virtual QByteArray xmm_register(int n) const;
++
++private:
++	struct reg     regs_;
++	struct fpreg   fpregs_;
++	edb::reg_t     dr_[8];
++	edb::address_t fs_base;
++	edb::address_t gs_base;
++};
++
++}
++
++#endif
++
diff --git a/edb-debugger/patches/patch-plugins_plugins.pri b/edb-debugger/patches/patch-plugins_plugins.pri
new file mode 100644
index 0000000..7f746bd
--- /dev/null
+++ b/edb-debugger/patches/patch-plugins_plugins.pri
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- plugins/plugins.pri.orig	2013-07-23 02:30:10.000000000 +0000
++++ plugins/plugins.pri
+@@ -23,10 +23,11 @@ unix {
+ 	INCLUDEPATH += $$LEVEL/include $$LEVEL/include/os/unix
+ 	
+ 	# OS include paths
+-	linux-*   : INCLUDEPATH += $$LEVEL/include/os/unix/linux
+-	openbsd-* : INCLUDEPATH += $$LEVEL/include/os/unix/openbsd /usr/local/include
+ 	freebsd-* : INCLUDEPATH += $$LEVEL/include/os/unix/freebsd
++	linux-*   : INCLUDEPATH += $$LEVEL/include/os/unix/linux
+ 	macx-*    : INCLUDEPATH += $$LEVEL/include/os/unix/osx /opt/local/include
++	netbsd-*  : INCLUDEPATH += $$LEVEL/include/os/unix/netbsd
++	openbsd-* : INCLUDEPATH += $$LEVEL/include/os/unix/openbsd /usr/local/include
+ 
+ 	# arch include paths
+ 	macx {
diff --git a/edb-debugger/patches/patch-src_src.pro b/edb-debugger/patches/patch-src_src.pro
new file mode 100644
index 0000000..d250294
--- /dev/null
+++ b/edb-debugger/patches/patch-src_src.pro
@@ -0,0 +1,56 @@
+$NetBSD$
+
+--- src/src.pro.orig	2014-01-14 21:10:03.000000000 +0000
++++ src/src.pro
+@@ -176,21 +176,16 @@ unix {
+ 	VPATH       += $$LEVEL/include/os/unix edisassm
+ 	INCLUDEPATH += $$LEVEL/include/os/unix edisassm
+ 
+-	linux-* {
+-		VPATH       += $$LEVEL/include/os/unix/linux
+-		INCLUDEPATH += $$LEVEL/include/os/unix/linux
+-	}
+-
+-	openbsd-* {
+-		VPATH       += $$LEVEL/include/os/unix/openbsd
+-		INCLUDEPATH += $$LEVEL/include/os/unix/openbsd /usr/local/include
+-	}
+-
+ 	freebsd-* {
+ 		VPATH       += $$LEVEL/include/os/unix/freebsd
+ 		INCLUDEPATH += $$LEVEL/include/os/unix/freebsd
+ 	}
+ 
++	linux-* {
++		VPATH       += $$LEVEL/include/os/unix/linux
++		INCLUDEPATH += $$LEVEL/include/os/unix/linux
++	}
++
+ 	macx-* {
+ 		VPATH       += $$LEVEL/include/os/unix/osx
+ 		INCLUDEPATH += $$LEVEL/include/os/unix/osx /opt/local/include
+@@ -201,6 +196,16 @@ unix {
+ 		INCLUDEPATH += arch/x86_64 $$LEVEL/include/arch/x86_64
+ 	}
+ 
++	netbsd-* {
++		VPATH       += $$LEVEL/include/os/unix/netbsd
++		INCLUDEPATH += $$LEVEL/include/os/unix/netbsd
++	}
++
++	openbsd-* {
++		VPATH       += $$LEVEL/include/os/unix/openbsd
++		INCLUDEPATH += $$LEVEL/include/os/unix/openbsd /usr/local/include
++	}
++
+ 	!macx:contains(QMAKE_HOST.arch, x86_64) {
+ 		VPATH       += arch/x86_64 $$LEVEL/include/arch/x86_64
+ 		INCLUDEPATH += arch/x86_64 $$LEVEL/include/arch/x86_64
+@@ -221,6 +226,6 @@ unix {
+ 	linux-g++*   : QMAKE_LFLAGS += -rdynamic $$(LDFLAGS)
+ 	macx-clang*  : QMAKE_LFLAGS += -rdynamic $$(LDFLAGS)
+ 	macx-g++*    : QMAKE_LFLAGS += -rdynamic $$(LDFLAGS)
++	netbsd-g++*  : QMAKE_LFLAGS += -lkvm -Wl,--export-dynamic $$(LDFLAGS)
+ 	openbsd-g++* : QMAKE_LFLAGS += -lkvm -Wl,--export-dynamic $$(LDFLAGS)
+ }
+-


Home | Main Index | Thread Index | Old Index