Use os_process_data for keeping debug status

This also takes care of a leak caused by malloc'ing struct debug.  That
malloc is not done anymore, because the data is embedded in struct Process
by way of struct os_process_data.
diff --git a/sysdeps/linux-gnu/proc.c b/sysdeps/linux-gnu/proc.c
index b2d20f0..57f38c5 100644
--- a/sysdeps/linux-gnu/proc.c
+++ b/sysdeps/linux-gnu/proc.c
@@ -535,21 +535,12 @@
 	return;
 }
 
-/* A struct stored at proc->debug.  */
-struct debug_struct
-{
-	arch_addr_t debug_addr;
-	int state;
-};
-
 static int
 load_debug_struct(struct Process *proc, struct lt_r_debug_64 *ret)
 {
 	debug(DEBUG_FUNCTION, "load_debug_struct");
 
-	struct debug_struct *debug = proc->debug;
-
-	if (rdebug_fetcher(proc)(proc, debug->debug_addr, ret) < 0) {
+	if (rdebug_fetcher(proc)(proc, proc->os.debug_addr, ret) < 0) {
 		debug(2, "This process does not have a debug structure!\n");
 		return -1;
 	}
@@ -568,22 +559,23 @@
 		return;
 	}
 
-	struct debug_struct *debug = proc->debug;
 	if (rdbg.r_state == RT_CONSISTENT) {
 		debug(2, "Linkmap is now consistent");
-		if (debug->state == RT_ADD) {
+		switch (proc->os.debug_state) {
+		case RT_ADD:
 			debug(2, "Adding DSO to linkmap");
-			//data.proc = proc;
 			crawl_linkmap(proc, &rdbg);
-			//&data);
-		} else if (debug->state == RT_DELETE) {
+			break;
+		case RT_DELETE:
 			debug(2, "Removing DSO from linkmap");
-		} else {
+			// XXX unload that library
+			break;
+		default:
 			debug(2, "Unexpected debug state!");
 		}
 	}
 
-	debug->state = rdbg.r_state;
+	proc->os.debug_state = rdbg.r_state;
 }
 
 #ifndef ARCH_HAVE_FIND_DL_DEBUG
@@ -600,20 +592,9 @@
 {
 	debug(DEBUG_FUNCTION, "linkmap_init(%d, dyn_addr=%p)", proc->pid, dyn_addr);
 
-	struct debug_struct *debug = malloc(sizeof(*debug));
-	if (debug == NULL) {
-		fprintf(stderr, "couldn't allocate debug struct: %s\n",
-			strerror(errno));
-	fail:
-		proc->debug = NULL;
-		free(debug);
-		return -1;
-	}
-	proc->debug = debug;
-
-	if (arch_find_dl_debug(proc, dyn_addr, &debug->debug_addr) == -1) {
+	if (arch_find_dl_debug(proc, dyn_addr, &proc->os.debug_addr) == -1) {
 		debug(2, "Couldn't find debug structure!");
-		goto fail;
+		return -1;
 	}
 
 	int status;
@@ -627,7 +608,7 @@
 	 * arch_addr_t becomes integral type.  */
 	arch_addr_t addr = (arch_addr_t)(uintptr_t)rdbg.r_brk;
 	if (arch_translate_address_dyn(proc, addr, &addr) < 0)
-		goto fail;
+		return -1;
 
 	struct breakpoint *rdebug_bp = insert_breakpoint(proc, addr, NULL);
 	static struct bp_callbacks rdebug_callbacks = {
@@ -706,3 +687,29 @@
 		*interp_biasp = at_bias;
 	goto done;
 }
+
+int
+os_process_init(struct Process *proc)
+{
+	proc->os.debug_addr = 0;
+	proc->os.debug_state = 0;
+	return 0;
+}
+
+void
+os_process_destroy(struct Process *proc)
+{
+}
+
+int
+os_process_clone(struct Process *retp, struct Process *proc)
+{
+	retp->os = proc->os;
+	return 0;
+}
+
+int
+os_process_exec(struct Process *proc)
+{
+	return 0;
+}