This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [RFA] Avoid calling stat with empty name in relocate_gdb_directory



> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé?: jeudi 6 décembre 2012 19:34
> À?: 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>   Apparently it isn't used elsewhere...
> Pierre> Should we modify the default value to NULL instead of ""?
> Pierre> I do not master complicated autoconf things like
> Pierre> GDB_AC_DEFINE_RELOCATABLE well enough to know if this is
> Pierre> without problems...
> 
> Pierre>  Tell me if you think we should modify it at configury level or
> Pierre> if I should commit my patch, whatever you prefer!
> 
> Maybe we should just skip computing gdb_sysroot if TARGET_SYSTEM_ROOT is
> "".  What do you think?

  I looked at the different calls to relocate_gdb_directory:
$ find . -iname "*.[chy]" |xargs grep -n gdb_directory
./charset.c:816:    char *iconv_dir = relocate_gdb_directory (ICONV_BIN,
./defs.h:275:extern char *relocate_gdb_directory (const char *initial, int
flag);
./jit.c:1402:  jit_reader_dir = relocate_gdb_directory (JIT_READER_DIR,
./main.c:120:relocate_gdb_directory (const char *initial, int flag)
./main.c:391:  gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
./main.c:394:  debug_file_directory = relocate_gdb_directory (DEBUGDIR,
./main.c:397:  gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
./main.c:405:    python_libdir = relocate_gdb_directory (tmp,
PYTHON_PATH_RELOCATABLE);


  Are we sure all other calls have non-empty first argument?
  Another problem is that currently the returned string is
always allocated, which means that we should at least
also use xstrdup ("") ...

  I still think that the approach of testing if *dir == '\0'
is safer...

  Pierre



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]