免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4205 | 回复: 7
打印 上一主题 下一主题

[故障求助] 急!!!!!!!!AIX下怎么跟踪调用函数栈!? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-18 11:09 |只看该作者 |倒序浏览
大家帮帮忙,AIX下有没有类似Linux下backtrace函数,可以跟踪出函数调用栈的函数!?

论坛徽章:
0
2 [报告]
发表于 2008-04-18 17:40 |只看该作者

mt__trce即可。

mt__trce(output_fd, 0, NULL, 0);

论坛徽章:
0
3 [报告]
发表于 2008-04-18 20:31 |只看该作者
谢谢Charlemagne ,但是mt__trce在哪个头文件定义?

论坛徽章:
0
4 [报告]
发表于 2008-05-20 12:25 |只看该作者

回复 #3 hugbee 的帖子

mt__trce Subroutine

Purpose
Dumps traceback information into a lightweight core file.

Library
PTools Library (libptools_ptr.a)

Syntax

void mt__trce (int  FileDescriptor, int Signal, struct sigcontext *Context, int Node);

Here is an example fyi...
#cat test.c
//xlc test.c -lptools_ptr
#include <stdio.h>

int testfun1(int* i)
{
   
    mt__trce(2, 0, NULL, 0);
    return (*i)++;
}

int testfun(int* i)
{
    (*i)++;
    return testfun1(i);
}

int main(int argc, char* argv)
{
   int a = 1;
   return testfun(&a);
}   

#xlc test.c -lptools_ptr
[root@test170b:/tmp]#./a.out
+++PARALLEL TOOLS CONSORTIUM LIGHTWEIGHT COREFILE FORMAT version 1.0
+++LCB 1.0 Mon Apr 28 17:41:05 2008 Generated by IBM AIX 5.3
#
+++ID Node 0 Process 2207826 Thread 1
+++STACK
testfun1 : 0x00000020
testfun : 0x00000024
main : 0x00000020
---STACK
---ID Node 0 Process 2207826 Thread 1
---LCB

论坛徽章:
0
5 [报告]
发表于 2008-05-31 12:42 |只看该作者

truss -o /tmp/a -o PID

如题

论坛徽章:
0
6 [报告]
发表于 2008-05-31 13:46 |只看该作者
truss -o /tmp/a -p PID

论坛徽章:
0
7 [报告]
发表于 2008-05-31 13:47 |只看该作者
不过这个命令只能跟踪系统call

论坛徽章:
0
8 [报告]
发表于 2008-05-31 23:57 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP