@@ -29,23 +29,73 @@ extern "C" {
2929#include <stddef.h>
3030#include <stdint.h>
3131
32+ /**
33+ * @brief Defines a memory region.
34+ *
35+ * Contains the beginning and ending pointers as well as the name of the binary
36+ * file to which the memory region belongs to.
37+ */
3238struct region {
33- uintptr_t begin , end ;
39+ /** The beginning of the memory region. */
40+ uintptr_t begin ,
41+ /** The end of the memory region. */
42+ end ;
3443
35- const char * name , * nameRelative ;
44+ /** The raw name of the binary file. */
45+ const char * name ,
46+ /** The relative name of the binary file. */
47+ * nameRelative ;
3648};
3749
50+ /**
51+ * Defines an array of multiple region information.
52+ */
3853struct regionInfo {
54+ /** The array of memory region structures. */
3955 struct region * regions ;
56+ /** The amount of memory region structures in the array. */
4057 size_t amount ;
4158};
4259
60+ /**
61+ * @brief Returns an array containing the memory region information structures
62+ * of all currently loaded runtime images.
63+ *
64+ * These memory regions represent the locations global storage is possibly
65+ * found in.<br>
66+ * The returned array must be destructed after use with the function
67+ * @code regions_destroyInfo(const struct regionInfo* info)@endcode.
68+ * <br><br>
69+ * According to @c callstack_autoClearCaches cache pointers are used.
70+ *
71+ * @return an array with global storage regions
72+ */
4373struct regionInfo regions_getLoadedRegions (void );
4474
45- // Important: Gets the TLS (and potentially initializes them) for the calling
46- // thread. Cares for callstack_autoClearCaches.
75+ /**
76+ * @brief Returns an array containing the thread-local memory region
77+ * information structures of all currently loaded runtime images.
78+ *
79+ * They represent the locations thread-local storage is found in for the
80+ * calling thread.<br>
81+ * The returned array must be destructed after use with the function
82+ * @code regions_destroyInfo(const struct regionInfo* info)@endcode.
83+ * <br><br>
84+ * According to @c callstack_autoClearCaches cache pointers are used.
85+ *
86+ * @note Since thread-local storage is generally initialized on demand, calling
87+ * this function may result in initializing all thread-local variables for the
88+ * calling thread.
89+ *
90+ * @return an array with thread-local storage memory regions
91+ */
4792struct regionInfo regions_getTLSRegions (void );
4893
94+ /**
95+ * Destructs the given region information.
96+ *
97+ * @param info the region information to be destructed
98+ */
4999void regions_destroyInfo (const struct regionInfo * info );
50100
51101#ifdef __cplusplus
0 commit comments