Web lists-archives.com

Re: [Mingw-users] Pending new mingwrt and w32api releases




>From: Keith Marshall [mailto:keithmarshall@xxxxxxxxxxxxxxxxxxxxx] 
>Sent: Monday, March 06, 2017 3:17 PM
>To: mingw-users@xxxxxxxxxxxxxxxxxxxxx
>Subject: Re: [Mingw-users] Pending new mingwrt and w32api releases

On 06/03/17 01:20, David Gressett wrote:
>> I ... proceeded to work on shrinking xsinfo into a minimal test case.
>> When I finished, xsinfo had completely vanished; it is now replaced
>> with CrashDemo.adb, which has only 5 lines of actual code:
>> 
>> procedure CrashDemo is
... snip ...
>> This produces the same gdb traceback that I got with xsinfo.

>FTR, I tried to reproduce this, in my cross-compiler environment:

>$ mingw32-gnatmake --version
>GNATMAKE 5.3.0
>Copyright (C) 1995-2015, Free Software Foundation, Inc.
... snip ...

>$ ./crashdemo.exe
>raised CRASHDEMO.ERR : crashdemo.adb:4

>which I think is what you expect. Do note that this is with the tip 
>revision of mingwrt/w32api-5.0, (including my local patches, which are 
>unlikely to have any bearing on the issue), running under wine, (which 
>is masquerading as Win7, and is usually less forgiving than real Win7), 
>with statically linked Ada runtime, (IIRC, you were able to produce a 
>DLL variant of that, but I never succeeded in doing so). IOW, I can't 
>reproduce your crash, so I can't debug it; is it possible that the 
>issue lies within your dynamically linked Ada runtime?

I did a quick test by making a copy of my MinGW directory tree from
which both gnat dlls had been deleted and renamed it to MinGW.

The rebuild of CrashDemo.adb produced a crashdemo.exe which 
was exactly the same size as the previous one and behaved the
same, so it appears that the gnat dlls are not used and the static
Ada runtime is linked by default.

I did do some more debugging, comparing two copies of 
crashdemo run by gdb side-by side. Both were compiled with
my experimental gcc 6.3.0, which is installed with gcc runtime
libraries not stripped, but one with the V3 mingwrt/w32api
and the other built with the V5 mingwrt/w32api . The V5
crashdemo has libmingwex-0.dll copied into thedirectory 
so that it will run when the main MinGW is set up with the
current V3.

I stepped through both of them  one step at a time
in parallel. I found that the paths taken through the runtime
handling the exception diverge well before the crash happens
in the V5 crashdemo. The divergence occurs not in an Ada
routine, but in one written in C:

src/gcc-6.3.0/libgcc/unwind-dw2-fde.c

The divergence occurs in the very last procedure in
the file, _Unwind_Find_FDE, which starts at line 998.
The divergence starts at the very first executable lines
(1004 and 1005). I didn't get a screen capture of the displays;
I will do that when I try it again.

 998  const fde *
 999  _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
1000  {
1001    struct object *ob;
1002    const fde *f = NULL;
1003
1004    init_object_mutex_once ();
1005    __gthread_mutex_lock (&object_mutex);
1006
1007    /* Linear search through the classified objects, to find the one
1008    containing the pc.  Note that pc_begin is sorted descending, and
1009    we expect objects to be non-overlapping.  */

FYI, the patch needed to get the gnat dlls to build is very simple. This is
the gcc 5.3.0 version, but it is very nearly the same thing for gcc 5.4.0
and gcc 6.3.0; the main difference is that the line numbers are different.
This produces only one extra gnat tool, gnatdll.exe, which is needed to
make dlls that are written in Ada.

diff -pNaur gcc-5.3.0-current/gnattools/Makefile.in gcc-5.3.0-working/gnattools/Makefile.in
--- gcc-5.3.0-current/gnattools/Makefile.in	2014-02-23 10:30:11 -0600
+++ gcc-5.3.0-working/gnattools/Makefile.in	2015-12-27 17:21:45 -0600
@@ -193,7 +193,7 @@ gnattools-native: $(GCC_DIR)/stamp-tools
 	  ../../gnatmake$(exeext) ../../gnatlink$(exeext)
 	# gnattools2
 	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
+	  $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools $(EXTRA_GNATTOOLS)
 
 # gnatmake/link can be built with recent gnatmake/link if they are available.
 # This is especially convenient for building cross tools or for rebuilding
@@ -205,7 +205,7 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rt
 	  gnatmake-re gnatlink-re
 	# gnattools2
 	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools
+	  $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools $(EXTRA_GNATTOOLS)
 
 gnattools-cross: $(GCC_DIR)/stamp-tools
 	# gnattools1-re
@@ -214,7 +214,7 @@ gnattools-cross: $(GCC_DIR)/stamp-tools
 	  gnatmake-re gnatlink-re
 	# gnattools2
 	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools
+	  $(TOOLS_FLAGS_TO_PASS_CROSS) common-tools $(EXTRA_GNATTOOLS)
 	# Rename cross tools to where the GCC makefile wants them when
 	# installing.  FIXME: installation should be done elsewhere.
 	if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \






------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe