Clang static code analyzer (memory debug tool based on llvm)
2 posters
Clang static code analyzer (memory debug tool based on llvm)
All,
Not sure how useful this may be, but it was something I stumbled on that helped me out with general bug finding and code validation. This may be something common place amongst the seasoned developers, but it was new to me. (idea from http://sites.google.com/a/superarts.org/studio/中文首页/科技热点/iphone/the-bunnys-iphonedev-faq)
Using Clang Static analyzer (osx binaries built here: http://clang.llvm.org/StaticAnalysisUsage.html )
1. Download the most recent build and extract to a given folder( ex: ~/scanbuild )
2. cd into your project directory ( ex: ~/sio2game )
3. remove the build directory ( rm -rf build )
4. execute the following:( ~/scanbuild/scan-build -k -V xcodebuild )
5. Clang will execute, compiling coding and running a static analysis (evaluating all paths) on the codebase. When complete, an html-based report is generated listing errors - divide by zero, memory leak, retain/copy issues, etc. Beside each error is a link to the piece of code responsible with direct annotation and description on the variables in question.
Process took me ~ 10 minutes on my MBA to compile 1.3.1 and allowed me to find the extra retains that were screwing things up.
YMMV but hope it helps
Not sure how useful this may be, but it was something I stumbled on that helped me out with general bug finding and code validation. This may be something common place amongst the seasoned developers, but it was new to me. (idea from http://sites.google.com/a/superarts.org/studio/中文首页/科技热点/iphone/the-bunnys-iphonedev-faq)
Using Clang Static analyzer (osx binaries built here: http://clang.llvm.org/StaticAnalysisUsage.html )
1. Download the most recent build and extract to a given folder( ex: ~/scanbuild )
2. cd into your project directory ( ex: ~/sio2game )
3. remove the build directory ( rm -rf build )
4. execute the following:( ~/scanbuild/scan-build -k -V xcodebuild )
5. Clang will execute, compiling coding and running a static analysis (evaluating all paths) on the codebase. When complete, an html-based report is generated listing errors - divide by zero, memory leak, retain/copy issues, etc. Beside each error is a link to the piece of code responsible with direct annotation and description on the variables in question.
Process took me ~ 10 minutes on my MBA to compile 1.3.1 and allowed me to find the extra retains that were screwing things up.
YMMV but hope it helps
autology- Posts : 22
Join date : 2008-12-29
Re: Clang static code analyzer (memory debug tool based on llvm)
tks for sharing i'll give it a try... I never heard of this tool before... cheers!
Similar topics
» Enabling Bullet Debug Draw (Code included)
» gcc-4.2 failed with exit code 1 library not found for -lstdc++-static
» can't debug and run tutorial06 on device BAD_ERR_ACCESS
» Physics-based picking
» Gun or cannon? Actual projectile or ray based?
» gcc-4.2 failed with exit code 1 library not found for -lstdc++-static
» can't debug and run tutorial06 on device BAD_ERR_ACCESS
» Physics-based picking
» Gun or cannon? Actual projectile or ray based?
Permissions in this forum:
You cannot reply to topics in this forum