From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13595 invoked by alias); 9 Feb 2012 02:45:27 -0000 Received: (qmail 13574 invoked by uid 22791); 9 Feb 2012 02:45:25 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 02:45:11 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1RvK0U-0004Bx-77 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 08 Feb 2012 18:45:10 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 8 Feb 2012 18:45:05 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Wed, 8 Feb 2012 18:45:08 -0800 Message-ID: <4F33332D.4040207@codesourcery.com> Date: Thu, 09 Feb 2012 02:45:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111220 Thunderbird/9.0 MIME-Version: 1.0 To: Subject: [patch] Check readlink during configuring gdbserver Content-Type: multipart/mixed; boundary="------------000909000603030102080009" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00126.txt.bz2 --------------000909000603030102080009 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Content-length: 578 I tried to build gdbserver as host=i686-mingw32 on linux, but get the following error, cc1: warnings being treated as errors ../gdb/gdb/gdbserver/hostio.c: In function 'handle_readlink': ../gdb/gdb/gdbserver/hostio.c:475: error: implicit declaration of function 'readlink' Even I remove -Werror temporarily, `readlink' can't be found during linking, hostio.o: In function `handle_readlink': ../gdb/gdb/gdbserver/hostio.c:475: undefined reference to `_readlink' This patch is to add `readlink' in AC_CHECK_FUNCS, to check it during configure. OK to apply? -- Yao (齐尧) --------------000909000603030102080009 Content-Type: text/x-patch; name="0001-check-readlink.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-check-readlink.patch" Content-length: 2475 gdb/gdbserver: 2012-02-08 Yao Qi * configure.ac: Check for readlink. * configure, config.in: Regenerated. * hostio.c (handle_readlink) [!HAVE_READLINK]: Write error in packet. --- gdb/gdbserver/config.in | 3 +++ gdb/gdbserver/configure | 2 +- gdb/gdbserver/configure.ac | 2 +- gdb/gdbserver/hostio.c | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in index a9472ea..7fa3b5b 100644 --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in @@ -128,6 +128,9 @@ /* Define to 1 if you have the `pwrite' function. */ #undef HAVE_PWRITE +/* Define to 1 if you have the `readlink' function. */ +#undef HAVE_READLINK + /* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure index d92a00f..e251844 100755 --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure @@ -4163,7 +4163,7 @@ fi done -for ac_func in pread pwrite pread64 +for ac_func in pread pwrite pread64 readlink do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac index 30666ec..7c86cd4 100644 --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac @@ -43,7 +43,7 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl errno.h fcntl.h signal.h sys/file.h malloc.h dnl sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl netinet/tcp.h arpa/inet.h sys/wait.h) -AC_CHECK_FUNCS(pread pwrite pread64) +AC_CHECK_FUNCS(pread pwrite pread64 readlink) AC_REPLACE_FUNCS(memmem vasprintf vsnprintf) # Check for UST diff --git a/gdb/gdbserver/hostio.c b/gdb/gdbserver/hostio.c index 34e4fa8..b1b104b 100644 --- a/gdb/gdbserver/hostio.c +++ b/gdb/gdbserver/hostio.c @@ -459,6 +459,8 @@ handle_unlink (char *own_buf) static void handle_readlink (char *own_buf, int *new_packet_len) { +#if defined (HAVE_READLINK) char filename[PATH_MAX], linkname[PATH_MAX]; char *p; int ret, bytes_sent; @@ -485,6 +487,9 @@ handle_readlink (char *own_buf, int *new_packet_len) to return a partial response, but simply fail. */ if (bytes_sent < ret) sprintf (own_buf, "F-1,%x", FILEIO_ENAMETOOLONG); +#else + hostio_packet_error (own_buf); +#endif } /* Handle all the 'F' file transfer packets. */ -- 1.7.0.4 --------------000909000603030102080009--