/* For bsearch. We try to unwind functions in shared object. */ #include <stdlib.h>
/* * The test will assert frames are on the stack but tail call optimizations lose * the frame of the caller. Clang can disable this optimization on a called * function but GCC currently (11/2020) lacks this attribute. The barrier is * used to inhibit tail calls in these cases.
*/ #ifdef __has_attribute #if __has_attribute(disable_tail_calls) #define NO_TAIL_CALL_ATTRIBUTE __attribute__((disable_tail_calls)) #define NO_TAIL_CALL_BARRIER #endif #endif #ifndef NO_TAIL_CALL_ATTRIBUTE #define NO_TAIL_CALL_ATTRIBUTE #define NO_TAIL_CALL_BARRIER __asm__ __volatile__("" : : : "memory"); #endif
/* * We need to keep these functions global, despite the * fact that they are used only locally in this object, * in order to keep them around even if the binary is * stripped. If they are gone, the unwind check for * symbol fails.
*/ int test_dwarf_unwind__thread(struct thread *thread); int test_dwarf_unwind__compare(void *p1, void *p2); int test_dwarf_unwind__krava_3(struct thread *thread); int test_dwarf_unwind__krava_2(struct thread *thread); int test_dwarf_unwind__krava_1(struct thread *thread); int test__dwarf_unwind(struct test_suite *test, int subtest);
NO_TAIL_CALL_ATTRIBUTE noinline int test_dwarf_unwind__compare(void *p1, void *p2)
{ /* Any possible value should be 'thread' */ struct thread *thread = *(struct thread **)p1;
if (global_unwind_retval == -INT_MAX) { /* Call unwinder twice for both callchain orders. */
callchain_param.order = ORDER_CALLER;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.