Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Tom Tromey'" <tromey@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: RE: [RFA] Avoid calling stat with empty name in relocate_gdb_directory
Date: Wed, 05 Dec 2012 23:45:00 -0000	[thread overview]
Message-ID: <003e01cdd342$84b85e70$8e291b50$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <87sj7ks7g6.fsf@fleche.redhat.com>



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : mercredi 5 décembre 2012 19:03
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA] Avoid calling stat with empty name in
> relocate_gdb_directory
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
writes:
> 
> 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.
> 
> Pierre>   I don't know if stat is supposed to handle (*dir == '\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.
> 
> At least here I get an error.
> 
> Pierre>   Tell me if you rather think that this is a msvcrt bug that
> Pierre> should not be fixed in GDB...
> 
> 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 = gdb_dirbuf;
389
390       /* Set the sysroot path.  */
391       gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
392
TARGET_SYSTEM_ROOT_RELOCATABLE);
393
394       debug_file_directory = relocate_gdb_directory (DEBUGDIR,
395
DEBUGDIR_RELOCATABLE);

  TARGET_SYTEM_ROOT is set to ""
by the configure.ac autoconf script  for 

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=yes) sets the default sysroot path.
1877-if test "x$with_sysroot" = xyes; then
1878-  with_sysroot="${exec_prefix}/${target_alias}/sys-root"
1879-fi
1880-AC_ARG_WITH(sysroot,
1881-  AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
1882-                 [search for usr/lib et al within DIR]),
1883:  [TARGET_SYSTEM_ROOT=$withval], [TARGET_SYSTEM_ROOT=])
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 
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


  reply	other threads:[~2012-12-05 23:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <29503.7594777115$1354726985@news.gmane.org>
2012-12-05 18:03 ` Tom Tromey
2012-12-05 23:45   ` Pierre Muller [this message]
     [not found]   ` <434.327257289802$1354751122@news.gmane.org>
2012-12-06 18:33     ` Tom Tromey
2012-12-14  8:17       ` Pierre Muller
     [not found]       ` <26262.2907328934$1355473042@news.gmane.org>
2013-01-03 20:59         ` Tom Tromey
2013-01-03 22:19           ` Pierre Muller
2012-12-05 17:02 Pierre Muller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003e01cdd342$84b85e70$8e291b50$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox