X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=BwaX ER+I+xTZXTfVbYPg0cm5SK/oM3qxlAuPV9UZ13GI3cGOg6/pm2erVUuBG0v8DSx2 U6AhpNy+nmlkYXpQ6hkG1g4Cji6WU+v9dmRwYOwyMFwuoYbxsHlOsDWknsczBxXt /yPPB2TrhL9WZes/IJuK/4kHNknw5CLjKmybthM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=SJvF8OBSHc 94wc+4QuNaL1E2s9M=; b=Ff2TBstuD7SAKrPBTG8JROHyNh6lGaeF93GUFektqb orKGO2jxxRhBQ6n0/HBeNKNWTFzCYhuwu1/qAyuywv5L5GWqIokQrJnaKDf3uRts afyaeIqUrtUNyMdLsjluoKwCHNPCQaoRcgPhqNoikX2vyQ8BTq0eQmjQXyWtUxPG 4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_40,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=drow, Crash, Marco, 2816 X-HELO: limerock04.mail.cornell.edu X-CornellRouted: This message has been Routed already. Subject: Re: Cygwin 64 problem To: cygwin AT cygwin DOT com References: From: Ken Brown Message-ID: <37067fb7-8250-5aff-ebb5-8abe6746c8f6@cornell.edu> Date: Tue, 29 Nov 2016 15:14:29 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------03FA48B83655A9D841B7A1DA" X-PMX-Cornell-Gauge: Gauge=XX X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none; X-IsSubscribed: yes --------------03FA48B83655A9D841B7A1DA Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 11/27/2016 11:02 AM, Ken Brown wrote: > On 11/27/2016 9:03 AM, Girish Joglekar wrote: >> Hi Ken, >> Thank you for your reply on the Cygwin mailing list. I have created a >> slightly smaller test example smaller than what I had created in Feb. >> Attached is a tar file. After make insall if you run TEST.x and click >> the Open button, it gives segmentation fault. >> Hope you will be able to help. >> Thank you. >> Girish > > Please keep the discussion on the mailing list so that people who might > be able to help will see it. I personally am not familiar with X11 > programming, so I'm not one of those people. > > I do have a few comments, however: > > 1. This may be slightly smaller than your previous program, but it is > still *very* far from a small test case. You really can't expect people > to debug a program of this size for you. > > 2. I suggest that you build with -Wall (as Marco already suggested in > the earlier discussion) and fix all the compiler warnings. I saw > several that need attention (aside from the many "unused variable" > warnings). It wouldn't hurt to also use -Wextra. > > 3. I also suggest that you use gdb to find out where the program is > crashing and why. You made a start on that in the discussion last > March, but you didn't follow through. (By the way, I recommend building > without optimization; otherwise you may not be able to get accurate > information about the crash from gdb.) > > 4. If, after the steps above, you still think the crash is due to a > Cygwin bug rather than a programming error, then try to extract from > your program a test case as small as possible that reproduces the crash. I've looked at this a little, and the crash occurs because of a bad value of a pointer to a font list. I'm attaching an annotated transcript of a gdb session that illustrates this. I didn't try to figure out where the bad pointer came from. As a workaround, you can avoid the crash by removing from mosprshx.c all uses of spreadSheetFont, as in the following patch: --- mosprshx.c~ 2016-11-27 08:46:12.000000000 -0500 +++ mosprshx.c 2016-11-29 14:58:23.114377500 -0500 @@ -29,8 +29,6 @@ 0x00, 0x7c, 0x07, 0x1e, 0x0f, 0x07, 0x9e, 0x03, 0xfc, 0x01, 0xf8, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00}; -static char *spreadSheetFont = "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"; - #ifdef __STDC__ static void mosprshCreateCheckMarkPixmap(Widget pushButton) #else @@ -208,11 +206,6 @@ if(isParentManaged) XtUnmanageChild(parentFM); - fromValue.addr = spreadSheetFont; - fromValue.size = utStringLength(fromValue.addr) + 1; - toValue.addr = NULL; - XtConvertAndStore(parentFM,XmRString,&fromValue,XmRFontList,&toValue); - ac = 0; XtSetArg(al[ac],XmNuserData,(XtPointer)spreadSheetSize); ac++; spreadSheet = XmCreateForm(parentFM,"SpreadSheet",al,ac); @@ -234,9 +227,6 @@ XtSetArg(al[ac],XmNtraversalOn,FALSE); ac++; } XtSetArg(al[ac],XmNcolumns,longestFixedColumnSize+1); ac++; - if(toValue.addr) { - XtSetArg(al[ac],XmNfontList,*(unsigned int *)toValue.addr); ac++; - } for(i1=0 ; i1 0) { XtSetArg(al[ac],XmNcolumns,cellSize); ac++; } - if(toValue.addr) { - XtSetArg(al[ac],XmNfontList,*(unsigned int *)toValue.addr); ac++; - } for(j1=0 ; j1) at /usr/src/debug/motif-2.3.6-1/lib/Xm/XmFontList.c:637 #2 0x00000003fc657920 in InitializeTextStruct (tf=tf AT entry=0x6000af730) at /usr/src/debug/motif-2.3.6-1/lib/Xm/TextF.c:7295 #3 0x00000003fc657e67 in Initialize (request=request AT entry=0x6000afb40, new_w=new_w AT entry=0x6000af730, args=args AT entry=0xffffbd60, num_args=num_args AT entry=0xffffb320) at /usr/src/debug/motif-2.3.6-1/lib/Xm/TextF.c:7817 #4 0x00000003fc469bb1 in CallInitialize ( class=0x3fc72c440 , req_widget=req_widget AT entry=0x6000afb40, new_widget=new_widget AT entry=0x6000af730, args=args AT entry=0xffffbd60, num_args=num_args AT entry=8) at /usr/src/debug/libXt-1.1.5-1/src/Create.c:226 #5 0x00000003fc46a65c in xtCreate ( name=name AT entry=0xffffb950 "fixedColumnRow0", class=class AT entry=0x0, widget_class=widget_class AT entry=0x3fc72c440 , parent=0x1fc5dd590, parent AT entry=0x6000af0d0, default_screen=0x600052780, args=args AT entry=0xffffbd60, num_args=num_args AT entry=8, typed_args=typed_args AT entry=0x0, num_typed_args=num_typed_args AT entry=0, parent_constraint_class=0x3fc720dc0 , post_proc=post_proc AT entry=0x3fc469bf0 ) at /usr/src/debug/libXt-1.1.5-1/src/Create.c:416 #6 0x00000003fc46a906 in _XtCreateWidget ( name=name AT entry=0xffffb950 "fixedColumnRow0", widget_class=widget_class AT entry=0x3fc72c440 , parent=parent AT entry=0x6000af0d0, args=args AT entry=0xffffbd60, num_args=num_args AT entry=8, typed_args=typed_args AT entry=0x0, num_typed_args=num_typed_args AT entry=0) at /usr/src/debug/libXt-1.1.5-1/src/Create.c:570 #7 0x00000003fc46abd9 in XtCreateWidget (name=0xffffb950 "fixedColumnRow0", widget_class=0x3fc72c440 , parent=0x6000af0d0, args=0xffffbd60, num_args=8) at /usr/src/debug/libXt-1.1.5-1/src/Create.c:589 #8 0x00000003fc658a81 in XmCreateTextField (parent=, name=, arglist=, argcount=) at /usr/src/debug/motif-2.3.6-1/lib/Xm/TextF.c:10645 #9 0x000000010040882d in mosprshCreateSpreadsheet (parentFM=0x6000acc60, spreadSheetTitle=0x100421087 "Measuring Unit Specification", rowNames=0x6000ab4f0, columnNames=0x6000ab4b0, cellSize=0, mosprshCheckButtonCallback=0x0) at mosprshx.c:242 [...] +p *table $1 = (struct __XmRenderTableRec *) 0x56f700001ea1 +p *$ Cannot access memory at address 0x56f700001ea1 +f 2 #2 0x00000003fc657920 in InitializeTextStruct (tf=tf AT entry=0x6000af730) at /usr/src/debug/motif-2.3.6-1/lib/Xm/TextF.c:7295 7295 TextF_FontList(tf) = (XmFontList)XmFontListCopy(TextF_FontList(tf)); +p tf->text.font_list $2 = (XmFontList) 0xaeeb0 [This is the bad pointer that was propagated to XmRenderTableCopy. I didn't chase down where it came from.] --------------03FA48B83655A9D841B7A1DA Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --------------03FA48B83655A9D841B7A1DA--