* linux-low.c (linux_remove_process): Add `detaching' parameter.

Pass it to thread_db_free.
	(linux_kill, linux_detach, linux_wait_1): Adjust to pass the
	proper `detaching' argument to linux_remove_process.
	* linux-low.h (thread_db_free): Add `detaching' parameter.
	* thread-db.c (thread_db_init): Pass false as `detaching' argument
	to thread_db_free.
	(thread_db_free): Add `detaching' parameter.  Only
	call td_ta_clear_event if detaching from process.
This commit is contained in:
Pedro Alves 2009-11-16 18:15:05 +00:00
parent f7c21dc7b8
commit fd7dd3e67a
4 changed files with 31 additions and 19 deletions

View File

@ -1,3 +1,15 @@
2009-11-16 Pedro Alves <pedro@codesourcery.com>
* linux-low.c (linux_remove_process): Add `detaching' parameter.
Pass it to thread_db_free.
(linux_kill, linux_detach, linux_wait_1): Adjust to pass the
proper `detaching' argument to linux_remove_process.
* linux-low.h (thread_db_free): Add `detaching' parameter.
* thread-db.c (thread_db_init): Pass false as `detaching' argument
to thread_db_free.
(thread_db_free): Add `detaching' parameter. Only
call td_ta_clear_event if detaching from process.
2009-11-12 Maxim Kuvyrkov <maxim@codesourcery.com>
* thread-db.c (thread_db_free): Fix typo.

View File

@ -259,12 +259,12 @@ linux_add_process (int pid, int attached)
also freeing all private data. */
static void
linux_remove_process (struct process_info *process)
linux_remove_process (struct process_info *process, int detaching)
{
struct process_info_private *priv = process->private;
#ifdef USE_THREAD_DB
thread_db_free (process);
thread_db_free (process, detaching);
#endif
free (priv->arch_private);
@ -663,7 +663,7 @@ linux_kill (int pid)
} while (lwpid > 0 && WIFSTOPPED (wstat));
delete_lwp (lwp);
linux_remove_process (process);
linux_remove_process (process, 0);
return 0;
}
@ -752,7 +752,7 @@ linux_detach (int pid)
delete_all_breakpoints ();
find_inferior (&all_threads, linux_detach_one_lwp, &pid);
linux_remove_process (process);
linux_remove_process (process, 1);
return 0;
}
@ -1378,7 +1378,7 @@ retry:
struct process_info *process = find_process_pid (pid);
delete_lwp (lwp);
linux_remove_process (process);
linux_remove_process (process, 0);
current_inferior = NULL;

View File

@ -201,7 +201,7 @@ struct lwp_info *find_lwp_pid (ptid_t ptid);
/* From thread-db.c */
int thread_db_init (int use_events);
void thread_db_free (struct process_info *);
void thread_db_free (struct process_info *, int detaching);
int thread_db_handle_monitor_command (char *);
int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
CORE_ADDR load_module, CORE_ADDR *address);

View File

@ -737,7 +737,7 @@ thread_db_init (int use_events)
if (use_events && thread_db_enable_reporting () == 0)
{
/* Keep trying; maybe event reporting will work later. */
thread_db_free (proc);
thread_db_free (proc, 0);
return 0;
}
thread_db_find_new_threads ();
@ -752,38 +752,38 @@ thread_db_init (int use_events)
/* Disconnect from libthread_db and free resources. */
void
thread_db_free (struct process_info *proc)
thread_db_free (struct process_info *proc, int detaching)
{
struct thread_db *thread_db = proc->private->thread_db;
if (thread_db)
{
#ifndef USE_LIBTHREAD_DB_DIRECTLY
td_err_e (*td_ta_delete_p) (td_thragent_t *);
td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
td_thr_events_t *event);
#ifndef USE_LIBTHREAD_DB_DIRECTLY
td_ta_clear_event_p = dlsym (thread_db->handle, "td_ta_clear_event");
if (td_ta_clear_event_p != NULL)
td_ta_delete_p = dlsym (thread_db->handle, "td_ta_delete");
#else
td_ta_delete_p = &td_ta_delete;
td_ta_clear_event_p = &td_ta_clear_event;
#endif
if (detaching && td_ta_clear_event_p != NULL)
{
td_thr_events_t events;
/* Set the process wide mask saying we aren't interested in any
events anymore. */
/* Set the process wide mask saying we aren't interested
in any events anymore. */
td_event_fillset (&events);
(*td_ta_clear_event_p) (thread_db->thread_agent, &events);
}
td_ta_delete_p = dlsym (thread_db->handle, "td_ta_delete");
if (td_ta_delete_p != NULL)
(*td_ta_delete_p) (thread_db->thread_agent);
#ifndef USE_LIBTHREAD_DB_DIRECTLY
dlclose (thread_db->handle);
#else
td_thr_events_t events;
td_event_fillset (&events);
td_ta_clear_event (thread_db->thread_agent, &events);
td_ta_delete (thread_db->thread_agent);
#endif /* USE_LIBTHREAD_DB_DIRECTLY */
free (thread_db);