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. WPF换肤之三:WPF中的WndProc

    原文:WPF换肤之三:WPF中的WndProc 在上篇文章中,我有提到过WndProc中可以处理所有经过窗体的事件,但是没有具体的来说怎么可以处理的. 其实,在WPF中,要想利用WndProc来处理所 ...

  2. 设备Oracle当误差:环境不符合要求》》解决方法

    一旦安装Oracle当我常常会遇到这样的问题.也没太在意,改了一下client\stage\cvu文件夹cvu_prereq.xml档(添加支持目前的操作系统信息)为了克服,我没有做笔记,但后来有同学 ...

  3. HDU 3036 Escape 网格图多人逃生 网络流||二分匹配 建图技巧

    题意: 每一个' . '有一个姑娘, E是出口,'.'是空地 , 'X' 是墙. 每秒钟每一个姑娘能够走一步(上下左右) 每秒钟每一个出口仅仅能出去一个人 给定n*m的地图, 时限T 问全部姑娘是否能 ...

  4. 编译联想A820内核源码

    编译平台:Fedora 20 x64 交叉编译工具链:arm-linux-androideabi-4.6 话说这个编译工具我研究了两天,Fedora自带一个arm-none-eabi的ToolChai ...

  5. CSS+DIV+HTML(一)--HTML总结

    一.定义 HTML(Hyper Text Markup Language),标记语言. 二.主要内容: HTML元素分为三类:块级标签.内联标签.可变标签.差别在于: 块级元素:在默认情况下会换行显示 ...

  6. J2SE习题(2)

    第四.五周练习题 1.a. Define a class called BlogEntry that could be used to store an entry for a  Weblog. Th ...

  7. MySql模糊查询like通配符简介

    %代表随意多个字符  _代表一个字符 在 MySQL中.SQL的模式缺省是忽略大写和小写的 正则模式使用REGEXP和NOT REGEXP操作符. "."匹配不论什么单个的字符.一 ...

  8. B. Dreamoon and WiFi(Codeforces Round 272)

    B. Dreamoon and WiFi time limit per test 1 second memory limit per test 256 megabytes input standard ...

  9. JSP-简单的练习省略显示长字符串

    <%@ page contentType="text/html; charset=gb2312" %> <!-- JSP指令标签 --> <%@ pa ...

  10. 【v2.x OGE课程 14】 控制使用

    在这里,精灵.动画精灵.button天才.经常使用的文本的使用 一个.相关精灵 1.加入精灵 //创建精灵 Sprite bar_up = new Sprite(400, 0, RegionRes.g ...