From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6992 invoked by alias); 5 Dec 2012 23:45:06 -0000 Received: (qmail 6969 invoked by uid 22791); 5 Dec 2012 23:45:04 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_50,KHOP_THREADED,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.151) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Dec 2012 23:44:57 +0000 Received: from md15.u-strasbg.fr (md15.u-strasbg.fr [130.79.200.204]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id qB5NipO6044757 ; Thu, 6 Dec 2012 00:44:51 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms12.u-strasbg.fr [130.79.204.112]) by md15.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id qB5Niooh002050 ; Thu, 6 Dec 2012 00:44:51 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id qB5NinU8016514 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Thu, 6 Dec 2012 00:44:50 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Tom Tromey'" Cc: References: <29503.7594777115$1354726985@news.gmane.org> <87sj7ks7g6.fsf@fleche.redhat.com> In-Reply-To: <87sj7ks7g6.fsf@fleche.redhat.com> Subject: RE: [RFA] Avoid calling stat with empty name in relocate_gdb_directory Date: Wed, 05 Dec 2012 23:45:00 -0000 Message-ID: <003e01cdd342$84b85e70$8e291b50$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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-12/txt/msg00094.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Tom Tromey > Envoy=E9=A0: mercredi 5 d=E9cembre 2012 19:03 > =C0=A0: Pierre Muller > Cc=A0: gdb-patches@sourceware.org > Objet=A0: Re: [RFA] Avoid calling stat with empty name in > relocate_gdb_directory >=20 > >>>>> "Pierre" =3D=3D Pierre Muller writes: >=20 > Pierre> With the troubles that I have with my patch, > Pierre> I started looking into a memory debugger... > Pierre> I finally started to use drmemory > Pierre> for mingw compiled GDB executables. >=20 > Pierre> I don't know if stat is supposed to handle (*dir =3D=3D '\0'), > Pierre> but I thought that it should anyhow succeed in that case, > Pierre> so the patch below simply don't call stat if name is empty. >=20 > At least here I get an error. >=20 > Pierre> Tell me if you rather think that this is a msvcrt bug that > Pierre> should not be fixed in GDB... >=20 > I don't mind working around it, but I wonder how we end up there with an > empty 'dir' in the first place. Perhaps that is a bug instead. It comes from here: 388 current_directory =3D gdb_dirbuf; 389 390 /* Set the sysroot path. */ 391 gdb_sysroot =3D relocate_gdb_directory (TARGET_SYSTEM_ROOT, 392 TARGET_SYSTEM_ROOT_RELOCATABLE); 393 394 debug_file_directory =3D relocate_gdb_directory (DEBUGDIR, 395 DEBUGDIR_RELOCATABLE); TARGET_SYTEM_ROOT is set to "" by the configure.ac autoconf script for=20 1874-# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, 1875-# except that the argument to --with-sysroot is optional. 1876-# --with-sysroot (or --with-sysroot=3Dyes) sets the default sysroot pa= th. 1877-if test "x$with_sysroot" =3D xyes; then 1878- with_sysroot=3D"${exec_prefix}/${target_alias}/sys-root" 1879-fi 1880-AC_ARG_WITH(sysroot, 1881- AS_HELP_STRING([--with-sysroot@<:@=3DDIR@:>@], 1882- [search for usr/lib et al within DIR]), 1883: [TARGET_SYSTEM_ROOT=3D$withval], [TARGET_SYSTEM_ROOT=3D]) 1884:AC_DEFINE_DIR(TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT, 1885- [search for usr/lib et al within DIR]) 1886:AC_SUBST(TARGET_SYSTEM_ROOT) 1887:GDB_AC_DEFINE_RELOCATABLE(TARGET_SYSTEM_ROOT, sysroot, ${ac_define_dir}) 1888- Apparently it isn't used elsewhere... Should we modify the default value to NULL instead of ""? I do not master complicated autoconf things like=20 GDB_AC_DEFINE_RELOCATABLE well enough to know if this is without problems... Tell me if you think we should modify it at configury level or if I should commit my patch, whatever you prefer! Pierre