kernel/debug: Adjust range marker macros.

Previously these were just using the raw function name, which led
to markers like "Slab_begin". Now we prefix RANGE_MARKER_ so there
is absolutely no chance of confusion, and the symbols are clearly
visible in dumps.

Also add a note that the kernel must be built with -fno-toplevel-reorder
for these to work. (It seems when this was implemented, GCC had not yet
implemented top-level reordering.)

They are only used for debugging with the tracing system in a handful
of places, and -ftoplevel-reorder is enabled with optimizations for
a reason, so it makes more sense just to note this and not to enable
that option by default (i.e. in the off chance someone will want to
use these in non-debug builds, like I did.)
This commit is contained in:
Augustin Cavalier 2021-08-31 22:00:36 -04:00
parent f65d15c59a
commit 0ac46a4ae9

View File

@ -91,20 +91,21 @@
// Macros for for placing marker functions. They can be used to mark the
// beginning and end of code sections (e.g. used in the slab code).
// Note that in order for these to work, the kernel must be built with -fno-toplevel-reorder.
#define RANGE_MARKER_FUNCTION(functionName) \
void functionName() {}
void RANGE_MARKER_##functionName() {}
#define RANGE_MARKER_FUNCTION_BEGIN(scope) \
RANGE_MARKER_FUNCTION(scope##_begin)
#define RANGE_MARKER_FUNCTION_END(scope) \
RANGE_MARKER_FUNCTION(scope##_end)
#define RANGE_MARKER_FUNCTION_PROTOTYPE(functionName) \
void functionName();
void RANGE_MARKER_##functionName();
#define RANGE_MARKER_FUNCTION_PROTOTYPES(scope) \
RANGE_MARKER_FUNCTION_PROTOTYPE(scope##_begin) \
RANGE_MARKER_FUNCTION_PROTOTYPE(scope##_end)
#define RANGE_MARKER_FUNCTION_ADDRESS_RANGE(scope) \
(addr_t)&scope##_begin, (addr_t)&scope##_end
(addr_t)&RANGE_MARKER_##scope##_begin, (addr_t)&RANGE_MARKER_##scope##_end
// command return value