This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Analyzing a SEG FAULT that gdb doesn't help with
- From: Michael Enright <mike at kmcardiff dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 31 Jul 2015 13:12:41 -0700
- Subject: Re: Analyzing a SEG FAULT that gdb doesn't help with
- Authentication-results: sourceware.org; auth=none
- References: <CAOC2fq_fahjLapKbgO8Xer8neEjv1Ohs4bM3JOWcka0ajjcbCg at mail dot gmail dot com> <55BA373A dot 4020909 at dronecode dot org dot uk> <55BB6F47 dot 1000906 at dronecode dot org dot uk> <CAOC2fq89HuStOLzEO9MxFZHBd54vmYfvp4juQyMKkNGkYG_D_g at mail dot gmail dot com>
On Fri, Jul 31, 2015 at 11:46 AM, Michael Enright wrote:
> On Fri, Jul 31, 2015 at 5:51 AM, Jon TURNEY wrote:
>>
>> I think you need to use the gdb command 'set cygwin-exceptions on' to tell
>> gdb to break on exceptions <...>
>
> This is going to help, I have another application (which I don't even
> know yet if it uses strftime because I didn't write it) that is
> falling over in a similar fashion, with a different 0x61xxxxxx address
> involved.
The program in question is passing strings to printf that (a) end with
"% " or (b) in the middle have "% S". To be clear these strings are
the sole argument so they are format strings. This happens tons of
times during a run but eventually it crashes in printf, generating a
stackdump unless the magic setting is set.
As I read the posix spec, % can be followed by flags and space is
actually a flag. This flag affects how signs are handled for numeric
output. So it could be that the code is trying to deal with
%<flag><conversion-char> and S is not a valid conversion char. My
attempts to reproduce this outside the evil program have not worked.
The output is a little crazy when you printf("something % Something")
but in my test program it doesn't crash. I tried printing the strings
that the real program might have to deal with but this didn't cause a
crash either.
I have modified the evil program so that in at least this one spot,
lines from the input file are not passed to printf to be output.
So there might be something, because an internal SEGV that actually
halts the program is bad, but I haven't got a good test case. I have
always disagreed with both printf(sometext) and printf("%s", sometext)
as wastes of cycles but I wasn't the one making the choices when the
evil program was written.
--
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