Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thread: Support hardware breakpoints and watchpoints #817

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- uses: nttld/setup-ndk@v1
if: startsWith(matrix.id, 'android-')
id: setup-ndk
with:
ndk-version: r25
add-to-path: false
- name: Set ANDROID_NDK_ROOT
if: startsWith(matrix.id, 'android-')
run: echo "ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV
- name: Build
run: |
./configure --host=${{ matrix.id }} ${{ env.GUM_OPTIONS }}
Expand Down
26 changes: 3 additions & 23 deletions bindings/gumjs/gumquickprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,14 @@ void
_gum_quick_process_init (GumQuickProcess * self,
JSValue ns,
GumQuickModule * module,
GumQuickThread * thread,
GumQuickCore * core)
{
JSContext * ctx = core->ctx;
JSValue obj;

self->module = module;
self->thread = thread;
self->core = core;

self->main_module_value = JS_UNINITIALIZED;
Expand Down Expand Up @@ -308,31 +310,9 @@ gum_emit_thread (const GumThreadDetails * details,
GumQuickMatchContext * mc)
{
JSContext * ctx = mc->ctx;
GumQuickCore * core = mc->parent->core;
JSValue thread, result;

thread = JS_NewObject (ctx);

JS_DefinePropertyValue (ctx, thread,
GUM_QUICK_CORE_ATOM (core, id),
JS_NewInt64 (ctx, details->id),
JS_PROP_C_W_E);
if (details->name != NULL)
{
JS_DefinePropertyValue (ctx, thread,
GUM_QUICK_CORE_ATOM (core, name),
JS_NewString (ctx, details->name),
JS_PROP_C_W_E);
}
JS_DefinePropertyValue (ctx, thread,
GUM_QUICK_CORE_ATOM (core, state),
_gum_quick_thread_state_new (ctx, details->state),
JS_PROP_C_W_E);
JS_DefinePropertyValue (ctx, thread,
GUM_QUICK_CORE_ATOM (core, context),
_gum_quick_cpu_context_new (ctx, (GumCpuContext *) &details->cpu_context,
GUM_CPU_CONTEXT_READONLY, core, NULL),
JS_PROP_C_W_E);
thread = _gum_quick_thread_new (ctx, details, mc->parent->thread);

result = JS_Call (ctx, mc->on_match, JS_UNDEFINED, 1, &thread);

Expand Down
6 changes: 5 additions & 1 deletion bindings/gumjs/gumquickprocess.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2020-2024 Ole André Vadla Ravnås <[email protected]>
* Copyright (C) 2023 Francesco Tamagni <[email protected]>
* Copyright (C) 2024 Håvard Sørbø <[email protected]>
*
* Licence: wxWindows Library Licence, Version 3.1
*/
Expand All @@ -10,6 +11,7 @@

#include "gumquickcore.h"
#include "gumquickmodule.h"
#include "gumquickthread.h"

G_BEGIN_DECLS

Expand All @@ -19,6 +21,7 @@ typedef struct _GumQuickExceptionHandler GumQuickExceptionHandler;
struct _GumQuickProcess
{
GumQuickModule * module;
GumQuickThread * thread;
GumQuickCore * core;

JSValue main_module_value;
Expand All @@ -30,7 +33,8 @@ struct _GumQuickProcess
};

G_GNUC_INTERNAL void _gum_quick_process_init (GumQuickProcess * self,
JSValue ns, GumQuickModule * module, GumQuickCore * core);
JSValue ns, GumQuickModule * module, GumQuickThread * thread,
GumQuickCore * core);
G_GNUC_INTERNAL void _gum_quick_process_flush (GumQuickProcess * self);
G_GNUC_INTERNAL void _gum_quick_process_dispose (GumQuickProcess * self);
G_GNUC_INTERNAL void _gum_quick_process_finalize (GumQuickProcess * self);
Expand Down
13 changes: 7 additions & 6 deletions bindings/gumjs/gumquickscript.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ struct _GumQuickScript
GumQuickKernel kernel;
GumQuickMemory memory;
GumQuickModule module;
GumQuickProcess process;
GumQuickThread thread;
GumQuickProcess process;
GumQuickFile file;
GumQuickChecksum checksum;
GumQuickStream stream;
Expand Down Expand Up @@ -478,8 +478,9 @@ gum_quick_script_create_context (GumQuickScript * self,
_gum_quick_kernel_init (&self->kernel, global_obj, core);
_gum_quick_memory_init (&self->memory, global_obj, core);
_gum_quick_module_init (&self->module, global_obj, core);
_gum_quick_process_init (&self->process, global_obj, &self->module, core);
_gum_quick_thread_init (&self->thread, global_obj, core);
_gum_quick_process_init (&self->process, global_obj, &self->module,
&self->thread, core);
_gum_quick_file_init (&self->file, global_obj, core);
_gum_quick_checksum_init (&self->checksum, global_obj, core);
_gum_quick_stream_init (&self->stream, global_obj, core);
Expand Down Expand Up @@ -548,8 +549,8 @@ gum_quick_script_destroy_context (GumQuickScript * self)
_gum_quick_stream_dispose (&self->stream);
_gum_quick_checksum_dispose (&self->checksum);
_gum_quick_file_dispose (&self->file);
_gum_quick_thread_dispose (&self->thread);
_gum_quick_process_dispose (&self->process);
_gum_quick_thread_dispose (&self->thread);
_gum_quick_module_dispose (&self->module);
_gum_quick_memory_dispose (&self->memory);
_gum_quick_kernel_dispose (&self->kernel);
Expand Down Expand Up @@ -591,8 +592,8 @@ gum_quick_script_destroy_context (GumQuickScript * self)
_gum_quick_stream_finalize (&self->stream);
_gum_quick_checksum_finalize (&self->checksum);
_gum_quick_file_finalize (&self->file);
_gum_quick_thread_finalize (&self->thread);
_gum_quick_process_finalize (&self->process);
_gum_quick_thread_finalize (&self->thread);
_gum_quick_module_finalize (&self->module);
_gum_quick_memory_finalize (&self->memory);
_gum_quick_kernel_finalize (&self->kernel);
Expand Down Expand Up @@ -1139,9 +1140,9 @@ _gum_quick_script_make_worker (GumQuickScript * self,
_gum_quick_kernel_init (&worker->kernel, global_obj, core);
_gum_quick_memory_init (&worker->memory, global_obj, core);
_gum_quick_module_init (&worker->module, global_obj, core);
_gum_quick_process_init (&worker->process, global_obj, &worker->module,
core);
_gum_quick_thread_init (&worker->thread, global_obj, core);
_gum_quick_process_init (&worker->process, global_obj, &worker->module,
&worker->thread, core);
_gum_quick_file_init (&worker->file, global_obj, core);
_gum_quick_checksum_init (&worker->checksum, global_obj, core);
_gum_quick_stream_init (&worker->stream, global_obj, core);
Expand Down
Loading
Loading