summaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-12-20 10:40:10 +0000
committerPedro Alves <pedro@codesourcery.com>2011-12-20 10:40:10 +0000
commitdc8a0875bb4a7079afa16d88d34e5b2a6bd3430c (patch)
treeef26fe32cc19058dd80976c7e1fd96df6e3be2ba /gdb/linux-nat.c
parentefb82700e6079a181006d710c56faab88d9ab7b1 (diff)
downloadgdb-dc8a0875bb4a7079afa16d88d34e5b2a6bd3430c.tar.gz
2011-12-20 Pedro Alves <alves.ped@gmail.com>
Jan Kratochvil <jan.kratochvil@redhat.com> * linux-nat.c (add_lwp): Don't call linux_nat_new_thread on the first LWP. * amd64-linux-nat.c (update_debug_registers_callback): Instantiate `lwp->arch_private' if NULL. (amd64_linux_prepare_to_resume): Do nothing if `lwp->arch_private' is NULL. * i386-linux-nat.c (update_debug_registers_callback): Instantiate `lwp->arch_private' if NULL. (i386_linux_prepare_to_resume): Do nothing if `lwp->arch_private' is NULL.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 1cbfc44456c..e5f7c3e8ee5 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1151,7 +1151,15 @@ add_lwp (ptid_t ptid)
lp->next = lwp_list;
lwp_list = lp;
- if (linux_nat_new_thread != NULL)
+ /* Let the arch specific bits know about this new thread. Current
+ clients of this callback take the opportunity to install
+ watchpoints in the new thread. Don't do this for the first
+ thread though. If we're spawning a child ("run"), the thread
+ executes the shell wrapper first, and we shouldn't touch it until
+ it execs the program we want to debug. For "attach", it'd be
+ okay to call the callback, but it's not necessary, because
+ watchpoints can't yet have been inserted into the inferior. */
+ if (num_lwps (GET_PID (ptid)) > 1 && linux_nat_new_thread != NULL)
linux_nat_new_thread (lp);
return lp;