Check the deployment target before calling backtrace.

This patch requires patch-gdb-headers.diff.

--- gdb/remote.c
+++ gdb/remote.c
@@ -64,7 +64,10 @@
 #include "macosx-nat-dyld.h"
 #include "macosx-nat-dyld-process.h"
 #endif
+#ifdef HAVE_EXECINFO_H
 #include <execinfo.h>
+#endif
+#include <AvailabilityMacros.h>
 
 /* Prototypes for local functions.  */
 static void cleanup_sigint_signal_handler (void *dummy);
@@ -478,11 +481,13 @@ struct memory_packet_config
 static void
 remote_backtrace_self (const char *message)
 {
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
   void *bt_buffer[100];
   int count = backtrace (bt_buffer, 100);
   if (message && message[0])
     fprintf_filtered (gdb_stderr, "%s", message);
   backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+#endif
 }
 
 static void
--- gdb/utils.c
+++ gdb/utils.c
@@ -28,7 +28,10 @@
 #include "event-top.h"
 #include "exceptions.h"
 #include "bfd.h"
+#ifdef HAVE_EXECINFO_H
 #include <execinfo.h>
+#endif
+#include <AvailabilityMacros.h>
 #include <sys/resource.h>
 #include <uuid/uuid.h>
 #include <regex.h>
@@ -882,12 +885,14 @@ internal_vproblem (struct internal_problem *problem,
 
   /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
      to get useful bug reports.  */
+#if (MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
   {
     void *bt_buffer[15];
     int count = backtrace (bt_buffer, 15);
     fprintf (stderr, "gdb stack crawl at point of internal error:\n");
     backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
   }
+#endif
 
   /* Create a string containing the full error/warning message.  Need
      to call query with this full string, as otherwize the reason
