pkgsrc-WIP-changes archive

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

frida-gum: Add more stubs for NetBSD support



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Thu Mar 15 04:27:15 2018 +0100
Changeset:	4f9019612435038c4ff2cb79392b094efd6fe4d6

Modified Files:
	frida-gum/distinfo
Added Files:
	frida-gum/patches/patch-gum_backend-netbsd_gummemory-netbsd.c
	frida-gum/patches/patch-gum_backend-netbsd_gumnetbsd.h
	frida-gum/patches/patch-gum_backend-netbsd_gumprocess-netbsd.c
	frida-gum/patches/patch-gum_meson.build
	frida-gum/patches/patch-libs_gum_prof_meson.build

Log Message:
frida-gum: Add more stubs for NetBSD support

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

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

diffstat:
 frida-gum/distinfo                                 |   5 +
 .../patch-gum_backend-netbsd_gummemory-netbsd.c    |  76 +++
 .../patches/patch-gum_backend-netbsd_gumnetbsd.h   |  34 ++
 .../patch-gum_backend-netbsd_gumprocess-netbsd.c   | 635 +++++++++++++++++++++
 frida-gum/patches/patch-gum_meson.build            |  33 ++
 frida-gum/patches/patch-libs_gum_prof_meson.build  |  18 +
 6 files changed, 801 insertions(+)

diffs:
diff --git a/frida-gum/distinfo b/frida-gum/distinfo
index 011f4ea5e9..4db674b2c4 100644
--- a/frida-gum/distinfo
+++ b/frida-gum/distinfo
@@ -5,5 +5,10 @@ RMD160 (frida-gum-0-c41abae2a2b29de3aad7a4fd9daac3e0b150cb54.tar.gz) = 88330d01a
 SHA512 (frida-gum-0-c41abae2a2b29de3aad7a4fd9daac3e0b150cb54.tar.gz) = 607c5319c5fffb06a7f2beed9769cad29e32c9384de9d7b74ff791e03e2e10f720db3b29dcb6c7a7ec81e057368fe6b5887cc1ddb1207fdf3977825353dd5dfb
 Size (frida-gum-0-c41abae2a2b29de3aad7a4fd9daac3e0b150cb54.tar.gz) = 12573451 bytes
 SHA1 (patch-config.h.in) = 9d7f701ba8577e6501e4d64e80adef397255e46a
+SHA1 (patch-gum_backend-netbsd_gummemory-netbsd.c) = af91a37feee60aaf93919b472f249ee4b310d283
+SHA1 (patch-gum_backend-netbsd_gumnetbsd.h) = 673ce882d8b20f2eaab8192520d5e19ba5daebb2
+SHA1 (patch-gum_backend-netbsd_gumprocess-netbsd.c) = 96be7b7211741f99f194c19a5fe7ec8982a3cb50
 SHA1 (patch-gum_gumdefs.h) = cb24f98c906572196228ee0d09c2cd2dcaa5c306
 SHA1 (patch-gum_gumprocess.c) = 915a233f242186a45b375ef2690cf534d8ad39f2
+SHA1 (patch-gum_meson.build) = 24f1b2351a48058e8305daac00c422088fad25ff
+SHA1 (patch-libs_gum_prof_meson.build) = c3728d856ea8871714679c028844f827b47282d0
diff --git a/frida-gum/patches/patch-gum_backend-netbsd_gummemory-netbsd.c b/frida-gum/patches/patch-gum_backend-netbsd_gummemory-netbsd.c
new file mode 100644
index 0000000000..7b3dd58ff4
--- /dev/null
+++ b/frida-gum/patches/patch-gum_backend-netbsd_gummemory-netbsd.c
@@ -0,0 +1,76 @@
+$NetBSD$
+
+--- gum/backend-netbsd/gummemory-netbsd.c.orig	2018-03-15 02:54:36.263029512 +0000
++++ gum/backend-netbsd/gummemory-netbsd.c
+@@ -0,0 +1,71 @@
++/*
++ * Copyright (C) 2008-2011 Ole André Vadla Ravnås <ole.andre.ravnas%tillitech.com@localhost>
++ *
++ * Licence: wxWindows Library Licence, Version 3.1
++ */
++
++#include "gummemory.h"
++
++#include "gummemory-priv.h"
++//#include "valgrind.h"
++
++#include <stdio.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <unistd.h>
++
++static gboolean gum_memory_get_protection (GumAddress address, gsize n,
++    gsize * size, GumPageProtection * prot);
++
++gboolean
++gum_memory_is_readable (GumAddress address,
++                        gsize len)
++{
++  return FALSE;
++}
++
++static gboolean
++gum_memory_is_writable (GumAddress address,
++                        gsize len)
++{
++  return FALSE;
++}
++
++guint8 *
++gum_memory_read (GumAddress address,
++                 gsize len,
++                 gsize * n_bytes_read)
++{
++  return NULL;
++}
++
++gboolean
++gum_memory_write (GumAddress address,
++                  const guint8 * bytes,
++                  gsize len)
++{
++  return FALSE;
++}
++
++gboolean
++gum_try_mprotect (gpointer address,
++                  gsize size,
++                  GumPageProtection page_prot)
++{
++  return FALSE;
++}
++
++void
++gum_clear_cache (gpointer address,
++                 gsize size)
++{
++}
++
++static gboolean
++gum_memory_get_protection (GumAddress address,
++                           gsize n,
++                           gsize * size,
++                           GumPageProtection * prot)
++{
++  return FALSE;
++}
diff --git a/frida-gum/patches/patch-gum_backend-netbsd_gumnetbsd.h b/frida-gum/patches/patch-gum_backend-netbsd_gumnetbsd.h
new file mode 100644
index 0000000000..b14569b0fb
--- /dev/null
+++ b/frida-gum/patches/patch-gum_backend-netbsd_gumnetbsd.h
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- gum/backend-netbsd/gumnetbsd.h.orig	2018-03-15 02:54:36.264206001 +0000
++++ gum/backend-netbsd/gumnetbsd.h
+@@ -0,0 +1,29 @@
++/*
++ * Copyright (C) 2012-2015 Ole André Vadla Ravnås <ole.andre.ravnas%tillitech.com@localhost>
++ *
++ * Licence: wxWindows Library Licence, Version 3.1
++ */
++
++#ifndef __GUM_NETBSD_H__
++#define __GUM_NETBSD_H__
++
++#include "gumprocess.h"
++
++#include <ucontext.h>
++
++G_BEGIN_DECLS
++
++GUM_API GumCpuType gum_netbsd_cpu_type_from_file (const gchar * path,
++    GError ** error);
++GUM_API GumCpuType gum_netbsd_cpu_type_from_pid (pid_t pid, GError ** error);
++GUM_API void gum_netbsd_enumerate_ranges (pid_t pid, GumPageProtection prot,
++    GumFoundRangeFunc func, gpointer user_data);
++
++GUM_API void gum_netbsd_parse_ucontext (const ucontext_t * uc,
++    GumCpuContext * ctx);
++GUM_API void gum_netbsd_unparse_ucontext (const GumCpuContext * ctx,
++    ucontext_t * uc);
++
++G_END_DECLS
++
++#endif
diff --git a/frida-gum/patches/patch-gum_backend-netbsd_gumprocess-netbsd.c b/frida-gum/patches/patch-gum_backend-netbsd_gumprocess-netbsd.c
new file mode 100644
index 0000000000..41e5a7ec9c
--- /dev/null
+++ b/frida-gum/patches/patch-gum_backend-netbsd_gumprocess-netbsd.c
@@ -0,0 +1,635 @@
+$NetBSD$
+
+--- gum/backend-netbsd/gumprocess-netbsd.c.orig	2018-03-15 02:54:36.265318075 +0000
++++ gum/backend-netbsd/gumprocess-netbsd.c
+@@ -0,0 +1,630 @@
++/*
++ * Copyright (C) 2010-2018 Ole André Vadla Ravnås <oleavr%nowsecure.com@localhost>
++ *
++ * Licence: wxWindows Library Licence, Version 3.1
++ */
++
++#include "gumprocess-priv.h"
++
++#include "backend-elf/gumelfmodule.h"
++#include "gumnetbsd.h"
++#include "gummodulemap.h"
++
++#include <dlfcn.h>
++#include <errno.h>
++#include <link.h>
++#include <sched.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++#include <gio/gio.h>
++#include <sys/types.h>
++#include <sys/ptrace.h>
++#include <sys/socket.h>
++#include <sys/syscall.h>
++#include <sys/types.h>
++#include <sys/uio.h>
++#include <sys/wait.h>
++#include <link.h>
++
++typedef struct _GumModifyThreadContext GumModifyThreadContext;
++typedef guint8 GumModifyThreadAck;
++
++typedef struct _GumEnumerateModulesContext GumEnumerateModulesContext;
++typedef struct _GumEmitExecutableModuleContext GumEmitExecutableModuleContext;
++typedef struct _GumCopyLinkerModuleContext GumCopyLinkerModuleContext;
++typedef struct _GumEnumerateImportsContext GumEnumerateImportsContext;
++typedef struct _GumDependencyExport GumDependencyExport;
++typedef struct _GumEnumerateModuleSymbolContext GumEnumerateModuleSymbolContext;
++typedef struct _GumEnumerateModuleRangesContext GumEnumerateModuleRangesContext;
++typedef struct _GumResolveModuleNameContext GumResolveModuleNameContext;
++
++typedef gint (* GumFoundDlPhdrFunc) (struct dl_phdr_info * info,
++    gsize size, gpointer data);
++typedef void (* GumDlIteratePhdrImpl) (GumFoundDlPhdrFunc func, gpointer data);
++
++typedef struct _GumUserDesc GumUserDesc;
++
++typedef gint (* GumCloneFunc) (gpointer arg);
++
++enum _GumModifyThreadAck
++{
++  GUM_ACK_ATTACHED = 1,
++  GUM_ACK_STOPPED,
++  GUM_ACK_READ_CONTEXT,
++  GUM_ACK_MODIFIED_CONTEXT,
++  GUM_ACK_WROTE_CONTEXT,
++  GUM_ACK_FAILED_TO_ATTACH,
++  GUM_ACK_FAILED_TO_READ,
++  GUM_ACK_FAILED_TO_WRITE,
++  GUM_ACK_FAILED_TO_DETACH
++};
++
++struct _GumModifyThreadContext
++{
++  gint fd[2];
++  GumThreadId thread_id;
++  GumCpuContext cpu_context;
++};
++
++struct _GumEnumerateModulesContext
++{
++  GumFoundModuleFunc func;
++  gpointer user_data;
++
++  GHashTable * names;
++  GHashTable * sizes;
++
++  guint index;
++  gboolean carry_on;
++  GumModuleDetails * linker_module;
++};
++
++struct _GumEmitExecutableModuleContext
++{
++  const gchar * executable_path;
++  GumFoundModuleFunc func;
++  gpointer user_data;
++
++  gboolean carry_on;
++};
++
++struct _GumCopyLinkerModuleContext
++{
++  GumAddress address_in_linker;
++  GumModuleDetails * linker_module;
++};
++
++struct _GumEnumerateImportsContext
++{
++  GumFoundImportFunc func;
++  gpointer user_data;
++
++  GHashTable * dependency_exports;
++  GumElfModule * current_dependency;
++  GumModuleMap * module_map;
++};
++
++struct _GumDependencyExport
++{
++  gchar * module;
++  GumAddress address;
++};
++
++struct _GumEnumerateModuleSymbolContext
++{
++  GumFoundSymbolFunc func;
++  gpointer user_data;
++
++  GArray * sections;
++};
++
++struct _GumEnumerateModuleRangesContext
++{
++  gchar * module_name;
++  GumFoundRangeFunc func;
++  gpointer user_data;
++};
++
++struct _GumResolveModuleNameContext
++{
++  gchar * name;
++  gchar * path;
++  GumAddress base;
++};
++
++struct _GumUserDesc
++{
++  guint entry_number;
++  guint base_addr;
++  guint limit;
++  guint seg_32bit : 1;
++  guint contents : 2;
++  guint read_exec_only : 1;
++  guint limit_in_pages : 1;
++  guint seg_not_present : 1;
++  guint useable : 1;
++};
++
++static gint gum_do_modify_thread (gpointer data);
++static gboolean gum_await_ack (gint fd, GumModifyThreadAck expected_ack);
++static void gum_put_ack (gint fd, GumModifyThreadAck ack);
++
++static void gum_store_cpu_context (GumThreadId thread_id,
++    GumCpuContext * cpu_context, gpointer user_data);
++
++static void gum_process_enumerate_modules_by_using_libc (
++    GumDlIteratePhdrImpl iterate_phdr, GumFoundModuleFunc func,
++    gpointer user_data);
++static gint gum_emit_module_from_phdr (struct dl_phdr_info * info, gsize size,
++    gpointer user_data);
++static GumAddress gum_resolve_base_address_from_phdr (
++    struct dl_phdr_info * info);
++static gboolean gum_emit_executable_module (const GumModuleDetails * details,
++    gpointer user_data);
++
++static void gum_process_enumerate_modules_by_parsing_proc_maps (
++    GumFoundModuleFunc func, gpointer user_data);
++
++static void gum_process_build_named_range_indexes (GHashTable ** names,
++    GHashTable ** sizes);
++
++static gboolean gum_emit_import (const GumImportDetails * details,
++    gpointer user_data);
++static gboolean gum_collect_dependency_exports (
++    const GumElfDependencyDetails * details, gpointer user_data);
++static gboolean gum_collect_dependency_export (const GumExportDetails * details,
++    gpointer user_data);
++static GumDependencyExport * gum_dependency_export_new (const gchar * module,
++    GumAddress address);
++static void gum_dependency_export_free (GumDependencyExport * export);
++static gboolean gum_emit_symbol (const GumElfSymbolDetails * details,
++    gpointer user_data);
++static gboolean gum_append_symbol_section (const GumElfSectionDetails * details,
++    gpointer user_data);
++static void gum_symbol_section_destroy (GumSymbolSection * self);
++static gboolean gum_emit_range_if_module_name_matches (
++    const GumRangeDetails * details, gpointer user_data);
++
++static gchar * gum_resolve_module_name (const gchar * name, GumAddress * base);
++static gboolean gum_store_module_path_and_base_if_name_matches (
++    const GumModuleDetails * details, gpointer user_data);
++static gboolean gum_module_path_equals (const gchar * path,
++    const gchar * name_or_path);
++
++static GumElfModule * gum_open_elf_module (const gchar * name);
++
++static gboolean gum_thread_read_state (GumThreadId tid, GumThreadState * state);
++static GumThreadState gum_thread_state_from_proc_status_character (gchar c);
++static GumPageProtection gum_page_protection_from_proc_perms_string (
++    const gchar * perms);
++
++static gssize gum_get_regs (pid_t pid, GumRegs * regs);
++static gssize gum_set_regs (pid_t pid, const GumRegs * regs);
++
++static void gum_parse_regs (const GumRegs * regs, GumCpuContext * ctx);
++static void gum_unparse_regs (const GumCpuContext * ctx, GumRegs * regs);
++
++static gssize gum_libc_clone (GumCloneFunc child_func, gpointer child_stack,
++    gint flags, gpointer arg, pid_t * parent_tidptr, GumUserDesc * tls,
++    pid_t * child_tidptr);
++static gssize gum_libc_read (gint fd, gpointer buf, gsize count);
++static gssize gum_libc_write (gint fd, gconstpointer buf, gsize count);
++static gssize gum_libc_ptrace (gsize request, pid_t pid, gpointer address,
++    gpointer data);
++
++#define gum_libc_syscall_3(n, a, b, c) gum_libc_syscall_4 (n, a, b, c, 0)
++static gssize gum_libc_syscall_4 (gsize n, gsize a, gsize b, gsize c, gsize d);
++
++static gboolean gum_is_regset_supported = TRUE;
++
++gboolean
++gum_process_is_debugger_attached (void)
++{
++  return FALSE;
++}
++
++GumThreadId
++gum_process_get_current_thread_id (void)
++{
++  return _lwp_self();
++}
++
++gboolean
++gum_process_modify_thread (GumThreadId thread_id,
++                           GumModifyThreadFunc func,
++                           gpointer user_data)
++{
++  return FALSE;
++}
++
++static gint
++gum_do_modify_thread (gpointer data)
++{
++  return 0;
++}
++
++static gboolean
++gum_await_ack (gint fd,
++               GumModifyThreadAck expected_ack)
++{
++  return FALSE;
++}
++
++static void
++gum_put_ack (gint fd,
++             GumModifyThreadAck ack)
++{
++}
++
++void
++_gum_process_enumerate_threads (GumFoundThreadFunc func,
++                                gpointer user_data)
++{
++}
++
++static void
++gum_store_cpu_context (GumThreadId thread_id,
++                       GumCpuContext * cpu_context,
++                       gpointer user_data)
++{
++}
++
++void
++gum_process_enumerate_modules (GumFoundModuleFunc func,
++                               gpointer user_data)
++{
++}
++
++static void
++gum_process_enumerate_modules_by_using_libc (GumDlIteratePhdrImpl iterate_phdr,
++                                             GumFoundModuleFunc func,
++                                             gpointer user_data)
++{
++}
++
++static gint
++gum_emit_module_from_phdr (struct dl_phdr_info * info,
++                           gsize size,
++                           gpointer user_data)
++{
++  return 0;
++}
++
++static GumAddress
++gum_resolve_base_address_from_phdr (struct dl_phdr_info * info)
++{
++  return NULL;
++}
++
++static gboolean
++gum_emit_executable_module (const GumModuleDetails * details,
++                            gpointer user_data)
++{
++  return FALSE;
++}
++
++static void
++gum_process_enumerate_modules_by_parsing_proc_maps (GumFoundModuleFunc func,
++                                                    gpointer user_data)
++{
++}
++
++static void
++gum_process_build_named_range_indexes (GHashTable ** names,
++                                       GHashTable ** sizes)
++{
++}
++
++static gboolean
++gum_copy_linker_module (const GumModuleDetails * details,
++                        gpointer user_data)
++{
++  return FALSE;
++}
++
++static GumModuleDetails *
++gum_module_details_dup (const GumModuleDetails * module)
++{
++  return NULL;
++}
++
++static void
++gum_module_details_free (GumModuleDetails * module)
++{
++}
++
++void
++_gum_process_enumerate_ranges (GumPageProtection prot,
++                               GumFoundRangeFunc func,
++                               gpointer user_data)
++{
++}
++
++void
++gum_netbsd_enumerate_ranges (pid_t pid,
++                            GumPageProtection prot,
++                            GumFoundRangeFunc func,
++                            gpointer user_data)
++{
++}
++
++void
++gum_process_enumerate_malloc_ranges (GumFoundMallocRangeFunc func,
++                                     gpointer user_data)
++{
++  /* Not implemented */
++}
++
++guint
++gum_thread_try_get_ranges (GumMemoryRange * ranges,
++                           guint max_length)
++{
++  /* Not implemented */
++  return 0;
++}
++
++gint
++gum_thread_get_system_error (void)
++{
++  return errno;
++}
++
++void
++gum_thread_set_system_error (gint value)
++{
++  errno = value;
++}
++
++gboolean
++gum_module_ensure_initialized (const gchar * module_name)
++{
++  return FALSE;
++}
++
++void
++gum_module_enumerate_imports (const gchar * module_name,
++                              GumFoundImportFunc func,
++                              gpointer user_data)
++{
++}
++
++static gboolean
++gum_emit_import (const GumImportDetails * details,
++                 gpointer user_data)
++{
++  return FALSE;
++}
++
++static gboolean
++gum_collect_dependency_exports (const GumElfDependencyDetails * details,
++                                gpointer user_data)
++{
++  return FALSE;
++}
++
++static gboolean
++gum_collect_dependency_export (const GumExportDetails * details,
++                               gpointer user_data)
++{
++  return FALSE;
++}
++
++static GumDependencyExport *
++gum_dependency_export_new (const gchar * module,
++                           GumAddress address)
++{
++  return NULL;
++}
++
++static void
++gum_dependency_export_free (GumDependencyExport * export)
++{
++}
++
++void
++gum_module_enumerate_exports (const gchar * module_name,
++                              GumFoundExportFunc func,
++                              gpointer user_data)
++{
++}
++
++void
++gum_module_enumerate_symbols (const gchar * module_name,
++                              GumFoundSymbolFunc func,
++                              gpointer user_data)
++{
++}
++
++static gboolean
++gum_emit_symbol (const GumElfSymbolDetails * details,
++                 gpointer user_data)
++{
++  return FALSE;
++}
++
++static gboolean
++gum_append_symbol_section (const GumElfSectionDetails * details,
++                           gpointer user_data)
++{
++  return FALSE;
++}
++
++static void
++gum_symbol_section_destroy (GumSymbolSection * self)
++{
++}
++
++void
++gum_module_enumerate_ranges (const gchar * module_name,
++                             GumPageProtection prot,
++                             GumFoundRangeFunc func,
++                             gpointer user_data)
++{
++}
++
++static gboolean
++gum_emit_range_if_module_name_matches (const GumRangeDetails * details,
++                                       gpointer user_data)
++{
++  return FALSE;
++}
++
++GumAddress
++gum_module_find_base_address (const gchar * module_name)
++{
++  return 0;
++}
++
++GumAddress
++gum_module_find_export_by_name (const gchar * module_name,
++                                const gchar * symbol_name)
++{
++  return 0;
++}
++
++GumCpuType
++gum_linux_cpu_type_from_file (const gchar * path,
++                              GError ** error)
++{
++  return 0;
++}
++
++GumCpuType
++gum_linux_cpu_type_from_pid (pid_t pid,
++                             GError ** error)
++{
++  return 0;
++}
++
++static gchar *
++gum_resolve_module_name (const gchar * name,
++                         GumAddress * base)
++{
++  return NULL;
++}
++
++static gboolean
++gum_store_module_path_and_base_if_name_matches (const GumModuleDetails * details,
++                                                gpointer user_data)
++{
++  return FALSE;
++}
++
++static gboolean
++gum_module_path_equals (const gchar * path,
++                        const gchar * name_or_path)
++{
++  return FALSE;
++}
++
++static GumElfModule *
++gum_open_elf_module (const gchar * name)
++{
++  return NULL;
++}
++
++void
++gum_netbsd_parse_ucontext (const ucontext_t * uc,
++                          GumCpuContext * ctx)
++{
++}
++
++void
++gum_netbsd_unparse_ucontext (const GumCpuContext * ctx,
++                            ucontext_t * uc)
++{
++}
++
++static void
++gum_parse_regs (const GumRegs * regs,
++                GumCpuContext * ctx)
++{
++}
++
++static void
++gum_unparse_regs (const GumCpuContext * ctx,
++                  GumRegs * regs)
++{
++}
++
++static gboolean
++gum_thread_read_state (GumThreadId tid,
++                       GumThreadState * state)
++{
++  return FALSE;
++}
++
++static GumThreadState
++gum_thread_state_from_proc_status_character (gchar c)
++{
++  return 0;
++}
++
++static GumPageProtection
++gum_page_protection_from_proc_perms_string (const gchar * perms)
++{
++  return 0;
++}
++
++static gssize
++gum_get_regs (pid_t pid,
++              GumRegs * regs)
++{
++  return 0;
++}
++
++static gssize
++gum_set_regs (pid_t pid,
++              const GumRegs * regs)
++{
++  return 0;
++}
++
++static gssize
++gum_libc_clone (GumCloneFunc child_func,
++                gpointer child_stack,
++                gint flags,
++                gpointer arg,
++                pid_t * parent_tidptr,
++                GumUserDesc * tls,
++                pid_t * child_tidptr)
++{
++  return 0;
++}
++
++static gssize
++gum_libc_read (gint fd,
++               gpointer buf,
++               gsize count)
++{
++  return 0;
++}
++
++static gssize
++gum_libc_write (gint fd,
++                gconstpointer buf,
++                gsize count)
++{
++  return 0;
++}
++
++static gssize
++gum_libc_ptrace (gsize request,
++                 pid_t pid,
++                 gpointer address,
++                 gpointer data)
++{
++  return 0;
++}
++
++static gssize
++gum_libc_syscall_4 (gsize n,
++                    gsize a,
++                    gsize b,
++                    gsize c,
++                    gsize d)
++{
++  return 0;
++}
diff --git a/frida-gum/patches/patch-gum_meson.build b/frida-gum/patches/patch-gum_meson.build
new file mode 100644
index 0000000000..bf80e5437f
--- /dev/null
+++ b/frida-gum/patches/patch-gum_meson.build
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- gum/meson.build.orig	2018-03-12 19:53:33.000000000 +0000
++++ gum/meson.build
+@@ -128,6 +128,19 @@ if host_os_family == 'linux'
+   ]
+ endif
+ 
++if host_os_family == 'netbsd'
++  gum_headers += [
++    'backend-netbsd/gumnetbsd.h',
++  ]
++  gum_sources += [
++    'backend-netbsd/gummemory-netbsd.c',
++    'backend-posix/gummemory-posix.c',
++    'backend-netbsd/gumprocess-netbsd.c',
++    'backend-posix/gumtls-posix.c',
++    'backend-posix/gumexceptor-posix.c',
++  ]
++endif
++
+ if host_os_family == 'qnx'
+   gum_headers += [
+     'backend-qnx/gumqnx.h',
+@@ -141,7 +154,7 @@ if host_os_family == 'qnx'
+   ]
+ endif
+ 
+-if host_os_family == 'linux' or host_os_family == 'qnx'
++if host_os_family == 'linux' or host_os_family == 'qnx' or host_os_family == 'netbsd'
+   gum_sources += [
+     'backend-elf/gumelfmodule.c',
+   ]
diff --git a/frida-gum/patches/patch-libs_gum_prof_meson.build b/frida-gum/patches/patch-libs_gum_prof_meson.build
new file mode 100644
index 0000000000..b2e8f61517
--- /dev/null
+++ b/frida-gum/patches/patch-libs_gum_prof_meson.build
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- libs/gum/prof/meson.build.orig	2018-03-12 19:53:33.000000000 +0000
++++ libs/gum/prof/meson.build
+@@ -38,6 +38,13 @@ if host_os_family == 'linux'
+   endif
+ endif
+ 
++if host_os_family == 'netbsd'
++  gum_prof_sources += ['gumbusycyclesampler-netbsd.c']
++  if not host_cpu_is_intel
++    gum_prof_sources += ['gumcyclesampler-netbsd.c']
++  endif
++endif
++
+ if host_os_family == 'qnx'
+   gum_prof_sources += [
+     'gumbusycyclesampler-qnx.c',


Home | Main Index | Thread Index | Old Index