Skip to content

Commit e3b87cc

Browse files
committed
Documented the C implementation of the ELF file handling
1 parent 901330b commit e3b87cc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/parser/file/elf/cpp_optimized/elfFile.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@
2828

2929
#include "../../dwarf/vector_dwarf_lineInfo.h"
3030

31+
/**
32+
* This structure represents the private part of the ELF file structure.
33+
*/
3134
struct elfFile_private {
35+
/** The super part of this structure. */
3236
struct elfFile _;
3337

38+
/** The registered functions. */
3439
vector_function_t functions;
40+
/** The registered line information pieces. */
3541
vector_dwarfLineInfo_t lineInfos;
3642
};
3743

@@ -53,12 +59,27 @@ void elfFile_addFunction(struct elfFile* me, struct function f) {
5359
vector_function_push_back(&self->functions, f);
5460
}
5561

62+
/**
63+
* @brief The callback for the DWARF parser.
64+
*
65+
* Stores the given DWARF line table row.
66+
*
67+
* @param info the deducted DWARF line table row
68+
* @param args the payload, expected to be a private elf file structure object
69+
*/
5670
static inline void elfFile_lineProgramCallback(struct dwarf_lineInfo info, void* args) {
5771
struct elfFile_private* self = args;
5872

5973
vector_dwarfLineInfo_push_back(&self->lineInfos, info);
6074
}
6175

76+
/**
77+
* Actually parses the given file buffer.
78+
*
79+
* @param self the private elf file structure object
80+
* @param buffer the buffer to be parsed
81+
* @return whether the parsing was successful
82+
*/
6283
static inline bool elfFile_loadFileImpl(struct elfFile_private* self, void* buffer) {
6384
return elfFile_parseFile(&self->_, buffer, elfFile_lineProgramCallback, self);
6485
}

0 commit comments

Comments
 (0)