CScout on FreeBSD
This page is open for sharing improvement ideas, tips, tasks, and bugs regarding the application of the CScout refactoring browser on the FreeBSD source code.
1. Ideas for Improvements
These are some ideas for CScout improvements that could help FreeBSD development.
- Track global variable assignments. Use this feature to verify the errno values listed in the section 2 of the manual against the implementation of the actual system calls.
2. Tasks
Here are some tasks open for interested developers.
- Use CScout to locate problematic code areas (for example unused or too liberaly visible objects).
- Use CScout to globaly rename identifiers in a more consistent fashion.
- Apply CScout to the userland code.
- Identify CScout extensions that would help us improve the quality of our code.
- Arrange for the continous availability of a live CScout kernel session on the current version of the source code.
3. Bugs
- Identifiers appearing on function prototypes are listed as unused. This creates noise in the corresponding query.
4. Tips
4.1. Processing the Kernel Source Code
- Create the toolchain for all Tier-1 architectures
for a in amd64 i386 sparc64 do export MAKEOBJDIRPREFIX=/home/dds/src/fbsd-head/obj/$a make buildworld TARGET_ARCH=$a 2>make.world.$a.err >make.world.$a.out done
- Modify Makefile.inc1
sed -ie '/^TMPPATH/s/.*/TMPPATH= ${CSCOUT_SPY_TMPDIR}:${STRICTTMPPATH}:${PATH}/' Makefile.inc1
- Build the kernel
for a in amd64 i386 sparc64 do ( cd sys/$a/conf/ make LINT # To avoid ../../../gnu/fs/xfs/xfs_bit.h:42:5: # "XFS_WANT_FUNCS" is not defined during compilation sed '/XFS/d' LINT >CSCOUT config CSCOUT ) export MAKEOBJDIRPREFIX=/home/dds/src/fbsd-head/obj/$a spy-make buildkernel TARGET_ARCH=$a KERNCONF=CSCOUT 2>make.kernel.$a.err >make.kernel.$a.out mv make.cs make.$a.cs done
- Merge the results
cat make.*.cs >all.cs
- Run CScout
nice cscout all.cs