如何在命令行应用程序中使用仪器并显示控制台
发布时间:2020-12-15 01:56:27 所属栏目:百科 来源:网络整理
导读:我在OSX上使用Xcode来开发命令行C应用程序。我也想使用仪器来配置文件并找到内存泄漏。 但是,从仪器中启动应用程序时,我找不到显示控制台的方法。我也无法附加到正在运行的命令行进程(它会出现错误): 以下是一个示例代码: #include stdio.h#include sign
我在OSX上使用Xcode来开发命令行C应用程序。我也想使用仪器来配置文件并找到内存泄漏。
但是,从仪器中启动应用程序时,我找不到显示控制台的方法。我也无法附加到正在运行的命令行进程(它会出现错误): 以下是一个示例代码: #include <stdio.h> #include <signal.h> #include <stdlib.h> #include <setjmp.h> static sigjmp_buf jmpbuf; void handler(int sig) { char c[BUFSIZ]; printf ("Got signal %dn",sig); printf ("Deseja sair? (s/n) "); fgets(c,sizeof(c),stdin); if(c[0] == 's') { exit(0); } else { siglongjmp(jmpbuf,1); } } int main(void) { char buf[BUFSIZ]; signal(SIGINT,handler); sigsetjmp(jmpbuf,1); while(1) { printf(">>>"); fgets(buf,sizeof(buf),stdin); printf ("Introduziu: %sn",buf); } return(0); } 以下是启动仪器后发现的错误,并尝试附加到xcode中运行的进程: [Switching to process 1475] [Switching to process 1475] Error while running hook_stop: sharedlibrary apply-load-rules all Error while running hook_stop: Invalid type combination in ordering comparison. Error while running hook_stop: Invalid type combination in ordering comparison. Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Error while running hook_stop: Unable to disassemble __CFInitialize. 有什么想法吗? 解决方法
这很容易。看截图。
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |