Index: target.h =================================================================== RCS file: /cvs/src/src/gdb/target.h,v retrieving revision 1.76 diff -u -r1.76 target.h --- target.h 4 Sep 2005 16:18:20 -0000 1.76 +++ target.h 29 Sep 2005 16:56:31 -0000 @@ -53,6 +53,7 @@ #include "symtab.h" #include "dcache.h" #include "memattr.h" +#include "gdbthread.h" enum strata { @@ -374,6 +375,7 @@ void (*to_find_new_threads) (void); char *(*to_pid_to_str) (ptid_t); char *(*to_extra_thread_info) (struct thread_info *); + void (*to_delete_extra_thread_info) (struct private_thread_info *); void (*to_stop) (void); void (*to_rcmd) (char *command, struct ui_file *output); struct symtab_and_line *(*to_enable_exception_callback) (enum @@ -923,6 +925,11 @@ #define target_extra_thread_info(TP) \ (current_target.to_extra_thread_info (TP)) +/* Free any data held in private thread info. The private_thread_info + structure is freed by the caller. */ +#define target_delete_extra_thread_info(P) \ + (current_target.to_delete_extra_thread_info (P)) + /* * New Objfile Event Hook: * Index: target.c =================================================================== RCS file: /cvs/src/src/gdb/target.c,v retrieving revision 1.111 diff -u -r1.111 target.c --- target.c 4 Sep 2005 16:18:20 -0000 1.111 +++ target.c 29 Sep 2005 16:56:31 -0000 @@ -434,6 +434,7 @@ INHERIT (to_find_new_threads, t); INHERIT (to_pid_to_str, t); INHERIT (to_extra_thread_info, t); + INHERIT (to_delete_extra_thread_info, t); INHERIT (to_stop, t); /* Do not inherit to_xfer_partial. */ INHERIT (to_rcmd, t); @@ -608,6 +609,9 @@ de_fault (to_extra_thread_info, (char *(*) (struct thread_info *)) return_zero); + de_fault (to_delete_extra_thread_info, + (void (*) (struct private_thread_info *)) + target_ignore); de_fault (to_stop, (void (*) (void)) target_ignore); Index: thread.c =================================================================== RCS file: /cvs/src/src/gdb/thread.c,v retrieving revision 1.46 diff -u -r1.46 thread.c --- thread.c 15 Feb 2005 15:49:22 -0000 1.46 +++ thread.c 29 Sep 2005 16:56:32 -0000 @@ -91,10 +91,11 @@ if (tp->step_resume_breakpoint) delete_breakpoint (tp->step_resume_breakpoint); - /* FIXME: do I ever need to call the back-end to give it a - chance at this private data before deleting the thread? */ if (tp->private) - xfree (tp->private); + { + target_delete_extra_thread_info(tp->private); + xfree (tp->private); + } xfree (tp); }