X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgdbserver%2Flinux-mips-low.c;h=d423633747acb7923a274f2dcf2819335d493c37;hb=e2882c85786571175a0b0bfc3bcd2f14620b1ea3;hp=9da4610edf44c52938d06e9bfb83bea2003140a2;hpb=fa5308bdcc4967861d1277b45205c2623b154a64;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c index 9da4610edf..d423633747 100644 --- a/gdb/gdbserver/linux-mips-low.c +++ b/gdb/gdbserver/linux-mips-low.c @@ -1,5 +1,5 @@ /* GNU/Linux/MIPS specific low level interface, for the remote server for GDB. - Copyright (C) 1995-2015 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. This file is part of GDB. @@ -289,31 +289,21 @@ mips_breakpoint_at (CORE_ADDR where) return 0; } -/* Mark the watch registers of lwp, represented by ENTRY, as changed, - if the lwp's process id is *PID_P. */ +/* Mark the watch registers of lwp, represented by ENTRY, as changed. */ -static int -update_watch_registers_callback (struct inferior_list_entry *entry, - void *pid_p) +static void +update_watch_registers_callback (thread_info *thread) { - struct thread_info *thread = (struct thread_info *) entry; struct lwp_info *lwp = get_thread_lwp (thread); - int pid = *(int *) pid_p; - /* Only update the threads of this process. */ - if (pid_of (thread) == pid) - { - /* The actual update is done later just before resuming the lwp, - we just mark that the registers need updating. */ - lwp->arch_private->watch_registers_changed = 1; - - /* If the lwp isn't stopped, force it to momentarily pause, so - we can update its watch registers. */ - if (!lwp->stopped) - linux_stop_lwp (lwp); - } + /* The actual update is done later just before resuming the lwp, + we just mark that the registers need updating. */ + lwp->arch_private->watch_registers_changed = 1; - return 0; + /* If the lwp isn't stopped, force it to momentarily pause, so + we can update its watch registers. */ + if (!lwp->stopped) + linux_stop_lwp (lwp); } /* This is the implementation of linux_target_ops method @@ -327,6 +317,15 @@ mips_linux_new_process (void) return info; } +/* This is the implementation of linux_target_ops method + delete_process. */ + +static void +mips_linux_delete_process (struct arch_process_info *info) +{ + xfree (info); +} + /* This is the implementation of linux_target_ops method new_thread. Mark the watch registers as changed, so the threads' copies will be updated. */ @@ -341,6 +340,14 @@ mips_linux_new_thread (struct lwp_info *lwp) lwp->arch_private = info; } +/* Function to call when a thread is being deleted. */ + +static void +mips_linux_delete_thread (struct arch_lwp_info *arch_lwp) +{ + xfree (arch_lwp); +} + /* Create a new mips_watchpoint and add it to the list. */ static void @@ -456,7 +463,6 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, struct process_info *proc = current_process (); struct arch_process_info *priv = proc->priv->arch_private; struct pt_watch_regs regs; - int pid; long lwpid; enum target_hw_bp_type watch_type; uint32_t irw; @@ -487,8 +493,7 @@ mips_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, priv->watch_mirror = regs; /* Only update the threads of this process. */ - pid = pid_of (proc); - find_inferior (&all_threads, update_watch_registers_callback, &pid); + for_each_thread (proc->pid, update_watch_registers_callback); return 0; } @@ -504,7 +509,6 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, struct arch_process_info *priv = proc->priv->arch_private; int deleted_one; - int pid; enum target_hw_bp_type watch_type; struct mips_watchpoint **pw; @@ -538,8 +542,8 @@ mips_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, &priv->watch_mirror); /* Only update the threads of this process. */ - pid = pid_of (proc); - find_inferior (&all_threads, update_watch_registers_callback, &pid); + for_each_thread (proc->pid, update_watch_registers_callback); + return 0; } @@ -637,7 +641,7 @@ mips_stopped_data_address (void) /* Fetch the thread-local storage pointer for libthread_db. */ ps_err_e -ps_get_thread_area (const struct ps_prochandle *ph, +ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base) { if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0) @@ -892,7 +896,9 @@ struct linux_target_ops the_low_target = { NULL, NULL, /* siginfo_fixup */ mips_linux_new_process, + mips_linux_delete_process, mips_linux_new_thread, + mips_linux_delete_thread, mips_linux_new_fork, mips_linux_prepare_to_resume };