Check for spawn.h, execinfo.h, and libproc.h and block out sections of code where related system functions are not available. This enables compilation on 10.4 and 10.5. --- gdb/config.in.orig +++ gdb/config.in @@ -124,6 +124,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_EXECINFO_H + /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK @@ -169,6 +172,9 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBPROC_H + /* Define if libunwind library is being used. */ #undef HAVE_LIBUNWIND @@ -337,6 +343,9 @@ /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T +/* Define to 1 if you have the header file. */ +#undef HAVE_SPAWN_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H --- gdb/configure.ac.orig +++ gdb/configure.ac @@ -524,7 +524,7 @@ AC_CHECK_HEADERS(sys/user.h, [], [], ]) AC_CHECK_HEADERS(sys/wait.h wait.h) AC_CHECK_HEADERS(termios.h termio.h sgtty.h) -AC_CHECK_HEADERS(unistd.h) +AC_CHECK_HEADERS(unistd.h spawn.h execinfo.h libproc.h) # On Solaris 2.[789], we need to define _MSE_INT_H to avoid a clash # between and that would cause AC_CHECK_HEADERS to --- gdb/configure.orig +++ gdb/configure @@ -27720,7 +27720,7 @@ fi done -for ac_header in unistd.h +for ac_header in unistd.h spawn.h execinfo.h libproc.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then --- gdb/macosx/macosx-nat-dyld.c.orig +++ gdb/macosx/macosx-nat-dyld.c @@ -791,7 +791,7 @@ macosx_locate_dyld_via_taskinfo (macosx_dyld_thread_status *s) } else { -#if defined (NM_NEXTSTEP) +#if defined (NM_NEXTSTEP) && defined(TASK_DYLD_INFO) if (macosx_status->task == TASK_NULL) return 0; --- gdb/macosx/macosx-nat-inferior.c.orig +++ gdb/macosx/macosx-nat-inferior.c @@ -60,13 +60,17 @@ #include #include #include +#ifdef HAVE_SPAWN_H #include +#endif #include #include +#ifdef HAVE_LIBPROC_H #include #include +#endif #include "macosx-nat-dyld.h" #include "macosx-nat-inferior.h" @@ -2701,6 +2705,7 @@ macosx_get_thread_name (ptid_t ptid) if (tp->private == NULL || tp->private->app_thread_port == 0) return NULL; +#if defined(THREAD_IDENTIFIER_INFO) thread_identifier_info_data_t tident; unsigned int info_count; kern_return_t kret; @@ -2728,6 +2733,7 @@ macosx_get_thread_name (ptid_t ptid) } } } +#endif /* defined(THREAD_IDENTIFIER_INFO) */ return buf; } --- gdb/macosx/macosx-nat-infthread.c +++ gdb/macosx/macosx-nat-infthread.c @@ -36,8 +36,10 @@ #include #include +#ifdef HAVE_LIBPROC_H #include #include +#endif #include "macosx-nat-inferior.h" #include "macosx-nat-inferior-util.h" @@ -810,6 +812,7 @@ print_thread_info (thread_t tid, int *gdb_thread_id) print_stack_frame (get_selected_frame (NULL), 0, LOCATION); switch_to_thread (current_ptid); +#if defined(THREAD_IDENTIFIER_INFO) thread_identifier_info_data_t tident; info_count = THREAD_IDENTIFIER_INFO_COUNT; kret = thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t) &tident, @@ -879,6 +882,7 @@ print_thread_info (thread_t tid, int *gdb_thread_id) printf_filtered ("\tcurrent priority: %d\n", pth.pth_priority); printf_filtered ("\tmax priority: %d\n", pth.pth_maxpriority); } +#endif /* defined(THREAD_IDENTIFIER_INFO) */ printf_filtered ("\tsuspend count: %d", info.suspend_count); @@ -1176,6 +1180,7 @@ macosx_print_thread_details (struct ui_out *uiout, ptid_t ptid) ui_out_field_fmt (uiout, "mach-port-number", "0x%s", paddr_nz (app_thread_name)); +#if defined(THREAD_IDENTIFIER_INFO) thread_identifier_info_data_t tident; info_count = THREAD_IDENTIFIER_INFO_COUNT; kret = thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t) &tident, @@ -1208,6 +1213,7 @@ macosx_print_thread_details (struct ui_out *uiout, ptid_t ptid) paddr_nz (struct_addr)); } } +#endif /* defined(THREAD_IDENTIFIER_INFO) */ }