现在的位置: 首页 > 综合 > 正文

unix/linux 环境软件调试笔记

2012年03月28日 ⁄ 综合 ⁄ 共 1868字 ⁄ 字号 评论关闭

员工培训 ppt 内容

 

 

静态代码跟踪

正则表达式简介
函数定义
find . "*.h"
查找函数声明 ^\sclass::function\(

使用“在文件中查找”功能
find . -name
转到某一行

括号匹配

代码分析:

1、代码折叠
2、变量查找与替换 左值和右值
3、代码比较

ulteredit
其它的工具;
editplus:
优点: 1、可以免费使用 2、ftp 打开、保存文件快
缺点: 1、ftp 功能对某些 unix 系统支持不好。
       2、不支持函数列表功能。
source inside
优点:支持函数跳转
缺点:查找速度极慢

程序调试:

常用的 shell命令

ps 命令
ps -ef |grep

正则表达式简介

 

 

 

代码跟踪

grep 命令

使用示例:

 

find 命令

nm 命令

使用示例:

ld: 0711-317 ERROR: Undefined symbol: .CInvoice::disposeInvoice(int*,const TAcctFund*,int,int,long,int,int)
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
Stop.

 

/lntest/src/bill$find . -name "*.o" -exec nm -u -O -X 64 {} \; | grep disposeInvoice
nm: ./Acctant/gactantpar.o: 0654-203 Specify an XCOFF object module.
nm: ./Acctant/mactantcmt.o: 0654-203 Specify an XCOFF object module.
nm: ./Acctant/matantbcmt.o: 0654-203 Specify an XCOFF object module.
nm: ./Acctant/mgetactant.o: 0654-203 Specify an XCOFF object module.
./Pay/CBillBase.o: .CInvoice::disposeInvoice(int*,const TAcctFund*,int,int,long,int,int) U           -
./Pay/CBillNewFund.o: .CInvoice::disposeInvoice(int*,const TAcctFund*,int,int,long,int,int) U           -
./Pay/mechannelprt.o: .CInvoice::disposeInvoice(int*,const TAcctFund*,int,int,long,int) U           -
./Pay/mdrawcmt.o: .CInvoice::disposeInvoice(int*,const TAcctFund*,int,int,long,int,int) U           -
./Pay/mprninv.o: .CInvoice::disposeInvoice(int*,const TAcctFund*,int,int,long,int,int) U           -
nm: ./common/DynLib.o: 0654-203 Specify an XCOFF object module.
nm: ./common/PtrArray_t.o: 0654-203 Specify an XCOFF object module.
nm: ./common/Thread.o: 0654-203 Specify an XCOFF object module.
/lntest/src/bill$

ar 命令

环境查看

env

ipcs/ipcrm

ps - report a snapshot of the current processes.

常用命令

grep -n "texttofind" */*.cpp

find . -name "*.cpp" -exec grep  -l "texttofind" {} \;

find . -name "*.cpp" -exec grep  -n "texttofind" {} \;

-l 打印所在行

-n 打印文件名

查看目标文件中所有未定义的符号

 find . -name "*.o" -exec nm -u -O -X 64 {} \;

-O 表示打印文件名

-X 指明是 64bit 的目标文件

 

ulimit -c 1024

dbx filename core

stopi

catch

 

正则表达式

 

 静态调试

 

编译器宏

__FILE__ 

__LINE__

-g

-DDEBUG

 

参考资料:

     1  正则表达式教程

      2 proc sql

 

 

 

 

抱歉!评论已关闭.