I'm using Xcode on OSX to develop command line C applications. I would also like to use Instruments to profile and find memory leaks.

However, I couldn't find a way to display the console when launching the application from within Instruments. I'm also unable to attach to a running command line process (it exits with an error):

Here's an example code:

#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 %d\n", 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: %s\n", buf);
} return(0);
}

Here's the error I got after launching Instruments, and trying to attach to the running process in 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.

Any thoughts?

asked Nov 14 '09 at 17:47

s=32&d=identicon&r=PG" alt="" style="margin:0px auto; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; height:32px">

Hugo S Ferreira

2,22031947
  add
comment

3 Answers

See this question for
your answer.

From Brad Larson therein:

Run your application from within Xcode to have the console output piped there. While your application is running, start Instruments and choose an appropriate instrument. Under Default Target in the menu bar, select iPhone or Computer (whichever is appropriate
for what you're testing), and under Attach to Process find the name of your executable.

When you click the record button, your application should start being profiled under Instruments while having its console output directed to Xcode. Unfortunately, this attachment process will need to come after the application has started, so you may have to
profile the startup of your application separately.

Edit: If that didn't work, you may just need to restart your computer. Have you done that yet?

最新文章

  1. iOS 7 与 Xamarin - MultiPeer Connectivity(转载)
  2. C#中泛型和单链表
  3. leetcode&ndash;Binary Tree Maximum Path Sum
  4. VS2013 单元测试(使用VS2013自带的单元测试)
  5. java读取远程url图片,得到宽高
  6. Mac os 进行Android开发笔记(1)
  7. Python 3.3 try catch所有的错误Error,不包括Exception。关键在于 sys.exc_info()
  8. LeetCode 380. Insert Delete GetRandom O(1) (插入删除和获得随机数 常数时间)
  9. 笔记:Spring Cloud Eureka 服务发现与消费
  10. Digilent Xilinx USB Jtag cable
  11. json相关安全问题
  12. Hive执行sql文件
  13. ODBC的JAR包和PLSQL
  14. Greenplum5.16.0 安装教程
  15. 大话+图说:Java字节码指令——只为让你懂
  16. Kafka Java API操作topic
  17. 【POJ】1026.Cipher
  18. linux下设置opencv环境变量
  19. C# 中运行exe程序
  20. 为什么是link-visited-hover-active

热门文章

  1. OpenCV 编程简单介绍(矩阵/图像/视频的基本读写操作)
  2. Base64实现android端图片上传到server端
  3. ECshop lib_base.php on line 1241 错误解决方法
  4. codeforces 459D - Pashmak and Parmida&amp;#39;s problem【离散化+处理+逆序对】
  5. WPF Media 简单的播放器
  6. Spring事务讲解示例(转)
  7. 冒泡排序算法 C++和PHP达到
  8. simple factory, factory method, abstract factory
  9. top 查看资源使用
  10. SDL 简单入门学习