
//typedef long long ino64_t;
#define _GNU_SOURCE

#include <hurd.h>
#include <argp.h>
#include <error.h>
#include <stdio.h>
#include <cthreads.h>

#include "probe_lib.c"

int pre_exec(int probe, char* mem, int mem_size, void* data)
{
  printf("Probe pre exec %x thread:%x ! %d\n", mem, ((int*)mem)[0], *(int*)data);
  ++(*(int*)data);
  return PROBE_CONT;
}

int post_exec(int probe, char* mem, int mem_size, void* data)
{
  return PROBE_CONT;
}

int main(int argc, char* argv[])
{
  printf("Mach arm probe: %x\n", mach_arm_probe);

  int sum = 0;


  // NOTE: You ought to look up that constant below and make sure it points to active_threads in your kernel


  instrument_sym("ipc_kobject_server", (void*)0x002f9050, 4, pre_exec, post_exec, &sum);

  printf("X\n");
  return 0;
}
