This is the mail archive of the cygwin mailing list for the Cygwin 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: Analyzing a SEG FAULT that gdb doesn't help with


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


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