Tools for testing and debugging memory issues (part 2)
Clang-14 and debugging symbols
When compiling by hand, you'd include
-g to have the compiler write debugging symbols. This is what
is shown in some of the videos presented in this lesson. For
the version of
clang++ that we're using (v. 14.0.5),
DWARFv5 debug format is used by default.
Unfortunately,some of our tools will not properly read the
DWARF5 generated by
clang-14. Therefore, instead of using the
-g flag, use
--leak-check=fullto show each leak in detail, and
valgrindtrack the origin of undefined values. For line-by-line details about what went wrong, you need to tell
clang++to write the executable with debugging symbols, which you can do by providing the compiler the
Answer the following questions with consideration to the material introduced in both Parts 1 and 2 of this lesson.