pass values instead of argument numbers to fetch
diff --git a/sysdeps/README b/sysdeps/README
index 58abd08..1ec4935 100644
--- a/sysdeps/README
+++ b/sysdeps/README
@@ -24,6 +24,7 @@
void * get_return_addr(pid_t pid, void * stack_pointer);
long gimme_arg(enum tof type, struct process * proc, int arg_num);
int umovestr(struct process * proc, void * addr, int len, void * laddr);
+int umovelong(struct process * proc, void * addr, long * result);
char * pid2name(pid_t pid);
void trace_me(void);
int trace_pid(pid_t pid);
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index 136d288..a1af202 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -151,6 +151,24 @@
}
}
+/* Read a single long from the process's memory address 'addr' */
+int umovelong(struct process *proc, void *addr, long *result)
+{
+ long pointed_to;
+
+ errno = 0;
+ pointed_to = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
+ if (pointed_to == -1 && errno)
+ return -errno;
+
+ *result = pointed_to;
+ return 0;
+}
+
+/* Read a series of bytes starting at the process's memory address
+ 'addr' and continuing until a NUL ('\0') is seen or 'len' bytes
+ have been read.
+*/
int umovestr(struct process *proc, void *addr, int len, void *laddr)
{
union {