@@ -247,13 +247,30 @@ static inline void machoFile_addFunction(struct pair_funcFile function, va_list
247247 vector_pairFuncFile_push_back (& self -> functions , function );
248248}
249249
250+ /**
251+ * Compares the given @c uint64_t numbers.
252+ *
253+ * @param lhs the left hand side number
254+ * @param rhs the right hand side number
255+ * @return the comparasion result, that is, `lhs - rhs`
256+ */
250257static inline int machoFile_uint64Compare (uint64_t * lhs , uint64_t * rhs ) {
251258 if (* lhs == * rhs ) return 0 ;
252259
253260 return * lhs < * rhs ? -1 : +1 ;
254261}
255262
256- static inline bool machoFile_handleFunctionStarts (struct machoFile * self , struct linkedit_data_command * command , const void * baseAddress , bool bitsReversed ) {
263+ /**
264+ * Handles the function starts Mach-O command.
265+ *
266+ * @param self the Mach-O file abstraction structure
267+ * @param command the Mach-O data command
268+ * @param baseAddress the start address of the runtime image
269+ * @param bitsReversed whether to swap the endianess of read numbers
270+ * @return whether the parsing was successful
271+ */
272+ static inline bool machoFile_handleFunctionStarts (struct machoFile * self , struct linkedit_data_command * command ,
273+ const void * baseAddress , bool bitsReversed ) {
257274 uint32_t offset = macho_maybeSwap (32 , bitsReversed , command -> dataoff );
258275 uint32_t size = macho_maybeSwap (32 , bitsReversed , command -> datasize );
259276
@@ -267,6 +284,11 @@ static inline bool machoFile_handleFunctionStarts(struct machoFile* self, struct
267284 return true;
268285}
269286
287+ /**
288+ * Adds the function length to the functions that do not have this information.
289+ *
290+ * @param self the Mach-O file abstraction structure
291+ */
270292static inline void machoFile_fixupFunctions (struct machoFile * self ) {
271293 vector_iterate (pair_funcFile_t , & self -> functions , {
272294 if (element -> first .length != 0 ) continue ;
0 commit comments