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: Possible fix for mingw32 directory relocation problems


On Tue, Jan 17, 2012 at 6:49 AM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
>
>
>> -----Message d'origine-----
>> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de Doug Evans
>> Envoyé?: mardi 17 janvier 2012 08:00
>> À?: Pierre Muller
>> Cc?: gdb-patches@sourceware.org; Eli Zaretskii; asmwarrior@gmail.com; Tom
>> Tromey
>> Objet?: Re: Possible fix for mingw32 directory relocation problems
>>
>> On Mon, Jan 16, 2012 at 7:03 AM, Pierre Muller
>> <pierre.muller@ics-cnrs.unistra.fr> wrote:
>> > ?After some debugging,
>> > we finally managed to find out that
>> > mingw32 specific directory relocations are related
>> > to msys -> mingw32 argument conversions.
>>
>> Thanks for the detective work!
>
> ?I always liked to debug GDB with itself!
>
>> > http://sourceware.org/ml/gdb-patches/2012-01/msg00537.html
>> >
>> > This is explained in:
>> >
>> > http://www.mingw.org/wiki/Posix_path_conversion
>> >
>> > This page also allows to understand why
>> > using mingw32 style paths for prefix at configure
>> > level works and avoid the troubles encountered.
>> >
>> > This conversion concerns defines passed by command line arguments
>> > to gcc, which are specific to main.o
>> > compilation, as found in gdb/Makefile.in
>> > 1520-
>> > 1521:# main.o needs an explicit build rule to get TARGET_SYSTEM_ROOT and
>> > BINDIR.
>> > 1522-main.o: $(srcdir)/main.c
>> > 1523: ? $(COMPILE) $(TARGET_SYSTEM_ROOT_DEFINE) -DBINDIR=\"$(bindir)\"
>> > $(srcdir)/main.c
>> > 1524- ? $(POSTCOMPILE)
>> > 1525-
>> >
>> > ?But this leads to a conversion:
>> > ?-DBINDIR="/usr/local/bin\"
>> > gets transformed into '-D' 'BINDIR="E:/msys/mingw32/msys/1.0/local/bin"'
>> >
>> > ?While other pates used in relocate_gdb_directory calls
>> > are macros defined inside gdb/config.h
>> >
>> > config.h:#define DEBUGDIR "/usr/local/lib/debug"
>> > config.h:#define GDB_DATADIR "/usr/local/share/gdb"
>> > config.h:#define JIT_READER_DIR "/usr/local/lib/gdb"
>> >
>> > Those are of course not affected by msys command-line argument
> conversion.
>> >
>> > ?The first question is:
>> > Why do we need to pass BINDIR (and TARGET_SYSTEM_ROOT_DEFINE)
>> > at the command line instead of inside config.h as for other
>> > directories?
>>
>> We don't need to pass them on the command line.
>>
>> > ?If the answer to the first question is "we don't",
>> > then I need help about how to convert those
>> > Makefile.in variables into new entries of generated config.h file.
>>
>> Possible patch is attached.
>> Can you try it? ?I don't know that it will fix things, but based on
>> what you've said it seems reasonable to try.
>
> ?I tried it...
> But got really into troubles to regenerate configure and config.in using
> Cygwin
> installation...
> ?I finally discovered gcc-tools-epoch2 cygwin package
> that allowed me to successfully regenerate configure and config.in
>
> ?After that I did recompile and install gdb into e:\pas\fpc-2.7.1 directory
> by specifying --prefix=/e/pas/fpc-2.7.1
> (I tested with --preficx=e:/pas/fpc-2.4.4, which worked the same)
>
> E:\pas\fpc-2.7.1\gdb>cd bin
>
> E:\pas\fpc-2.7.1\gdb\bin>.\gdb ./gdb
> GNU gdb (GDB) 7.4.50.20120117-cvs
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. ?Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-mingw32".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from E:\pas\fpc-2.7.1\gdb\bin\gdb.exe...done.
> (gdb) py print gdb.PYTHONDIR
> e:\pas\fpc-2.7.1\gdb\share\gdb/python
> (gdb) py
>>end
> (gdb) q
>
> E:\pas\fpc-2.7.1\gdb\bin>cd ..\..
>
> E:\pas\fpc-2.7.1>cp -Rf gdb ..\fpc-2.6.0
>
> E:\pas\fpc-2.7.1>cd ..\fpc-2.6.0\gdb\bin
>
> E:\pas\fpc-2.6.0\gdb\bin>.\gdb ./gdb
> GNU gdb (GDB) 7.4.50.20120117-cvs
> Copyright (C) 2012 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law. ?Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-mingw32".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from E:\pas\fpc-2.6.0\gdb\bin\gdb.exe...done.
> (gdb) py print gdb.PYTHONDIR
> e:\pas\fpc-2.6.0\gdb\share\gdb/python
> (gdb)
>
> So the basic idea of rebasing gdb/python seems to work,
> the next problem is that I never used python scripts
> so that I didn't know what else to do to check that this directory is really
> functional!

Here is the patch I committed.
Tested on amd64-linux with various values for --with-sysroot.

The test the previous code was using to compute the relocability of
TARGET_SYSTEM_ROOT, is, AFAICT, excessively complex.
main.c treats TARGET_SYSTEM_ROOT no different than other relocatable
dirs, so I went with what GDB_AC_WITH_DIR does.
Alas I can't just use GDB_AC_WITH_DIR as the help output will be
wrong, and I didn't want to add another argument to GDB_AC_WITH_DIR
and update all its callers just for this.  Still, I think this is an
improvement.
Thanks again for the detective work.

2012-01-18  Doug Evans  <dje@sebabeach.org>

        * Makefile.in (TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_DEFINE): Delete.
        (main.o): Remove rule.
        * configure.ac (BINDIR): Define with AC_DEFINE_DIR.
        (--with-sysroot): Rewrite.
        * configure: Regenerate.
        * config.in: Regenerate.

Attachment: gdb-120118-mingw-sysroot-config-1.patch.txt
Description: Text document


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