Clang static code analyzer (memory debug tool based on llvm)

View previous topic View next topic Go down

Clang static code analyzer (memory debug tool based on llvm)

Post  autology on Thu Mar 12, 2009 10:34 pm

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

autology

Posts : 22
Join date : 2008-12-29

View user profile

Back to top Go down

Re: Clang static code analyzer (memory debug tool based on llvm)

Post  sio2interactive on Fri Mar 13, 2009 12:28 am

tks for sharing i'll give it a try... I never heard of this tool before... cheers!

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum