DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 62D5OG54370075
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 62D5OG54370075
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=vlOFU+WK
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1256F4C31822
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1773379455;
	bh=3wdjJ8lDFTaxaw85BQuKJskAqcQm+VligiORxgZNwXY=;
	h=Date:To:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=vlOFU+WKIO7QLrY2CTTYkRAO6LMaec7pt/aimFjgxmNDu70SmlhydSZbz3rzdeYTT
	 UDWmZPjJyaV+RPtY/ZVDf0Gujl2b4k7RHRIyISC2iwPKBPw3miuYj6ZuQwHkM9YqjL
	 oAfplw99NPWjYe79/myCleNtEvQn1yl6aTHXMk0E=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 666814BBC0C6
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 666814BBC0C6
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773379404; cv=none;
 b=FJzFCc2lPWN8NwKP2S4MjGbGksb3KFBLbyDRMzHRBlDXnHGx4bqDobFMvrjl1g4AislBIpMAfsZkXGPzW9FpJw0vZh9cIY2p0xN9iXssrqmpo5ykZoPhXlYxgH6MjxxbFnJnJjGZFLdyg1zuOsCxjk2aCranihxGqOmLtl6EEqU=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1773379404; c=relaxed/simple;
 bh=0+VfEVFX4spgrGuBksD1HYI7OBXNstVAl7ki80VvlB4=;
 h=DKIM-Signature:Date:From:To:Message-ID:Subject:MIME-Version;
 b=A7OJV4lzxzkHe/lXnzUz2TTDRJYG9w9UnWV1OEz9KaeFzEhlSwXZRZR0BRxrSQ3okFyz87XWdhohdsLrxdqxmvQ8lFNLcdPGIn8siNet4UBtSQobWaefs4ymmamdrFgFDcF7GAXC+WKNcCySjsnGZ5zAlHeOdmCadzKSvbT20ZY=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 666814BBC0C6
Date: Thu, 12 Mar 2026 22:23:20 -0700 (PDT)
To: KENNON J CONRAD via Cygwin <cygwin@cygwin.com>,
        Jon Turney <jon.turney@dronecode.org.uk>
Message-ID: <275464098.52532.1773379400076@connect.xfinity.com>
In-Reply-To: <533298615.52416.1773378911433@connect.xfinity.com>
References: <547312365.1464244.1771958282029@connect.xfinity.com>
 <aZ7PrbisVR1R4A7v@dimstar.local.net>
 <1670201592.1489273.1772043520008@connect.xfinity.com>
 <e91d8b5b-2690-4271-aa74-e6226440e33d@SystematicSW.ab.ca>
 <1044918836.1507810.1772086967212@connect.xfinity.com>
 <abd66c5d-6bcd-40ae-b7c6-a8a3325aca8e@dronecode.org.uk>
 <533298615.52416.1773378911433@connect.xfinity.com>
Subject: Re: Memmove causing program crashes, giving SIGTRAP in GDB(?)
MIME-Version: 1.0
X-Priority: 3
Importance: Normal
X-Mailer: Open-Xchange Mailer v7.10.6-Rev83
X-Originating-IP: ::ffff:50.47.202.14
X-Originating-Port: 33754
X-Originating-Client: open-xchange-appsuite
X-CMAE-Envelope: MS4xfMjdIUaAxNuHCG70p1opcwmYZGxKss6j72J6iPqCGz5Rhfpdj5HClTxDg1u3RALe3T8DCP3fSP4fDygdBBH15+2Zbgx57n3n50Nf0VSCRI3rWKpEjNRS
 qP8rSa7VtE6bInLxUXiC4x2F0DzpMjFyhmEO6gdLqJmSazXGHYwmruZWw5esYLy+jNfOmp9DnE/rUxjeq0PH9m7TQui9gEEiV+DY5eM9s15rV5YQN2ejFXDV
 cS3o23aKF20L/0xVDaDxh4PxqhtE/Hl8q/QEHTcevEk=
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: KENNON J CONRAD via Cygwin <cygwin@cygwin.com>
Reply-To: KENNON J CONRAD <kennonconrad@comcast.net>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

Corrections:

Elements 973 - 976 would be moved on the next iteration of the REP MOVSQ.
REP MOVSQ made it through 17 iterations

> On 03/12/2026 10:15 PM PDT KENNON J CONRAD via Cygwin <cygwin@cygwin.com> wrote:
> 
>  
> Thanks, Jon.  Setting cygwin-exceptions on does change the picture considerably,
> but the picture of exactly what is happening is still cloudy for me.
> 
> The program breaks at the same spot in memmove, which is now in frame 0:
> REP MOVSQ %ds(%rsi),%es(%rdi)
> 
> but now GDB says "received signal SIGSEGV, Segmentation fault."
> 
> The EFLAGS register value is 0x10687 [ CF PF SF IF DF RF ].
> So DF is set (as it should be), which is different than without exceptions on.
> 
> ds contains 0x2b (not relevant?)
> es contains 0x2b (not relevant?)
> rsi contains 0xa00034c1a
> rdi contains 0xa00034c1c
> The uint16_t array starts at address 0xa00034480
> Array elements 781 - 1045 are being moved to 782 - 1046 (backward move).
> Elements 973 - 980 would be moved on the next iteration of the REP MOVSQ.
> 
> I see no obvious reason for the segmentation fault.  The array address looks correct,
> the array indexes are valid, and the REP MOVSQ made it through 8 iterations before
> the SIGSEGV happened, and the program does not crash using alternative code in place
> of the memmove call.
> 
> Is it possible some interrupt routine doesn't handle DF being set when it starts and
> gets a segmentation fault that GDB would detect at this point in the code?
> 
> 
> > I'd add to that a reference to [1]
> > 
> > [1] https://cygwin.com/faq.html#faq.programming.debugging-cygwin
> > 
> > Unfortunately, when investigating exceptions inside the cygwin dll, it's 
> > necessary to 'set cygwin-exceptions on', which will cause the debugger 
> > to actually stop at the point of the exception.
> > 
> > (This explains why the specific exception is SIGTRAP, and why you get 
> > the all the extra frames for exception handling below memmove in the 
> > backtrace)
> >
> 
> -- 
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
