mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
* linux-low.c (linux_remove_process): Remove `detaching'
parameter. Don't release/detach from thread_db here. (linux_kill): Release/detach from thread_db here, ... (linux_detach): ... and here, before actually detaching. (linux_wait_1): ... and here, when a process exits. * thread-db.c (any_thread_of): New. (thread_db_free): Switch the current inferior to a thread of the passed in process.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2009-12-28 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* linux-low.c (linux_remove_process): Remove `detaching'
|
||||||
|
parameter. Don't release/detach from thread_db here.
|
||||||
|
(linux_kill): Release/detach from thread_db here, ...
|
||||||
|
(linux_detach): ... and here, before actually detaching.
|
||||||
|
(linux_wait_1): ... and here, when a process exits.
|
||||||
|
* thread-db.c (any_thread_of): New.
|
||||||
|
(thread_db_free): Switch the current inferior to a thread of the
|
||||||
|
passed in process.
|
||||||
|
|
||||||
2009-12-21 Doug Evans <dje@google.com>
|
2009-12-21 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* linux-x86-low.c: Delete outdated comment about Elf32_Phdr.
|
* linux-x86-low.c: Delete outdated comment about Elf32_Phdr.
|
||||||
|
@ -258,14 +258,10 @@ linux_add_process (int pid, int attached)
|
|||||||
also freeing all private data. */
|
also freeing all private data. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
linux_remove_process (struct process_info *process, int detaching)
|
linux_remove_process (struct process_info *process)
|
||||||
{
|
{
|
||||||
struct process_info_private *priv = process->private;
|
struct process_info_private *priv = process->private;
|
||||||
|
|
||||||
#ifdef USE_THREAD_DB
|
|
||||||
thread_db_free (process, detaching);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
free (priv->arch_private);
|
free (priv->arch_private);
|
||||||
free (priv);
|
free (priv);
|
||||||
remove_process (process);
|
remove_process (process);
|
||||||
@ -736,8 +732,11 @@ linux_kill (int pid)
|
|||||||
lwpid = linux_wait_for_event (lwp->head.id, &wstat, __WALL);
|
lwpid = linux_wait_for_event (lwp->head.id, &wstat, __WALL);
|
||||||
} while (lwpid > 0 && WIFSTOPPED (wstat));
|
} while (lwpid > 0 && WIFSTOPPED (wstat));
|
||||||
|
|
||||||
|
#ifdef USE_THREAD_DB
|
||||||
|
thread_db_free (process, 0);
|
||||||
|
#endif
|
||||||
delete_lwp (lwp);
|
delete_lwp (lwp);
|
||||||
linux_remove_process (process, 0);
|
linux_remove_process (process);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,12 +820,16 @@ linux_detach (int pid)
|
|||||||
if (process == NULL)
|
if (process == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
#ifdef USE_THREAD_DB
|
||||||
|
thread_db_free (process, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
current_inferior =
|
current_inferior =
|
||||||
(struct thread_info *) find_inferior (&all_threads, any_thread_of, &pid);
|
(struct thread_info *) find_inferior (&all_threads, any_thread_of, &pid);
|
||||||
|
|
||||||
delete_all_breakpoints ();
|
delete_all_breakpoints ();
|
||||||
find_inferior (&all_threads, linux_detach_one_lwp, &pid);
|
find_inferior (&all_threads, linux_detach_one_lwp, &pid);
|
||||||
linux_remove_process (process, 1);
|
linux_remove_process (process);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1451,8 +1454,11 @@ retry:
|
|||||||
int pid = pid_of (lwp);
|
int pid = pid_of (lwp);
|
||||||
struct process_info *process = find_process_pid (pid);
|
struct process_info *process = find_process_pid (pid);
|
||||||
|
|
||||||
|
#ifdef USE_THREAD_DB
|
||||||
|
thread_db_free (process, 0);
|
||||||
|
#endif
|
||||||
delete_lwp (lwp);
|
delete_lwp (lwp);
|
||||||
linux_remove_process (process, 0);
|
linux_remove_process (process);
|
||||||
|
|
||||||
current_inferior = NULL;
|
current_inferior = NULL;
|
||||||
|
|
||||||
|
@ -755,6 +755,17 @@ thread_db_init (int use_events)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
any_thread_of (struct inferior_list_entry *entry, void *args)
|
||||||
|
{
|
||||||
|
int *pid_p = args;
|
||||||
|
|
||||||
|
if (ptid_get_pid (entry->id) == *pid_p)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Disconnect from libthread_db and free resources. */
|
/* Disconnect from libthread_db and free resources. */
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -763,6 +774,8 @@ thread_db_free (struct process_info *proc, int detaching)
|
|||||||
struct thread_db *thread_db = proc->private->thread_db;
|
struct thread_db *thread_db = proc->private->thread_db;
|
||||||
if (thread_db)
|
if (thread_db)
|
||||||
{
|
{
|
||||||
|
struct thread_info *saved_inferior;
|
||||||
|
int pid;
|
||||||
td_err_e (*td_ta_delete_p) (td_thragent_t *);
|
td_err_e (*td_ta_delete_p) (td_thragent_t *);
|
||||||
td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
|
td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
|
||||||
td_thr_events_t *event);
|
td_thr_events_t *event);
|
||||||
@ -775,6 +788,12 @@ thread_db_free (struct process_info *proc, int detaching)
|
|||||||
td_ta_clear_event_p = &td_ta_clear_event;
|
td_ta_clear_event_p = &td_ta_clear_event;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
pid = pid_of (proc);
|
||||||
|
saved_inferior = current_inferior;
|
||||||
|
current_inferior =
|
||||||
|
(struct thread_info *) find_inferior (&all_threads,
|
||||||
|
any_thread_of, &pid);
|
||||||
|
|
||||||
if (detaching && td_ta_clear_event_p != NULL)
|
if (detaching && td_ta_clear_event_p != NULL)
|
||||||
{
|
{
|
||||||
td_thr_events_t events;
|
td_thr_events_t events;
|
||||||
@ -794,6 +813,7 @@ thread_db_free (struct process_info *proc, int detaching)
|
|||||||
|
|
||||||
free (thread_db);
|
free (thread_db);
|
||||||
proc->private->thread_db = NULL;
|
proc->private->thread_db = NULL;
|
||||||
|
current_inferior = saved_inferior;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user