Add proc_find_symbol, use it to find corresponding symbols for clones
The code in breakpoint_clone was buggy--it looked through old_proc's
symbols. It was also needlessly verbose, proc_find_symbol uses library
key to find the right library. Instead use the new interface and call
it on new_proc to find the new symbol.
We also didn't relink symbols in stack elements of a cloned process in
process_clone. Use proc_find_symbol for this as well.
diff --git a/proc.h b/proc.h
index ab8794b..68054b3 100644
--- a/proc.h
+++ b/proc.h
@@ -241,4 +241,12 @@
* If tag is not found, return a negative value. */
int proc_find_dynamic_entry_addr(struct Process *proc, arch_addr_t src_addr,
int d_tag, arch_addr_t *ret);
+
+/* Finds a symbol corresponding to LIBSYM in a process PROC. Returns
+ * 0 and sets *RETLIB and *RETSYM if the corresponding pointer is
+ * non-NULL. Returns a negative value when the symbols couldn't be
+ * found. */
+int proc_find_symbol(struct Process *proc, struct library_symbol *sym,
+ struct library **retlib, struct library_symbol **retsym);
+
#endif /* _PROC_H_ */