add_subdirectory(3rdparty)
add_subdirectory(tests)
-add_library(libheaptrack SHARED heaptrack.cpp)
+add_library(libheaptrack SHARED libheaptrack.cpp)
set_target_properties(libheaptrack
PROPERTIES OUTPUT_NAME heaptrack)
target_link_libraries(libheaptrack ${CMAKE_DL_LIBS} backtrace)
-add_executable(heaptrack_eval heaptrack_main.cpp)
-target_link_libraries(heaptrack_eval ${Boost_LIBRARIES})
-
add_executable(heaptrack_interpret heaptrack_interpret.cpp)
target_link_libraries(heaptrack_interpret backtrace)
+add_executable(heaptrack_print heaptrack_print.cpp)
+target_link_libraries(heaptrack_print ${Boost_LIBRARIES})
+
# TODO: support running from an installed location
-# install(TARGETS libheaptrack heaptrack_eval heaptrack_interpret
+# install(TARGETS libheaptrack heaptrack_interpret heaptrack_print
# RUNTIME DESTINATION bin
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/**
+ * @file heaptrack_interpret.cpp
+ *
+ * @brief Interpret raw heaptrack data and add Dwarf based debug information.
+ */
+
#include <iostream>
#include <sstream>
#include <unordered_map>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/**
+ * @file heaptrack_print.cpp
+ *
+ * @brief Evaluate and print the collected heaptrack data.
+ */
+
#include <iostream>
#include <fstream>
#include <sstream>
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+/**
+ * @file libheaptrack.cpp
+ *
+ * @brief Collect raw heaptrack data by overloading heap allocation functions.
+ */
+
#include <cstdio>
#include <cstdlib>
#define UNW_LOCAL_ONLY
#include <libunwind.h>
+/**
+ * @brief A libunwind based backtrace.
+ */
struct Trace
{
using ip_t = void*;
#ifndef TRACETREE_H
#define TRACETREE_H
+/**
+ * @file tracetree.h
+ * @brief Efficiently combine and store the data of multiple Traces.
+ */
+
#include <vector>
#include <algorithm>
{
public:
/**
- * Index the backtrace and return the index of the last instruction pointer.
+ * Index the data in @p trace and return the index of the last instruction pointer.
+ *
+ * Unknown instruction pointers will be printed to @p out.
*/
std::size_t index(const Trace& trace, FILE* out)
{