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. EF 执行视图

    IEnumerable<V_stocks> summary = db.Database.SqlQuery<V_stocks>("SELECT * FROM dbo.V ...

  2. 使用VBA将批量的WORD文档转换为PDF

    Sub BatchConvertToPDF() Dim destFolderPath As String destFolderPath = GetFolderPath If destFolderPat ...

  3. 哈希表之bkdrhash算法解析及扩展

    BKDRHASH是一种字符哈希算法,像BKDRHash,APHash.DJBHash,JSHash,RSHash.SDBMHash.PJWHash.ELFHash等等,这些都是比較经典的,通过http ...

  4. Apple Watch视频教程(连载)

    发展Apple Watch 必须Xcode 6.2上述号码,所有视频.课件.Demo须要的能够加我私人微信 wanghj29(扫描头像也能够),在微信里面给我发email,我都发过去,另外也提供在线播 ...

  5. android LinearLayout等view如何获取button效果

    我们可以给LinearLayout以及一切继承自View的控件,设置View.onClickListener监听,例如LInearLayout. 但是我们发现LinearLayout可以执行监听方法体 ...

  6. JNDI 什么

    JNDI是 Java 命名与文件夹接口(Java Naming and Directory Interface).在J2EE规范中是重要的规范之中的一个,不少专家觉得,没有透彻理解JNDI的意义和作用 ...

  7. 我的学习笔记_Windows_HOOK计划 2009-12-03 11:19

    一.什么是HOOK? "hook"这个单词的意思是"钩子","Windows Hook"是Windows消息处理机制的一个重要扩展,程序猿能 ...

  8. 移植 libuv 至 Visual C++ 6.0 并支持 Windows XP 编译系统

    移植版本 libuv:https://github.com/liigo/libuv-vc6 (支持VC6和XP.作者Liigo). 我从一年前(大概2013年6,7月份)開始在业余时间做这项移植工作, ...

  9. 【HTML+CSS】(1)基本语法

    HTML基金会 <em>他强调标签,<strong>加粗标签 <q>短文本引用.<blockquote>长文本引用,这两个标签会让文字带双引號.   空 ...

  10. CentOS下tmux安装与使用

    tmux介绍: tmux它是BSDScreen替代品,相对于Screen,它更加先进:支持屏幕切分,并且具备丰富的命令行參数,使其能够灵活.动态的进行各种布局和操作.它能够做到一条命令就启动起来(强大 ...