Tools
How to see help of internal command of CVS
Nov 7th
The –help option followed by CVS internal commands like checkout, checkin, tag etc can be used to get the help for a specific command. The following example shows how to see help for tag command.
[neo@techpulp ~]# cvs --help tag
Usage: cvs tag [-bcdFflR] [-r rev|-D date] tag [files...]
-b Make the tag a "branch" tag, allowing concurrent development.
-B Allows -F and -d to disturb branch tags. Use with extreme care.
-c Check that working files are unmodified.
-d Delete the given tag.
-F Move tag if it already exists.
-f Force a head revision match if tag/date not found.
-l Local More > How to create a CVS branch
Nov 7th
A branch tag is very much different from a normal tag. A normal tag can be just used to tag a particular version of sources and retrieve the exact version later. No independent development can happen based on a normal tag. However a branch tag creates a virtual branch in CVS repository sources and facilitates parallel development to happen on that branch. There is no limit on number of branches.
For example, if you plan to work on two releases of same project, you would want to create a branch for each release and work on them separately.
The creation of a More >
How to move a CVS tag
Nov 7th
Moving an existing tag is needed if some files are forgotten to be checked in before tagging the sources. In such cases, the remaining files can be checked in and then tag the sources with -F option.
CVS doesn’t allow duplicate tags to be present in the repository. You can either chose a different tag name or chose to move the existing tag if same tag name has to be used. However this is applicable for normal tags and not for branch tags. The following example tags the sources with a tag called my-release-tag-1. This moves the tag to latest sources if More >
How to remove a CVS tag
Nov 7th
An existing CVS tag can be removed by using -d option with cvs tag command. However a branch tag can’t be remove from the CVS repository. The following example removes a tag called my-release-tag-1.
[neo@techpulp ~]# cvs tag -d my-release-tag-1 [neo@techpulp ~]#
How to clean multiple sub-directories in Makefile
Oct 23rd
The following example assumes that all sub-directories are listed in $(SUBDIRS) variable. All the entries in $(SUBDIRS) can be iterated using a “for” loop as shown below and “make clean” can be run in each directory.
SUBDIRS = dir1 dir2 dir3 clean: for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
Note that if you doing are copy-n-paste of the above snippet, the “for” statement should be indented with a TAB. Otherwise it will result in make error.
In the above example “clean” rule can be replaced with any other rule.
The -C option tells GNU make to change to a specific directory before reading the More >
Script to delete CVS or SVN directories recursively for source code packaging
Sep 22nd
It is required to remove directories created by source code version control systems like CVS and SVN before releasing the source code. This can be done using the following command at the bash shell.
- Move to top level directory of your project sources
- Run the following commands
bash# find . -iname CVS -type d | xargs rm -rf bash# find . -iname .svn -type d | xargs rm -rf
Quick guide to profile C/C++ source code with gprof
Sep 22nd
This article is just a quick reference for profiing C/C++ source code using gprof. C/C++ source code can be profiled using gprof in three steps.
- Compile the sources and link the program with profiling options “-pg”
bash# gcc -pg -g -c source1.c source2.c bash# gcc -pg -o myapp source1.o source2.o
- Execute the program to generate profiling output in gmon.out
bash# ./myapp
- Analyze the profiling output with gprof. It prints the list of functions which have taken more time during the execution of process. This list is in descending order so probably you would want to start optimizing the code in the same order.The output also More >
Stack of a Running Process in Unix/Linux
Jul 26th
The command pstack can be used to view the stack trace of a running process.
Let us select a running process.
[neo@techpulp ~]# ps -e | grep konqueror 22937 pts/5 00:00:17 konqueror
Run pstack command with PID of the process.
[neo@techpulp ~]# pstack 22937 22937: konqueror (No symbols found) 0x001fb402: ???? (89c6ed8, 2, bfa39b08, 3812df0, 89c6ed8, 3c21362) 0x0325074b: ???? (89c6ed8, 8a00908) 0x03250656: ???? (89c6ed8, 3c372ec) 0x03237a59: ???? (bfa39c20, bfa39d48, bfa39de8, bfa39d1c, 0, bfa39fb4) + 4c0 0x03bb1d0d: ???? (1, bfa3a094, bfa3a09c, 0, bfa3a094, 1) + 40 0x00248de6: ???? (80485ec, 1, bfa3a094, 8048600, 8048650, 21ff2d) + 405c5f78 [neo@techpulp ~]#
There is an alternate way to use gdb and attach More >


Recent Comments