diff options
Diffstat (limited to '')
-rw-r--r-- | test/test-pc-patch.c (renamed from test/test-stop-threads.c) | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/test/test-stop-threads.c b/test/test-pc-patch.c index d53d8cd..5ae3570 100644 --- a/test/test-stop-threads.c +++ b/test/test-pc-patch.c @@ -1,7 +1,8 @@ #include "substitute-internal.h" -#include "stop-other-threads.h" +#include "execmem.h" #include <stdio.h> #include <unistd.h> +#include <stdlib.h> #include <pthread.h> #include <assert.h> /* printf without taking any locks - because they might be taken at stop time */ @@ -32,14 +33,17 @@ int main() { for (long i = 0; i < 10; i++) pthread_create(&pts[i], NULL, some_thread, (void *) i); sleep(1); - void *stop_token; - ulprintf("stopping\n"); - assert(!stop_other_threads(&stop_token)); - ulprintf("stopped\n"); - assert(!apply_pc_patch_callback(stop_token, patch_callback, NULL)); - ulprintf("resuming\n"); - assert(!resume_other_threads(stop_token)); - ulprintf("resumed\n"); + char *foo = malloc(0x10000); + static char bar[16]; + struct execmem_foreign_write writes[] = { + {foo, bar, 5}, + {foo + 7, bar + 7, 3}, + }; + int ret = execmem_foreign_write_with_pc_patch(writes, + sizeof(writes)/sizeof(*writes), + patch_callback, + NULL); + ulprintf("==> %d\n", ret); void *out; for (long i = 0; i < 10; i++) assert(!pthread_join(pts[i], &out)); |