编译器问题.... C或编译器独有的??? [英] Compiler problem....unique to C or compiler???

查看:93
本文介绍了编译器问题.... C或编译器独有的???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究5.11(再一次)。

所以,只需逐步调试调试器中的代码,然后得到这个......并且

无法继续。已发布到Xcode论坛,但我猜是

真正的大师们在这里用C!不确定这是否是严格的C。问题,

但我相信你会告诉我的! :-)


代码很简单,有2个命令行参数:


#include< stdio.h>


int astrcomp(const char *,const char *);


int main(int argc,const char * argv []){

int i;

i = astrcomp(argv [1],argv [2]);

if(i == 0)

printf(" \"%s \" equals \"%s \"",argv [1],argv [2]);

否则if(i 0)

printf(" \"%s \"大于\%s \"",argv [1],argv [2]);

else if(i< 0)

printf(" \"%s \"小于\ %s \"",argv [1],argv [2]);


返回0;

}

int astrcomp(const char * s,const char * t){

for(; * s == * t; s ++,t ++)

if(* s == 0)

返回0;

返回(* s - * t);

}

待定断点1 - "" main.c中:3英寸已解决

内部错误时gdb堆栈爬行:

[0] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin(align_down

+ 0x0)[0x11d2ff]

[1] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(step_into_current_inlined_subroutine + 0x109 )[0x6d5b2]

[2] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(inlined_function_update_call_stack + 0x154a)[0x6ebbe]

[3] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(handle_inferior_event + 0xbfe)[0x68332]

[4 ] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(fetch_inferior_event + 0x125)[0x6abda]

[5] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(inferior_event_handler + 0xd0)[0x7e9c4]

[6] / Developer / usr / libexec / gdb / gdb-i386- apple-darwin

(handle_file_event + 0x159)[0x7c8ac]

[7] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin(process_event

+ 0x81)[0x7c 49e]

[8] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(gdb_do_one_event + 0x46a)[0x7d33c]

[9] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin(catch_errors

+ 0x4d)[0x77487]

[10] /开发人员/ usr / libexec / gdb / gdb-i386-apple-darwin

(start_event_loop + 0x52)[0x7c4fd]

[11] / Developer / usr / libexec / gdb / gdb-i386-apple-darwin

(captured_command_loop + 0x12)[0x7821e]

[12] / Developer / usr / libexec / gdb / gdb-i386-apple- darwin(catch_errors

+ 0x4d)[0x77487]

/SourceCache/gdb/gdb-768/src/gdb/inlining.c:1742:internal-error:

step_into_current_inlined_subroutine:断言

`current_inlined_subroutine_call_stack_start_pc()== stop_pc''失败。

检测到GDB内部的问题,

进一步调试可能证明不可靠。

调试器已退出状态1.调试器已退出

状态1.

任何见解一如既往地受到赞赏。

解决方案

mdh写道:

[snip]
< blockquote class =post_quotes>
检测到GDB内部问题,

进一步调试可能证明不可靠。



你能看到吗?


调试器逻辑中的一个问题(调试器崩溃了)

发生了。这可能与您的程序有任何关系。


解决方案:


1)使用另一个较少的调试器和开发系统错误

2)前往GDB支持小组寻求帮助。您可能会发现

愿意帮助您的人。

3)在谷歌和其他引擎中搜索关于gdb中的错误。

4 )为你的操作系统下载gdb的来源并找出错误。


-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32


mdh写道:


我正在研究5.11(再一次)。

所以,只需逐步调试调试器中的代码,然后得到这个......并且

无法继续。已发布到Xcode论坛,但我猜是

真正的大师们在这里用C!不确定这是否是严格的C。问题,

但我相信你会告诉我的! :-)


代码很简单,有2个命令行参数:


#include< stdio.h>


int astrcomp(const char *,const char *);


int main(int argc,const char * argv []){



const在那里做什么?


int i;

i = astrcomp( argv [1],argv [2]);



在调用astrcomp()之前argc是什么?


if(i == 0)

printf(" \"%s \" equals \"%s \"",argv [1],argv [2]);



这里及以下,\ n缺少例如:


printf(" \"%s \等于\%s \" \ n",argv [1],argv [2]);


else if( i 0)

printf(" \"%s \"大于\%s \",argv [1],argv [2] );

else if(i< 0)

printf(" \"%s \"小于\%s \\ \\",argv [1],argv [2]);


返回0;

}


int astrcomp(const char * s,const char * t){

for(; * s == * t; s ++,t ++)

if(* s == 0)



if(* s ==''\''')


返回0;

return(* s - * t);



返回类型astrcomp()是int,而不是char。

-

Tor< bw ****@wvtqvm.vw | tr i-za-h a-z>


mdh说:


#include< stdio。 h>


int astrcomp(const char *,const char *);


int main(int argc,const char * argv [] ){

int i;

i = astrcomp(argv [1],argv [2]);



如果我是你,我的第一步是确保argc 2在使用argv [1]和argv [2]调用

astrcomp之前作为论点。


-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日


I am working on 5.11 ( once again).
So, just stepping through code in the debugger, and get this...and
cannot proceed. Have posted to the Xcode forum, but my guess is the
real gurus are here in C!! Not sure if this is a strict "C" issue,
but I am sure you will let me know !! :-)

The code is simply this, with 2 command line arguments:

#include <stdio.h>

int astrcomp(const char *, const char *);

int main (int argc, const char * argv[]) {
int i;
i = astrcomp(argv[1], argv[2]);
if ( i == 0)
printf(" \"%s\" equals \"%s\" ", argv[1], argv[2] );
else if ( i 0 )
printf(" \"%s\" is greater than \"%s\" ", argv[1], argv[2] );
else if ( i < 0 )
printf(" \"%s\" is less than \"%s\" ", argv[1], argv[2] );

return 0;
}
int astrcomp(const char *s, const char *t){
for (; *s == *t ; s++, t++)
if ( *s == 0)
return 0;
return (*s - *t);
}
Pending breakpoint 1 - ""main.c:3" resolved
gdb stack crawl at point of internal error:
[ 0 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (align_down
+0x0) [0x11d2ff]
[ 1 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(step_into_current_inlined_subroutine+0x109) [0x6d5b2]
[ 2 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(inlined_function_update_call_stack+0x154a) [0x6ebbe]
[ 3 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(handle_inferior_event+0xbfe) [0x68332]
[ 4 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(fetch_inferior_event+0x125) [0x6abda]
[ 5 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(inferior_event_handler+0xd0) [0x7e9c4]
[ 6 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(handle_file_event+0x159) [0x7c8ac]
[ 7 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (process_event
+0x81) [0x7c49e]
[ 8 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(gdb_do_one_event+0x46a) [0x7d33c]
[ 9 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (catch_errors
+0x4d) [0x77487]
[ 10 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(start_event_loop+0x52) [0x7c4fd]
[ 11 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin
(captured_command_loop+0x12) [0x7821e]
[ 12 ] /Developer/usr/libexec/gdb/gdb-i386-apple-darwin (catch_errors
+0x4d) [0x77487]
/SourceCache/gdb/gdb-768/src/gdb/inlining.c:1742: internal-error:
step_into_current_inlined_subroutine: Assertion
`current_inlined_subroutine_call_stack_start_pc() == stop_pc'' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
The Debugger has exited with status 1.The Debugger has exited with
status 1.
Any insight is, as always , appreciated.

解决方案

mdh wrote:
[snip]

A problem internal to GDB has been detected,
further debugging may prove unreliable.

Can you read?

A problem in the debugger logic (the debugger has crashed)
happens. This may or may not have anything to do with your program.

Solutions:

1) Use another debugger and development system that has less bugs
2) Go to the GDB support groups and ask for help. You may find
someone that is willing to help you.
3) Search in google and other engines about your bug in gdb.
4) Download the sources of gdb for your OS and gix the bug.

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32


mdh wrote:

I am working on 5.11 ( once again).
So, just stepping through code in the debugger, and get this...and
cannot proceed. Have posted to the Xcode forum, but my guess is the
real gurus are here in C!! Not sure if this is a strict "C" issue,
but I am sure you will let me know !! :-)

The code is simply this, with 2 command line arguments:

#include <stdio.h>

int astrcomp(const char *, const char *);

int main (int argc, const char * argv[]) {

What is the const doing there?

int i;
i = astrcomp(argv[1], argv[2]);

What was argc before doing that call astrcomp()?

if ( i == 0)
printf(" \"%s\" equals \"%s\" ", argv[1], argv[2] );

Here and below, the \n is missing e.g.:

printf(" \"%s\" equals \"%s\" \n", argv[1], argv[2]);

else if ( i 0 )
printf(" \"%s\" is greater than \"%s\" ", argv[1], argv[2] );
else if ( i < 0 )
printf(" \"%s\" is less than \"%s\" ", argv[1], argv[2] );

return 0;
}
int astrcomp(const char *s, const char *t){
for (; *s == *t ; s++, t++)
if ( *s == 0)

if (*s == ''\0'')

return 0;
return (*s - *t);

return type of astrcomp() is int, not char.
--
Tor <bw****@wvtqvm.vw | tr i-za-h a-z>


mdh said:

#include <stdio.h>

int astrcomp(const char *, const char *);

int main (int argc, const char * argv[]) {
int i;
i = astrcomp(argv[1], argv[2]);

If I were you my first step would be to ensure that argc 2 before calling
astrcomp with argv[1] and argv[2] as arguments.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


这篇关于编译器问题.... C或编译器独有的???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆