简体   繁体   English

C-Eclipse-“混合”方言和ANSI支持崩溃程序?

[英]C - Eclipse - “Mixed” dialect and ANSI support crash program?

I've been having a strange issue with C in Eclipse. 我在Eclipse中遇到了一个奇怪的问题。 Right-clicking on my project, I go to Properties, C/C++ Build, Settings, Gcc C Compiler Dialect. 右键单击我的项目,然后转到“属性”,“ C / C ++构建”,“设置”,“ Gcc C编译器方言”。 In the dropdown menu, by default, there's nothing under Language Standard, and my program runs fine. 默认情况下,在下拉菜单中,“语言标准”下没有任何内容,并且我的程序可以正常运行。 However, by changing to anything else (C90, C99, or C11), the program crashes when run. 但是,通过更改为其他任何内容(C90,C99或C11),程序在运行时会崩溃。

Using the debugger, I looked at the disassembly and got a complaint regarding strln() at some memory address and I'm not sure where to proceed from here. 使用调试器,我查看了反汇编,并在某个内存地址收到了关于strln()的投诉,我不确定从哪里开始。

Here's some assembly: 这是一些程序集:

mov (%ecx),%al
add $0x1,%ecx
test %al,%al
je 0x75234434 <strlen+97>
test $0x3,%ecx
jne 0x752343df <strlen+12>
...

Interestingly, without the dialect specified, by clicking on Miscellaneous, and clicking Support ANSI programs (-ansi) causes the exact same error. 有趣的是,在未指定方言的情况下,通过单击“其他”,然后单击“支持ANSI程序(-ansi)”,将导致完全相同的错误。

Any and all advice welcome :) 任何和所有建议,欢迎:)

Tracebook as requested: 跟踪记录按要求:

#0  0x752343df in strlen () from C:\WINDOWS\syswow64\msvcrt.dll
#1  0x0044e2bd in __mingw_pformat ()
#2  0x0044ca5f in __mingw_vfprintf ()
#3  0x00417156 in fprintf (__stream=0x752c2980 <msvcrt!_iob+128>, __format=0x4561dc <__register_frame_info+4547036> "%s %.2lf %s %.0lf %.0lf %.2lf %.2lf %.2lf %.2lf ") at c:/mingw/include/stdio.h:246
#4  0x00418893 in skriv_v_profil (tag=0x809fe8, nasta_stat=..., sign=1, variant=2) at ..\src\kortid.c:314
#5  0x00419d65 in kor_tid (tag=0x809fe8, v2=24.25, smax=452, tmax=100000) at ..\src\kortid.c:642
#6  0x00427fdb in gang_tid (tag=0x809fe8, ret_kod=2, tmax=100000, skriv_g3=0, test_finnsg3=0, t_ack=3030.5876288659802) at ..\src\gangtid.c:2617
#7  0x00403215 in kor_tag (taget=0x809fe8, lanken=0x7cc338, riktning=1, result=0x7da1f8, resflg=7) at ..\src\ttt2gtk.c:702
#8  0x00407ff7 in grenkortag (banap=0x28fd6c, grnidx=0, tagtyp=0x7e6ea0, ttpidx=0, riktn=1, resflg=7, stppl=0x0, resp=0x28fd34) at ..\src\ttt2gtk.c:2405
#9  0x004201b8 in main (argc=11, argv=0x7e1b00) at ..\src\gtb.c:991

Apologies, I missed copying the second half as the window was really small. 抱歉,由于窗口很小,我错过了下半年的复制。

I believe I have found the error. 我相信我已经找到了错误。 One of the variables becomes -1 and highlighted in Eclipse. 变量之一变为-1,并在Eclipse中突出显示。 I have no idea about the details but I think the solution will be very specific and I'll have to find it myself. 我不知道细节,但我认为解决方案将非常具体,我必须自己找到它。 Thanks to John Bode and WhozCraig for the help, especially regarding the traceback. 感谢John Bode和WhozCraig的帮助,尤其是在追溯方面。 Life savers, thank you! 救生员,谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM