h Home

Debugging c programs:

Debugging using User-space tools

Debugging using kernel tools

YAMD

YAMD (yet another memory debugger) Written by Nate Eldredge, the YAMD package finds dynamic, memory allocation related problems in C and C++.

Yamd is another package for trapping the boundaries of allocated blocks of memory. YAMD does this by using the paging mechanism of the processor. Read and write out-of-bound conditions are detected. The detection of the error occurs on the instruction that caused it to happen rather than later, when other accesses occur. The traps are logged with the filename and line number with trace-back information. The trace back is useful because most memory allocation is done through a limited number of routines.

The Yamd library emulates the malloc and free calls. Doing this catches many indirect malloc calls, such as those made by strdup. It also catches new and delete actions. If the new and delete operators are overloaded, however, they cannot be caught.

Yamd is like other programs of its type, needs a large amount of virtual memory or swap available to perform its magic. On an embedded system, though, this is typically not available. The earlier suggestion to use this tool on a workstation to do prototype debugging is encouraged here as well. When this debug is done, moving the application to the target can proceed with confidence that most, if not all, memory leaks have been found.

YAMD provides a script, run-yamd, that is used to make the program execute easily. It offers several options to try to recover from certain conditions. A log file can be created when the program being checked performs a core dump. A debugger can be used to debug YAMD-controlled programs. However, problems can arise using a debugger when YAMD is preloaded rather than statically linked with the program.

Using yamd


You can download yamd from here and execute a make command to build the program; then execute a make install command to install the program and set up the tool.
YAMD practice code snippets are also included there.


      We provide yamd for the educational purposes only. We do not responsiable for the correctness of its contents. the risk of using it lies entirely with the user.