Short_description
Developing:
- automake >= 1.16.5
- autoconf >= 2.71.0
- pkg-config >= 1.8.0
- clang-format >= 14.0.6
Testing dependencies:
- cmocka >= 1.1.5
Code coverage:
- lcov >= 1.14.0
Debugging:
- gdb >= 10.1.90.20210103-git
- valgrind >= 3.18.1
Run the following set of instructions:
autoreconf --install
./configure
make
make check
make install
sudo ldconfig
Run make uninstall
.
Run make start
.
- include: header files.
- m4: m4 files.
- src: source files.
- tests: test files.
The following instruction shows all dependencies to be added to configure.ac
.
autoscan # Used to generate a preliminary configure.ac
Run make lint
.
Valgrind checks for memory leaks and other troubles
in C. You can enable valgrind in the project with
./configure --enable-valgrind
. There are predefined rules to run valgrind in
execution, i.e., make start-valgrind
or tests, i.e., make check-valgrind
.
Results are outputed in the tests
folder.
For general debugging set the configuration of the project (more info):
./configure CPPFLAGS=-DDEBUG CFLAGS="-g -O0"
run the debugger more info:
./libtool --mode=execute gdb src/my_program
NOTE: Shared libraries are not initially loaded and the breakpoint has to be set as pending before running my_program
- 'watch ' to watch a variable and be notified about changes.
- 'step' to change continue until the next instruction.
- 'fin' to finish the actua function and see the retun value.
- 'info args/locals' gives information about agurments or locals.
- 'where' prints stack frames.
- 'list [start_line,end_line]' shows 10 lines of code centered around the current line.
- 'run' executes my_program, accepting args as space separated values.
- 'break' sets a breakpoint.
- 'continue' continues the execution.
- 'print ' prints the variable.
To quickly check for a bug, commands can be written as aguments such as:
./libtool --mode=execute gdb \
-ex 'break -source file.c -function foo if bar > 10' \
-ex 'run' \
-ex 'info args' \
-ex 'info locals' \
-ex 'where' \
-ex 'list' \
src/my_program
Run make check
.
Generates a folder containing the summary of the code coverage of the project.
It is recommended to clean project object files with git clean -xdf
before and
after generating the code coverage report. This is due to the compiler options
to optimize code; code coverage requires no optimization.
make coverage
Generates a tar file ready to distribute.
./configure --enable-valgrind=no # Enabled by default.
make dist