2525
2626#include " ../../loader.h"
2727
28+ /* *
29+ * This class represents an ELF file.
30+ */
2831class ElfFile {
32+ /* * The shared part of the ELF file abstraction. */
2933 elfFile self;
3034
35+ /* * Mapping the address to its appropriate line table entry. */
3136 std::map<uint64_t , dwarf_lineInfo, std::greater<uint64_t >> lineInfos;
37+ /* * Mapping the address to its appropriate function. */
3238 std::map<uint64_t , function, std::greater<uint64_t >> functions;
3339
3440public:
@@ -47,6 +53,14 @@ class ElfFile {
4753 }
4854 }
4955
56+ /* *
57+ * @brief Adds the given function object.
58+ *
59+ * If a function object with the same address exists, the given function is
60+ * discarded.
61+ *
62+ * @param f the function object to be added
63+ */
5064 inline void addFunction (const function& f) {
5165 if (functions.find (f.startAddress ) == functions.end ()) {
5266 functions.emplace (std::make_pair (f.startAddress , f));
@@ -55,6 +69,11 @@ class ElfFile {
5569 }
5670 }
5771
72+ /* *
73+ * Loads and parses the represented binary file.
74+ *
75+ * @return whether the loading and parsing was successful
76+ */
5877 inline auto loadFile () -> bool {
5978 return loader_loadFileAndExecute (self._ .fileName , {
6079 .parseFunc = [](auto arg, auto buffer) {
@@ -73,6 +92,12 @@ class ElfFile {
7392 }, false , this );
7493 }
7594
95+ /* *
96+ * Retrieves the debug information available for the given address.
97+ *
98+ * @param address the address to find debug information for
99+ * @return the optionally found debug information
100+ */
76101 inline auto getDebugInfo (void * address) -> optional_debugInfo_t {
77102 optional_debugInfo_t info;
78103 info.has_value = false ;
0 commit comments