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?

How use Instruments and display the console in Command Lines applications的更多相关文章

  1. GNS3错误’Could not start Telnet console with command 'Solar-PuTTY.exe‘

    这个报错是由于电脑中没有安装Solar-Putty导致的.直接安装一个solar-putty或者putty,然后在gns3上方工具栏点击:edit - preferences - general -c ...

  2. Batch: Display & Redirect Output

    Batch How To ... Display & Redirect Output http://www.robvanderwoude.com/battech_redirection.php ...

  3. eclipse中我要同时看两个console

    eclipse中我要同时看两个console 有一个按钮“New Console View”,可以让你再建一个Console,还有一个按钮“Display Selected Console”,可以在两 ...

  4. Eclipse多个console的使用

    我们在使用Eclipse开发服务器端和客户端时,经常需要同时运行服务器端和客户端,以便联调运行情况.而我之前一般有两种做法: 使用Java的命令行模式运行,但这种做法通常比较麻烦,因为要使用大串的cl ...

  5. eclipse中怎么删除重复的console

    eclipse中不同的应用会开启不同的console,所以并不是重复. 如图: Terminate标志/操作按钮,可以停止当前的执行,以及标志此Console是Terminated状态: Remove ...

  6. Eclipse中同时打开多个Console

    实现方法: 1.点击Open Console案例下拉三角,选择New Console View. 2.点击Pin Console按钮將两个控制台同时固定住. 3.点击Display Selected ...

  7. 华为交换机Console口属性配置

    华为交换机Console口属性配置 一.设置通过账号和密码(AAA验证)登陆Console口 进入 Console 用户界面视图 <Huawei>system-view [Huawei]u ...

  8. Eclipse控制台Console使用说明

    1.说明 本文详细介绍Eclipse控制台Console使用说明, 调试时通过控制台查看日志, 有时候日志太多会找不到上面的日志, 有时候几个控制台会不受控制的弹出, 那么请参考本文, 通过调整Ecl ...

  9. Linux下安装oracle数据库提示DISPLAY not set. Please set the DISPLAY and try again。

    错误如下: Ignoring required pre-requisite failures. Continuing... Preparing to launch Oracle Universal I ...

随机推荐

  1. HDU 4998 Rotate

    题意: n次旋转  每次平面绕ai点旋转pi弧度  问  最后状态相当于初始状态绕A点旋转P弧度  A和P是多少 思路: 如果初始X点的最后状态为X'点  则圆心一定在X和X'连线的垂直平分线上  那 ...

  2. ZooKeeper集群安装

    ZooKeeper是Apache提供的.分布式服务协调系统,应用比較广泛. 由于项目中使用Kafka MQ,而Kafka全然使用ZooKeeper实现Kafka各组件的服务协调,包含Broker.Co ...

  3. C++传递函数指针

    函数指针是一个很好的类型.因此,您可以编写一个函数,它的一个参数是一个函数指针.然后.在(外部)当函数使用的函数指针参数,来间接调用时调用相应的参数的函数的函数. 因为指针在不同的情况下能够指向不同的 ...

  4. 命令模式(CommandPattern)

    今天主要学习命令模式,java获得创意.其他屏幕教程.这里总结一下命令模式更重要. 刚开始以为命令模式是非常罕见的外观,但研究发现,他与同样单身完成.有设计模式最简单的集中模式. 象,然后其它的类直接 ...

  5. SCM文章10课时:定时器中断

    JP3遇见P0口. #include<reg51.h> #define uchar unsigned char uchar flag,num; uchar code smg[10] = { ...

  6. ExtJs迄今datefield控制设置默认值

    假设extjs4 datefield日期控件设置默认值.为当天的前一月,和后一月 Ext.Date.MONTH      月 Ext.Date.YEAR         年 Ext.Date.DAY  ...

  7. Autodesk FBX SDK Program 中文 (二)

    这是Autodesk FBX SDK学习笔记第二篇.下面部分汉字翻译自Autodesk FBX SDK Program.翻译人:有道翻译. 上一篇讲了一些FBX SDK的基本操作.创建FbxManag ...

  8. $.ajax通路RESTful Web Service一个错误:Unsupported Media Type

    最近项目,使用头版jquery ajax访问背景CXF发布时间rest维修,结果遇到了错误"Unsupported Media Type". 公布的服务java代码例如以下: im ...

  9. 返璞归真 asp.net mvc (2) - 路由(System.Web.Routing)

    原文:返璞归真 asp.net mvc (2) - 路由(System.Web.Routing) [索引页] [源码下载] 返璞归真 asp.net mvc (2) - 路由(System.Web.R ...

  10. 于win7使用虚拟磁盘隐藏文件

    于win7使用虚拟磁盘隐藏文件,我只是win7在验证.其他型号未知. 一.创建虚拟磁盘 1.右键点击"计算机"-----"管理" ------"磁盘管 ...