From b757528ff667b76d6ba7ec2b12138abc2cd3164b Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 4 Jun 2003 20:51:29 +0000 Subject: [PATCH] 2003-06-04 Jeff Johnston * acconfig.h: Add HAVE_TKILL_SYSCALL definition check. * config.in: Regenerated. * configure.in: Add test for syscall function and check for __NR_tkill macro in to set HAVE_TKILL_SYSCALL. * configure: Regenerated. * lin-lwp.c [HAVE_TKILL_SYSCALL]: Include and . (kill_lwp): New function that uses tkill syscall or uses kill, depending on whether threading model is nptl or not. All callers of kill() changed to use kill_lwp(). (lin_lwp_wait): Make special check when WIFEXITED occurs to see if all threads have already exited in the nptl model. (stop_and_resume_callback): New callback function used by the lin_lwp_wait thread exit handling code. (stop_wait_callback): Check for threads already having exited and delete such threads fromt the lwp list when discovered. (stop_callback): Don't assert retcode of kill call. Roland McGrath * i386-linux-nat.c (ps_get_thread_area): New function needed by nptl libthread_db. --- gdb/ChangeLog | 24 +++ gdb/acconfig.h | 3 + gdb/config.in | 6 + gdb/configure | 478 ++++++++++++++++++++++++++++++--------------------- gdb/configure.in | 19 ++ gdb/i386-linux-nat.c | 18 ++ gdb/lin-lwp.c | 176 +++++++++++++++++-- 7 files changed, 519 insertions(+), 205 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d7f7a95..bbb66b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,27 @@ +2003-06-04 Jeff Johnston + + * acconfig.h: Add HAVE_TKILL_SYSCALL definition check. + * config.in: Regenerated. + * configure.in: Add test for syscall function and check for + __NR_tkill macro in to set HAVE_TKILL_SYSCALL. + * configure: Regenerated. + * lin-lwp.c [HAVE_TKILL_SYSCALL]: Include and + . + (kill_lwp): New function that uses tkill syscall or + uses kill, depending on whether threading model is nptl or not. + All callers of kill() changed to use kill_lwp(). + (lin_lwp_wait): Make special check when WIFEXITED occurs to + see if all threads have already exited in the nptl model. + (stop_and_resume_callback): New callback function used by the + lin_lwp_wait thread exit handling code. + (stop_wait_callback): Check for threads already having exited and + delete such threads fromt the lwp list when discovered. + (stop_callback): Don't assert retcode of kill call. + + Roland McGrath + * i386-linux-nat.c (ps_get_thread_area): New function needed by + nptl libthread_db. + 2003-06-03 Richard Henderson * alpha-tdep.c (alpha_next_pc): Use alpha_read_insn. diff --git a/gdb/acconfig.h b/gdb/acconfig.h index a9bf0a4..a7d25e8 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -95,6 +95,9 @@ /* Define if using Solaris thread debugging. */ #undef HAVE_THREAD_DB_LIB +/* Define if you support the tkill syscall. */ +#undef HAVE_TKILL_SYSCALL + /* Define on a GNU/Linux system to work around problems in sys/procfs.h. */ #undef START_INFERIOR_TRAPS_EXPECTED #undef sys_quotactl diff --git a/gdb/config.in b/gdb/config.in index 4500519..9fddbef 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -257,6 +257,9 @@ /* Define if you have the strchr function. */ #undef HAVE_STRCHR +/* Define if you have the syscall function. */ +#undef HAVE_SYSCALL + /* Define if you have the header file. */ #undef HAVE_ARGZ_H @@ -513,6 +516,9 @@ /* Define if has the TD_NOTALLOC error code. */ #undef THREAD_DB_HAS_TD_NOTALLOC +/* Define if we can use the tkill syscall. */ +#undef HAVE_TKILL_SYSCALL + /* Define to the default OS ABI for this configuration. */ #undef GDB_OSABI_DEFAULT diff --git a/gdb/configure b/gdb/configure index 207381a..11699a2 100755 --- a/gdb/configure +++ b/gdb/configure @@ -6602,10 +6602,65 @@ else fi done +for ac_func in syscall +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6609: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + if test "$cross_compiling" = no; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6609: checking whether setpgrp takes no argument" >&5 +echo "configure:6664: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6613,7 +6668,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -6658,12 +6713,12 @@ fi else echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:6662: checking whether setpgrp takes no argument" >&5 +echo "configure:6717: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6677,7 +6732,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_func_setpgrp_void=no else @@ -6701,12 +6756,12 @@ fi # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do # since sigsetjmp might only be defined as a macro. echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6 -echo "configure:6705: checking for sigsetjmp" >&5 +echo "configure:6760: checking for sigsetjmp" >&5 if eval "test \"`echo '$''{'gdb_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -6715,7 +6770,7 @@ int main() { sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); ; return 0; } EOF -if { (eval echo configure:6719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_func_sigsetjmp=yes else @@ -6741,12 +6796,12 @@ gdb_use_included_regex=yes # However, if the system regex is GNU regex, then default to *not* # using the included regex. echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6745: checking for GNU regex" >&5 +echo "configure:6800: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -6756,7 +6811,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:6760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6791,19 +6846,19 @@ fi # See if supports the %fs and %gs i386 segment registers. # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. echo $ac_n "checking for r_fs in struct reg""... $ac_c" 1>&6 -echo "configure:6795: checking for r_fs in struct reg" >&5 +echo "configure:6850: checking for r_fs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_fs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct reg r; r.r_fs; ; return 0; } EOF -if { (eval echo configure:6807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_fs=yes else @@ -6823,19 +6878,19 @@ EOF fi echo $ac_n "checking for r_gs in struct reg""... $ac_c" 1>&6 -echo "configure:6827: checking for r_gs in struct reg" >&5 +echo "configure:6882: checking for r_gs in struct reg" >&5 if eval "test \"`echo '$''{'gdb_cv_struct_reg_r_gs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct reg r; r.r_gs; ; return 0; } EOF -if { (eval echo configure:6839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6894: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_struct_reg_r_gs=yes else @@ -6857,19 +6912,19 @@ fi # See if provides the PTRACE_GETREGS request. echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 -echo "configure:6861: checking for PTRACE_GETREGS" >&5 +echo "configure:6916: checking for PTRACE_GETREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { PTRACE_GETREGS; ; return 0; } EOF -if { (eval echo configure:6873: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getregs=yes else @@ -6891,19 +6946,19 @@ fi # See if provides the PTRACE_GETFPXREGS request. echo $ac_n "checking for PTRACE_GETFPXREGS""... $ac_c" 1>&6 -echo "configure:6895: checking for PTRACE_GETFPXREGS" >&5 +echo "configure:6950: checking for PTRACE_GETFPXREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getfpxregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { PTRACE_GETFPXREGS; ; return 0; } EOF -if { (eval echo configure:6907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getfpxregs=yes else @@ -6925,12 +6980,12 @@ fi # See if provides the PT_GETDBREGS request. echo $ac_n "checking for PT_GETDBREGS""... $ac_c" 1>&6 -echo "configure:6929: checking for PT_GETDBREGS" >&5 +echo "configure:6984: checking for PT_GETDBREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getdbregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6938,7 +6993,7 @@ int main() { PT_GETDBREGS; ; return 0; } EOF -if { (eval echo configure:6942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getdbregs=yes else @@ -6960,12 +7015,12 @@ fi # See if provides the PT_GETXMMREGS request. echo $ac_n "checking for PT_GETXMMREGS""... $ac_c" 1>&6 -echo "configure:6964: checking for PT_GETXMMREGS" >&5 +echo "configure:7019: checking for PT_GETXMMREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_pt_getxmmregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6973,7 +7028,7 @@ int main() { PT_GETXMMREGS; ; return 0; } EOF -if { (eval echo configure:6977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_pt_getxmmregs=yes else @@ -6996,19 +7051,19 @@ fi # See if stdint.h provides the uintptr_t type. # Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this. echo $ac_n "checking for uintptr_t in stdint.h""... $ac_c" 1>&6 -echo "configure:7000: checking for uintptr_t in stdint.h" >&5 +echo "configure:7055: checking for uintptr_t in stdint.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_uintptr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { uintptr_t foo = 0; ; return 0; } EOF -if { (eval echo configure:7012: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_uintptr_t=yes else @@ -7030,12 +7085,12 @@ EOF fi echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:7034: checking whether malloc must be declared" >&5 +echo "configure:7089: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7056,7 +7111,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:7060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7115: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -7077,12 +7132,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:7081: checking whether realloc must be declared" >&5 +echo "configure:7136: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7103,7 +7158,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:7107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -7124,12 +7179,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:7128: checking whether free must be declared" >&5 +echo "configure:7183: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7150,7 +7205,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:7154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -7171,12 +7226,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:7175: checking whether strerror must be declared" >&5 +echo "configure:7230: checking whether strerror must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7197,7 +7252,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:7201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7256: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -7218,12 +7273,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:7222: checking whether strdup must be declared" >&5 +echo "configure:7277: checking whether strdup must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7244,7 +7299,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:7248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7303: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -7265,12 +7320,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:7269: checking whether strstr must be declared" >&5 +echo "configure:7324: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7291,7 +7346,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:7295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -7312,12 +7367,12 @@ EOF fi echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:7316: checking whether canonicalize_file_name must be declared" >&5 +echo "configure:7371: checking whether canonicalize_file_name must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -7338,7 +7393,7 @@ int main() { char *(*pfn) = (char *(*)) canonicalize_file_name ; return 0; } EOF -if { (eval echo configure:7342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_canonicalize_file_name=no else @@ -7364,9 +7419,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:7368: checking for HPUX save_state structure" >&5 +echo "configure:7423: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext < EOF @@ -7381,7 +7436,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -7451,12 +7506,12 @@ fi if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7455: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:7510: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7524: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -7487,12 +7542,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7491: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:7546: checking for prrun_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -7523,12 +7578,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6 echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7527: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:7582: checking for gregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -7559,12 +7614,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6 echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7563: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:7618: checking for fpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -7595,12 +7650,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_fpregset_t" 1>&6 echo $ac_n "checking for prgregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7599: checking for prgregset_t in sys/procfs.h" >&5 +echo "configure:7654: checking for prgregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7668: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset_t=yes else @@ -7631,12 +7686,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset_t" 1>&6 echo $ac_n "checking for prfpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7635: checking for prfpregset_t in sys/procfs.h" >&5 +echo "configure:7690: checking for prfpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset_t=yes else @@ -7667,12 +7722,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset_t" 1>&6 echo $ac_n "checking for prgregset32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7671: checking for prgregset32_t in sys/procfs.h" >&5 +echo "configure:7726: checking for prgregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prgregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prgregset32_t=yes else @@ -7703,12 +7758,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prgregset32_t" 1>&6 echo $ac_n "checking for prfpregset32_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7707: checking for prfpregset32_t in sys/procfs.h" >&5 +echo "configure:7762: checking for prfpregset32_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prfpregset32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prfpregset32_t=yes else @@ -7739,12 +7794,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prfpregset32_t" 1>&6 echo $ac_n "checking for lwpid_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7743: checking for lwpid_t in sys/procfs.h" >&5 +echo "configure:7798: checking for lwpid_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_lwpid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7812: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_lwpid_t=yes else @@ -7775,12 +7830,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_lwpid_t" 1>&6 echo $ac_n "checking for psaddr_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7779: checking for psaddr_t in sys/procfs.h" >&5 +echo "configure:7834: checking for psaddr_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_psaddr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_psaddr_t=yes else @@ -7811,12 +7866,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_psaddr_t" 1>&6 echo $ac_n "checking for prsysent_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7815: checking for prsysent_t in sys/procfs.h" >&5 +echo "configure:7870: checking for prsysent_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prsysent_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prsysent_t=yes else @@ -7847,12 +7902,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prsysent_t" 1>&6 echo $ac_n "checking for pr_sigset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7851: checking for pr_sigset_t in sys/procfs.h" >&5 +echo "configure:7906: checking for pr_sigset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigset_t=yes else @@ -7883,12 +7938,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigset_t" 1>&6 echo $ac_n "checking for pr_sigaction64_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7887: checking for pr_sigaction64_t in sys/procfs.h" >&5 +echo "configure:7942: checking for pr_sigaction64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_sigaction64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_sigaction64_t=yes else @@ -7919,12 +7974,12 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pr_sigaction64_t" 1>&6 echo $ac_n "checking for pr_siginfo64_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:7923: checking for pr_siginfo64_t in sys/procfs.h" >&5 +echo "configure:7978: checking for pr_siginfo64_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pr_siginfo64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pr_siginfo64_t=yes else @@ -7960,7 +8015,7 @@ EOF if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then echo $ac_n "checking whether prfpregset_t type is broken""... $ac_c" 1>&6 -echo "configure:7964: checking whether prfpregset_t type is broken" >&5 +echo "configure:8019: checking whether prfpregset_t type is broken" >&5 if eval "test \"`echo '$''{'gdb_cv_prfpregset_t_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7968,7 +8023,7 @@ else gdb_cv_prfpregset_t_broken=yes else cat > conftest.$ac_ext < int main () @@ -7978,7 +8033,7 @@ else return 0; } EOF -if { (eval echo configure:7982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_prfpregset_t_broken=no else @@ -8003,12 +8058,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:8007: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:8062: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -8021,7 +8076,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8080: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -8045,19 +8100,19 @@ fi if test ${host} = ${target} ; then echo $ac_n "checking for member l_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:8049: checking for member l_addr in struct link_map" >&5 +echo "configure:8104: checking for member l_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_l_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct link_map lm; (void) lm.l_addr; ; return 0; } EOF -if { (eval echo configure:8061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8116: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_l_members=yes else @@ -8079,12 +8134,12 @@ EOF echo $ac_n "checking for member lm_addr in struct link_map""... $ac_c" 1>&6 -echo "configure:8083: checking for member lm_addr in struct link_map" >&5 +echo "configure:8138: checking for member lm_addr in struct link_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map_with_lm_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -8092,7 +8147,7 @@ int main() { struct link_map lm; (void) lm.lm_addr; ; return 0; } EOF -if { (eval echo configure:8096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map_with_lm_members=yes else @@ -8114,12 +8169,12 @@ EOF echo $ac_n "checking for member som_addr in struct so_map""... $ac_c" 1>&6 -echo "configure:8118: checking for member som_addr in struct so_map" >&5 +echo "configure:8173: checking for member som_addr in struct so_map" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_so_map_with_som_members'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifdef HAVE_NLIST_H @@ -8130,7 +8185,7 @@ int main() { struct so_map lm; (void) lm.som_addr; ; return 0; } EOF -if { (eval echo configure:8134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_so_map_with_som_members=yes else @@ -8152,12 +8207,12 @@ EOF echo $ac_n "checking for struct link_map32 in sys/link.h""... $ac_c" 1>&6 -echo "configure:8156: checking for struct link_map32 in sys/link.h" >&5 +echo "configure:8211: checking for struct link_map32 in sys/link.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_struct_link_map32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -8165,7 +8220,7 @@ int main() { struct link_map32 l; ; return 0; } EOF -if { (eval echo configure:8169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_struct_link_map32=yes else @@ -8192,12 +8247,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:8196: checking for long long support in compiler" >&5 +echo "configure:8251: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8266: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -8229,7 +8284,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:8233: checking for long long support in printf" >&5 +echo "configure:8288: checking for long long support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8237,7 +8292,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_long=yes else @@ -8275,19 +8330,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6 -echo "configure:8279: checking for long double support in compiler" >&5 +echo "configure:8334: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8346: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -8309,7 +8364,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:8313: checking for long double support in printf" >&5 +echo "configure:8368: checking for long double support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8317,7 +8372,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_double=yes else @@ -8351,7 +8406,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6 -echo "configure:8355: checking for long double support in scanf" >&5 +echo "configure:8410: checking for long double support in scanf" >&5 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8359,7 +8414,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext < 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:8373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_scanf_has_long_double=yes else @@ -8394,7 +8449,7 @@ echo "$ac_t""$gdb_cv_scanf_has_long_double" 1>&6 case ${host_os} in aix*) echo $ac_n "checking for -bbigtoc option""... $ac_c" 1>&6 -echo "configure:8398: checking for -bbigtoc option" >&5 +echo "configure:8453: checking for -bbigtoc option" >&5 if eval "test \"`echo '$''{'gdb_cv_bigtoc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8408,14 +8463,14 @@ else LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -8438,7 +8493,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then case ${host_os} in hpux*) echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6 -echo "configure:8442: checking for HPUX/OSF thread support" >&5 +echo "configure:8497: checking for HPUX/OSF thread support" >&5 if test -f /usr/include/dce/cma_config.h ; then if test "$GCC" = "yes" ; then echo "$ac_t""yes" 1>&6 @@ -8461,7 +8516,7 @@ EOF # because version 0 (present on Solaris 2.4 or earlier) doesn't have # the same API. echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:8465: checking for Solaris thread debugging library" >&5 +echo "configure:8520: checking for Solaris thread debugging library" >&5 if test -f /usr/lib/libthread_db.so.1 ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -8471,7 +8526,7 @@ EOF CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:8475: checking for dlopen in -ldl" >&5 +echo "configure:8530: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8479,7 +8534,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8522,17 +8577,17 @@ fi # all symbols visible in the dynamic symbol table. hold_ldflags=$LDFLAGS echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6 -echo "configure:8526: checking for the ld -export-dynamic flag" >&5 +echo "configure:8581: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -8551,13 +8606,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in # at one point. echo $ac_n "checking if is old""... $ac_c" 1>&6 -echo "configure:8555: checking if is old" >&5 +echo "configure:8610: checking if is old" >&5 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -8568,7 +8623,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:8572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -8594,12 +8649,12 @@ EOF ;; aix*) echo $ac_n "checking for AiX thread debugging library""... $ac_c" 1>&6 -echo "configure:8598: checking for AiX thread debugging library" >&5 +echo "configure:8653: checking for AiX thread debugging library" >&5 if eval "test \"`echo '$''{'gdb_cv_have_aix_thread_debug'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -8608,7 +8663,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:8612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_aix_thread_debug=yes else @@ -8633,19 +8688,19 @@ fi if test "x$ac_cv_header_thread_db_h" = "xyes"; then echo $ac_n "checking whether has TD_NOTALLOC""... $ac_c" 1>&6 -echo "configure:8637: checking whether has TD_NOTALLOC" >&5 +echo "configure:8692: checking whether has TD_NOTALLOC" >&5 if eval "test \"`echo '$''{'gdb_cv_thread_db_h_has_td_notalloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int i = TD_NOTALLOC; ; return 0; } EOF -if { (eval echo configure:8649: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_thread_db_h_has_td_notalloc=yes else @@ -8668,6 +8723,43 @@ EOF fi +if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then + echo $ac_n "checking whether has __NR_tkill""... $ac_c" 1>&6 +echo "configure:8729: checking whether has __NR_tkill" >&5 +if eval "test \"`echo '$''{'gdb_cv_sys_syscall_h_has_tkill'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +int i = __NR_tkill; +; return 0; } +EOF +if { (eval echo configure:8741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + gdb_cv_sys_syscall_h_has_tkill=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gdb_cv_sys_syscall_h_has_tkill=no + +fi +rm -f conftest* + +fi + +echo "$ac_t""$gdb_cv_sys_syscall_h_has_tkill" 1>&6 +fi +if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then + cat >> confdefs.h <<\EOF +#define HAVE_TKILL_SYSCALL 1 +EOF + +fi + # Check whether --with-sysroot or --without-sysroot was given. if test "${with_sysroot+set}" = set; then @@ -8756,7 +8848,7 @@ WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6 -echo "configure:8760: checking compiler warning flags" >&5 +echo "configure:8852: checking compiler warning flags" >&5 # Separate out the -Werror flag as some files just cannot be # compiled with it enabled. for w in ${build_warnings}; do @@ -8766,14 +8858,14 @@ echo "configure:8760: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -8821,12 +8913,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:8825: checking for cygwin" >&5 +echo "configure:8917: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:8908: checking for Tcl configuration" >&5 +echo "configure:9000: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9013,7 +9105,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:9017: checking for Tk configuration" >&5 +echo "configure:9109: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9122,7 +9214,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:9126: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:9218: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -9188,17 +9280,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:9192: checking for tclInt.h" >&5 +echo "configure:9284: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9294: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9258,7 +9350,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:9262: checking for Tk private headers" >&5 +echo "configure:9354: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -9324,17 +9416,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:9328: checking for tk.h" >&5 +echo "configure:9420: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9338: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9380,7 +9472,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9384: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:9476: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itcl; do if test -f $i/generic/itcl.h ; then @@ -9403,7 +9495,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:9407: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:9499: checking for Itk private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itkh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do if test -f $i/generic/itk.h ; then @@ -9458,7 +9550,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:9462: checking for Itcl configuration" >&5 +echo "configure:9554: checking for Itcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9561,7 +9653,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:9565: checking for Itk configuration" >&5 +echo "configure:9657: checking for Itk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9704,7 +9796,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:9708: checking for X" >&5 +echo "configure:9800: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -9766,12 +9858,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9840,14 +9932,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -10095,7 +10187,7 @@ fi # We only build gdbserver automatically if host and target are the same. if test "x$target" = "x$host"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:10099: checking whether gdbserver is supported on this host" >&5 +echo "configure:10191: checking whether gdbserver is supported on this host" >&5 if test "x$build_gdbserver" = xyes; then configdirs="$configdirs gdbserver" echo "$ac_t""yes" 1>&6 @@ -10159,12 +10251,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:10163: checking for Cygwin environment" >&5 +echo "configure:10255: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -10192,19 +10284,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:10196: checking for mingw32 environment" >&5 +echo "configure:10288: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -10223,7 +10315,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:10227: checking for executable suffix" >&5 +echo "configure:10319: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10233,7 +10325,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:10237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:10329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -10275,7 +10367,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:10279: checking for iconv" >&5 +echo "configure:10371: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10283,7 +10375,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext < #include @@ -10293,7 +10385,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -10305,7 +10397,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext < #include @@ -10315,7 +10407,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -10336,13 +10428,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:10340: checking for iconv declaration" >&5 +echo "configure:10432: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -10361,7 +10453,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else diff --git a/gdb/configure.in b/gdb/configure.in index 07aab35..2cf9f6c 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -384,6 +384,7 @@ AC_CHECK_FUNCS(sbrk) AC_CHECK_FUNCS(setpgid setpgrp) AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask) AC_CHECK_FUNCS(socketpair) +AC_CHECK_FUNCS(syscall) dnl AC_FUNC_SETPGRP does not work when cross compiling dnl Instead, assume we will have a prototype for setpgrp if cross compiling. @@ -911,6 +912,24 @@ if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then [Define if has the TD_NOTALLOC error code.]) fi +dnl See if we have a sys/syscall header file that has __NR_tkill. +if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then + AC_CACHE_CHECK([whether has __NR_tkill], + gdb_cv_sys_syscall_h_has_tkill, + AC_TRY_COMPILE( + [#include ], + [int i = __NR_tkill;], + gdb_cv_sys_syscall_h_has_tkill=yes, + gdb_cv_sys_syscall_h_has_tkill=no + ) + ) +fi +dnl See if we can issue tkill syscall. +if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then + AC_DEFINE(HAVE_TKILL_SYSCALL, 1, + [Define if we can use the tkill syscall.]) +fi + dnl Handle optional features that can be enabled. AC_ARG_WITH(sysroot, diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 1928a55..81be404 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -70,6 +70,9 @@ /* Defines I386_LINUX_ORIG_EAX_REGNUM. */ #include "i386-linux-tdep.h" +/* Defines ps_err_e, struct ps_prochandle. */ +#include "gdb_proc_service.h" + /* Prototypes for local functions. */ static void dummy_sse_values (void); @@ -683,6 +686,21 @@ i386_linux_dr_set (int regnum, unsigned long value) perror_with_name ("Couldn't write debug register"); } +extern ps_err_e +ps_get_thread_area(const struct ps_prochandle *ph, + lwpid_t lwpid, int idx, void **base) +{ + unsigned long int desc[3]; +#define PTRACE_GET_THREAD_AREA 25 + + if (ptrace (PTRACE_GET_THREAD_AREA, + lwpid, (void *) idx, (unsigned long) &desc) < 0) + return PS_ERR; + + *(int *)base = desc[1]; + return PS_OK; +} + void i386_linux_dr_set_control (unsigned long control) { diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index c36394e..48fd516 100644 --- a/gdb/lin-lwp.c +++ b/gdb/lin-lwp.c @@ -24,6 +24,10 @@ #include "gdb_string.h" #include #include +#ifdef HAVE_TKILL_SYSCALL +#include +#include +#endif #include #include "gdb_wait.h" @@ -156,6 +160,7 @@ static sigset_t blocked_mask; /* Prototypes for local functions. */ static int stop_wait_callback (struct lwp_info *lp, void *data); +static int lin_lwp_thread_alive (ptid_t ptid); /* Convert wait status STATUS to a string. Used for printing debug messages only. */ @@ -627,6 +632,32 @@ lin_lwp_resume (ptid_t ptid, int step, enum target_signal signo) } +/* Issue kill to specified lwp. */ + +static int tkill_failed; + +static int +kill_lwp (int lwpid, int signo) +{ + errno = 0; + +/* Use tkill, if possible, in case we are using nptl threads. If tkill + fails, then we are not using nptl threads and we should be using kill. */ + +#ifdef HAVE_TKILL_SYSCALL + if (!tkill_failed) + { + int ret = syscall (__NR_tkill, lwpid, signo); + if (errno != ENOSYS) + return ret; + errno = 0; + tkill_failed = 1; + } +#endif + + return kill (lwpid, signo); +} + /* Send a SIGSTOP to LP. */ static int @@ -642,8 +673,15 @@ stop_callback (struct lwp_info *lp, void *data) "SC: kill %s ****\n", target_pid_to_str (lp->ptid)); } - ret = kill (GET_LWP (lp->ptid), SIGSTOP); - gdb_assert (ret == 0); + errno = 0; + ret = kill_lwp (GET_LWP (lp->ptid), SIGSTOP); + if (debug_lin_lwp) + { + fprintf_unfiltered (gdb_stdlog, + "SC: lwp kill %d %s\n", + ret, + errno ? safe_strerror (errno) : "ERRNO-OK"); + } lp->signalled = 1; gdb_assert (lp->status == 0); @@ -667,11 +705,23 @@ stop_wait_callback (struct lwp_info *lp, void *data) gdb_assert (lp->status == 0); - pid = waitpid (GET_LWP (lp->ptid), &status, lp->cloned ? __WCLONE : 0); + pid = waitpid (GET_LWP (lp->ptid), &status, 0); if (pid == -1 && errno == ECHILD) - /* OK, the proccess has disappeared. We'll catch the actual - exit event in lin_lwp_wait. */ - return 0; + { + pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE); + if (pid == -1 && errno == ECHILD) + { + /* The thread has previously exited. We need to delete it now + because in the case of nptl threads, there won't be an + exit event unless it is the main thread. */ + if (debug_lin_lwp) + fprintf_unfiltered (gdb_stdlog, + "SWC: %s exited.\n", + target_pid_to_str (lp->ptid)); + delete_lwp (lp->ptid); + return 0; + } + } gdb_assert (pid == GET_LWP (lp->ptid)); @@ -683,6 +733,7 @@ stop_wait_callback (struct lwp_info *lp, void *data) status_to_str (status)); } + /* Check if the thread has exited. */ if (WIFEXITED (status) || WIFSIGNALED (status)) { gdb_assert (num_lwps > 1); @@ -697,7 +748,31 @@ stop_wait_callback (struct lwp_info *lp, void *data) target_pid_to_str (lp->ptid)); } if (debug_lin_lwp) - fprintf_unfiltered (gdb_stdlog, "SWC: %s exited.\n", + fprintf_unfiltered (gdb_stdlog, + "SWC: %s exited.\n", + target_pid_to_str (lp->ptid)); + + delete_lwp (lp->ptid); + return 0; + } + + /* Check if the current LWP has previously exited. For nptl threads, + there is no exit signal issued for LWPs that are not the + main thread so we should check whenever the thread is stopped. */ + if (!lin_lwp_thread_alive (lp->ptid)) + { + if (in_thread_list (lp->ptid)) + { + /* Core GDB cannot deal with us deleting the current + thread. */ + if (!ptid_equal (lp->ptid, inferior_ptid)) + delete_thread (lp->ptid); + printf_unfiltered ("[%s exited]\n", + target_pid_to_str (lp->ptid)); + } + if (debug_lin_lwp) + fprintf_unfiltered (gdb_stdlog, + "SWC: %s already exited.\n", target_pid_to_str (lp->ptid)); delete_lwp (lp->ptid); @@ -756,7 +831,14 @@ stop_wait_callback (struct lwp_info *lp, void *data) /* If there's another event, throw it back into the queue. */ if (lp->status) { - kill (GET_LWP (lp->ptid), WSTOPSIG (lp->status)); + if (debug_lin_lwp) + { + fprintf_unfiltered (gdb_stdlog, + "SWC: kill %s, %s\n", + target_pid_to_str (lp->ptid), + status_to_str ((int) status)); + } + kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status)); } /* Save the sigtrap event. */ lp->status = status; @@ -800,7 +882,7 @@ stop_wait_callback (struct lwp_info *lp, void *data) target_pid_to_str (lp->ptid), status_to_str ((int) status)); } - kill (GET_LWP (lp->ptid), WSTOPSIG (status)); + kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status)); } return 0; } @@ -1049,6 +1131,25 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) #endif +/* Stop an active thread, verify it still exists, then resume it. */ + +static int +stop_and_resume_callback (struct lwp_info *lp, void *data) +{ + struct lwp_info *ptr; + + if (!lp->stopped && !lp->signalled) + { + stop_callback (lp, NULL); + stop_wait_callback (lp, NULL); + /* Resume if the lwp still exists. */ + for (ptr = lwp_list; ptr; ptr = ptr->next) + if (lp == ptr) + resume_callback (lp, NULL); + } + return 0; +} + static ptid_t lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus) { @@ -1206,9 +1307,7 @@ retry: } } - /* Make sure we don't report a TARGET_WAITKIND_EXITED or - TARGET_WAITKIND_SIGNALLED event if there are still LWP's - left in the process. */ + /* Check if the thread has exited. */ if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1) { if (in_thread_list (lp->ptid)) @@ -1220,6 +1319,59 @@ retry: printf_unfiltered ("[%s exited]\n", target_pid_to_str (lp->ptid)); } + + /* If this is the main thread, we must stop all threads and + verify if they are still alive. This is because in the nptl + thread model, there is no signal issued for exiting LWPs + other than the main thread. We only get the main thread + exit signal once all child threads have already exited. + If we stop all the threads and use the stop_wait_callback + to check if they have exited we can determine whether this + signal should be ignored or whether it means the end of the + debugged application, regardless of which threading model + is being used. */ + if (GET_PID (lp->ptid) == GET_LWP (lp->ptid)) + { + lp->stopped = 1; + iterate_over_lwps (stop_and_resume_callback, NULL); + } + + if (debug_lin_lwp) + fprintf_unfiltered (gdb_stdlog, + "LLW: %s exited.\n", + target_pid_to_str (lp->ptid)); + + delete_lwp (lp->ptid); + + /* If there is at least one more LWP, then the exit signal + was not the end of the debugged application and should be + ignored. */ + if (num_lwps > 0) + { + /* Make sure there is at least one thread running. */ + gdb_assert (iterate_over_lwps (running_callback, NULL)); + + /* Discard the event. */ + status = 0; + continue; + } + } + + /* Check if the current LWP has previously exited. In the nptl + thread model, LWPs other than the main thread do not issue + signals when they exit so we must check whenever the thread + has stopped. A similar check is made in stop_wait_callback(). */ + if (num_lwps > 1 && !lin_lwp_thread_alive (lp->ptid)) + { + if (in_thread_list (lp->ptid)) + { + /* Core GDB cannot deal with us deleting the current + thread. */ + if (!ptid_equal (lp->ptid, inferior_ptid)) + delete_thread (lp->ptid); + printf_unfiltered ("[%s exited]\n", + target_pid_to_str (lp->ptid)); + } if (debug_lin_lwp) fprintf_unfiltered (gdb_stdlog, "LLW: %s exited.\n", -- 2.7.4