pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
edb-debugger-git: Clone FreeBSD specific platform code to NetBSD
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Sat Feb 18 23:57:01 2017 +0100
Changeset: 29d874910bfe5c55b43059d290fcff208454f709
Modified Files:
edb-debugger-git/distinfo
Added Files:
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.cpp
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.h
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp
edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h
Log Message:
edb-debugger-git: Clone FreeBSD specific platform code to NetBSD
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=29d874910bfe5c55b43059d290fcff208454f709
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
edb-debugger-git/distinfo | 10 +
...ugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp | 601 +++++++++++++++++++++
...plugins_DebuggerCore_unix_netbsd_DebuggerCore.h | 115 ++++
...gins_DebuggerCore_unix_netbsd_PlatformEvent.cpp | 263 +++++++++
...lugins_DebuggerCore_unix_netbsd_PlatformEvent.h | 67 +++
...ns_DebuggerCore_unix_netbsd_PlatformProcess.cpp | 24 +
...gins_DebuggerCore_unix_netbsd_PlatformProcess.h | 32 ++
...ins_DebuggerCore_unix_netbsd_PlatformRegion.cpp | 101 ++++
...ugins_DebuggerCore_unix_netbsd_PlatformRegion.h | 72 +++
...gins_DebuggerCore_unix_netbsd_PlatformState.cpp | 397 ++++++++++++++
...lugins_DebuggerCore_unix_netbsd_PlatformState.h | 73 +++
11 files changed, 1755 insertions(+)
diffs:
diff --git a/edb-debugger-git/distinfo b/edb-debugger-git/distinfo
index ae9e9c13eb..35f2e393e0 100644
--- a/edb-debugger-git/distinfo
+++ b/edb-debugger-git/distinfo
@@ -4,6 +4,16 @@ SHA1 (edb-debugger-0.9.21.tar.gz) = eff050b5ec53f02ebc96dbbb80f1731036e2c6f6
RMD160 (edb-debugger-0.9.21.tar.gz) = d7821e07b607667090b1158b559053856ef077de
SHA512 (edb-debugger-0.9.21.tar.gz) = 88a04cafb2c27a3af6bcfc48c841c795fb5bba348f64fe52957716c2c03e4cd056d045b241135c5be7fd7174d2c5a35fa5c95dc2b6aad4fb5c04f4fe36ab4f0d
Size (edb-debugger-0.9.21.tar.gz) = 996932 bytes
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp) = c89776102c7e6ec66700bd0a6a59e0247e9599ba
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h) = ff4c169d2df9093f7b218b444227a859e66e4451
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp) = 813bd82ae92d75cddb0935e0f94b782c9651eb40
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h) = 29673c512e29d26254f7cdc4d7c297284c552c43
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.cpp) = 0551bc455a270142461fd97b6ed29feaa3980c38
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.h) = 4a77fb33d59233b02709a38a44a062b392b9ee6a
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp) = 8b990e62c275c8b2fef309c64f95642d2d998416
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h) = 22c8d28700412c4b63e42275027929271d05484e
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp) = d3795d6464d05977fd728d4891845a4c8df9b812
+SHA1 (patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h) = 8a1994a86e8837034b2981bb2c3645f336fbeee4
SHA1 (patch-plugins_HeapAnalyzer_DialogHeap.cpp) = a11c5aeb91168f4bf2f58fa35137fec2d5107ea4
SHA1 (patch-plugins_ProcessProperties_DialogProcessProperties.cpp) = 31d9915e63a963fdd597dc141e3424fa8f05e81b
SHA1 (patch-src_Debugger.cpp) = 6e680dfecf7fe690c3d557002515f21313b85ca7
diff --git a/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp
new file mode 100644
index 0000000000..c7a62e37be
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.cpp
@@ -0,0 +1,601 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/DebuggerCore.cpp.orig 2017-02-18 22:55:39.958904390 +0000
++++ plugins/DebuggerCore/unix/netbsd/DebuggerCore.cpp
+@@ -0,0 +1,596 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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/mman.h>
++#include <sys/param.h>
++#include <sys/ptrace.h>
++#include <sys/sysctl.h>
++#include <sys/user.h>
++#include <sys/wait.h>
++#include <unistd.h>
++
++namespace DebuggerCore {
++
++namespace {
++
++void SET_OK(bool &ok, long value) {
++ ok = (value != -1) || (errno == 0);
++}
++
++int resume_code(int status) {
++ if(WIFSIGNALED(status)) {
++ return WTERMSIG(status);
++ } else if(WIFSTOPPED(status)) {
++ return WSTOPSIG(status);
++ }
++ return 0;
++}
++}
++
++//------------------------------------------------------------------------------
++// 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
++ auto e = std::make_shared<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 proc = kvm_getprocs(kd, KERN_PROC_PID, pid(), &rc);
++
++ struct proc p;
++ kvm_read(kd, (unsigned long)proc->ki_paddr, &p, sizeof(p));
++
++ struct ksiginfo siginfo;
++ kvm_read(kd, (unsigned long)p.p_ksi, &siginfo, sizeof(siginfo));
++
++ // TODO: why doesn't this get the fault address correctly?
++ // perhaps I need to target the tid instead?
++ e->fault_code_ = siginfo.ksi_code;
++ e->fault_address_ = siginfo.ksi_addr;
++
++ //printf("ps_sig : %d\n", siginfo.ksi_signo);
++ //printf("ps_type : %d\n", p.p_stype);
++ kvm_close(kd);
++ } else {
++ e->fault_code_ = 0;
++ e->fault_address_ = 0;
++ }
++
++ active_thread_ = tid;
++ threads_[tid].status = status;
++ return e;
++ }
++ }
++ }
++ return nullptr;
++}
++
++//------------------------------------------------------------------------------
++// 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();
++ for(auto it = threads_.begin(); it != threads_.end(); ++it) {
++ ptrace(PT_DETACH, it.key(), 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(auto 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
++
++ auto state_impl = static_cast<PlatformState *>(state->impl_);
++
++ if(attached()) {
++ #if defined(EDB_X86)
++ if(ptrace(PT_GETREGS, active_thread(), reinterpret_cast<char*>(&state_impl->regs_), 0) != -1) {
++ state_impl->gs_base = 0;
++ state_impl->fs_base = 0;
++ }
++ #endif
++ // TODO implement this
++ } else {
++ state->clear();
++ }
++}
++
++//------------------------------------------------------------------------------
++// Name: set_state
++// Desc:
++//------------------------------------------------------------------------------
++void DebuggerCore::set_state(const State &state) {
++
++ // TODO: assert that we are paused
++
++ auto 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, ProcessInfo> DebuggerCore::enumerate_processes() const {
++ QMap<edb::pid_t, ProcessInfo> ret;
++
++ char ebuffer[_POSIX2_LINE_MAX];
++ int numprocs;
++ if(kvm_t *const kaccess = kvm_openfiles(_PATH_DEVNULL, _PATH_DEVNULL, 0, O_RDONLY, ebuffer)) {
++ if(struct kinfo_proc *const kprocaccess = kvm_getprocs(kaccess, KERN_PROC_ALL, 0, &numprocs)) {
++ for(int i = 0; i < numprocs; ++i) {
++ ProcessInfo procInfo;
++
++ procInfo.pid = kprocaccess[i].ki_pid;
++ procInfo.uid = kprocaccess[i].ki_uid;
++ procInfo.name = kprocaccess[i].ki_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 {
++ // TODO: implement this
++ return QString();
++}
++
++//------------------------------------------------------------------------------
++// 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 {
++ // TODO: implement this
++ return -1;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QList<IRegion::pointer> DebuggerCore::memory_regions() const {
++ QList<IRegion::pointer> regions;
++
++ if(pid_ != 0) {
++ char buffer[PATH_MAX] = {};
++ struct ptrace_vm_entry vm_entry;
++ memset(&vm_entry, 0, sizeof(vm_entry));
++ vm_entry.pve_entry = 0;
++
++ while(ptrace(PT_VM_ENTRY, pid_, reinterpret_cast<char*>(&vm_entry), NULL) == 0) {
++ vm_entry.pve_path = buffer;
++ vm_entry.pve_pathlen = sizeof(buffer);
++
++ const edb::address_t start = vm_entry.pve_start;
++ const edb::address_t end = vm_entry.pve_end;
++ const edb::address_t base = vm_entry.pve_start - vm_entry.pve_offset;
++ const QString name = vm_entry.pve_path;
++ const IRegion::permissions_t permissions = vm_entry.pve_prot;
++
++ regions.push_back(std::make_shared<PlatformRegion>(start, end, base, name, permissions));
++ memset(buffer, 0, sizeof(buffer));
++ }
++ }
++
++ return regions;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QList<QByteArray> DebuggerCore::process_args(edb::pid_t pid) const {
++ QList<QByteArray> ret;
++ if(pid != 0) {
++ // TODO: assert attached!
++ }
++ 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:
++//------------------------------------------------------------------------------
++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;
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QString DebuggerCore::stack_pointer() const {
++#ifdef EDB_X86
++ return "esp";
++#elif defined(EDB_X86_64)
++ return "rsp";
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QString DebuggerCore::frame_pointer() const {
++#ifdef EDB_X86
++ return "ebp";
++#elif defined(EDB_X86_64)
++ return "rbp";
++#endif
++}
++
++//------------------------------------------------------------------------------
++// Name:
++// Desc:
++//------------------------------------------------------------------------------
++QString DebuggerCore::instruction_pointer() const {
++#ifdef EDB_X86
++ return "eip";
++#elif defined(EDB_X86_64)
++ return "rip";
++#endif
++}
++
++#if QT_VERSION < 0x050000
++Q_EXPORT_PLUGIN2(DebuggerCore, DebuggerCore)
++#endif
++
++}
diff --git a/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h
new file mode 100644
index 0000000000..c0fc0532ed
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_DebuggerCore.h
@@ -0,0 +1,115 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/DebuggerCore.h.orig 2017-02-18 22:55:39.959854252 +0000
++++ plugins/DebuggerCore/unix/netbsd/DebuggerCore.h
+@@ -0,0 +1,110 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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(IDebugger)
++ 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;
++
++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;
++
++public:
++ virtual QMap<edb::pid_t, ProcessInfo> enumerate_processes() const;
++ virtual QList<Module> loaded_modules() const;
++
++public:
++ virtual QString stack_pointer() const;
++ virtual QString frame_pointer() const;
++ virtual QString instruction_pointer() 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-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp
new file mode 100644
index 0000000000..e4c9ff9117
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.cpp
@@ -0,0 +1,263 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformEvent.cpp.orig 2017-02-18 22:55:39.960742083 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformEvent.cpp
+@@ -0,0 +1,258 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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/user.h>
++#include <sys/wait.h>
++#include <unistd.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());
++
++ auto 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-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h
new file mode 100644
index 0000000000..24f2075dfa
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformEvent.h
@@ -0,0 +1,67 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformEvent.h.orig 2017-02-18 22:55:39.961690298 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformEvent.h
+@@ -0,0 +1,62 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.cpp b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.cpp
new file mode 100644
index 0000000000..f61e0a572d
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformProcess.cpp.orig 2017-02-18 22:55:39.962587886 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformProcess.cpp
+@@ -0,0 +1,19 @@
++/*
++Copyright (C) 2015 - 2015 Evan Teran
++ evan.teran%gmail.com@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 "PlatformProcess.h"
diff --git a/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.h b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.h
new file mode 100644
index 0000000000..007c7205fc
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformProcess.h
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformProcess.h.orig 2017-02-18 22:55:39.963467225 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformProcess.h
+@@ -0,0 +1,27 @@
++/*
++Copyright (C) 2015 - 2015 Evan Teran
++ evan.teran%gmail.com@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 PLATOFORM_PROCESS_20150517_H_
++#define PLATOFORM_PROCESS_20150517_H_
++
++#include "IProcess.h"
++
++class PlatformProcess : public IProcess {
++};
++
++#endif
diff --git a/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp
new file mode 100644
index 0000000000..9ad4564a2a
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.cpp
@@ -0,0 +1,101 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformRegion.cpp.orig 2017-02-18 22:55:39.964339943 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformRegion.cpp
+@@ -0,0 +1,96 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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 "IDebugger.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-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h
new file mode 100644
index 0000000000..2e6e620ba0
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformRegion.h
@@ -0,0 +1,72 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformRegion.h.orig 2017-02-18 22:55:39.965208843 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformRegion.h
+@@ -0,0 +1,67 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp
new file mode 100644
index 0000000000..0d11693a50
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.cpp
@@ -0,0 +1,397 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformState.cpp.orig 2017-02-18 22:55:39.966074010 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformState.cpp
+@@ -0,0 +1,392 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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(®s_, 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 ®) 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(®s_, 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-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h
new file mode 100644
index 0000000000..5ecfb8de47
--- /dev/null
+++ b/edb-debugger-git/patches/patch-plugins_DebuggerCore_unix_netbsd_PlatformState.h
@@ -0,0 +1,73 @@
+$NetBSD$
+
+--- plugins/DebuggerCore/unix/netbsd/PlatformState.h.orig 2017-02-18 22:55:39.966936896 +0000
++++ plugins/DebuggerCore/unix/netbsd/PlatformState.h
+@@ -0,0 +1,68 @@
++/*
++Copyright (C) 2006 - 2015 Evan Teran
++ evan.teran%gmail.com@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/user.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 ®) 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
++
Home |
Main Index |
Thread Index |
Old Index