Skip to content

Commit

Permalink
info: add a query kind to check if a stack overflow check is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
shintaro-iwasaki committed Jan 27, 2021
1 parent 8f97586 commit eac3fd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/abt.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@ enum ABT_info_query_kind {
ABT_INFO_QUERY_KIND_DYNAMIC_PROMOTION,
/** Whether the stack unwinding feature is enabled or not */
ABT_INFO_QUERY_KIND_ENABLED_STACK_UNWIND,
/** Whether the stack overflow check is enabled or not */
ABT_INFO_QUERY_KIND_ENABLED_STACK_OVERFLOW_CHECK,
};

/**
Expand Down
12 changes: 12 additions & 0 deletions src/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ static void info_trigger_print_all_thread_stacks(
* to \c ABT_TRUE if Argobots is configured to enable the stack unwinding
* feature. Otherwise, \c val is set to \c ABT_FALSE.
*
* - \c ABT_INFO_QUERY_KIND_ENABLED_STACK_OVERFLOW_CHECK
*
* \c val must be a pointer to a variable of type \c int. \c val is set to 1
* if Argobots is configured to use a stack canary to check stack overflow.
* Otherwise, \c val is set to 0.
*
* @changev20
* \DOC_DESC_V1X_RETURN_INFO_IF_POSSIBLE
* @endchangev20
Expand Down Expand Up @@ -335,6 +341,12 @@ int ABT_info_query_config(ABT_info_query_kind query_kind, void *val)
*((ABT_bool *)val) = ABT_FALSE;
#endif
break;
case ABT_INFO_QUERY_KIND_ENABLED_STACK_OVERFLOW_CHECK:
#if ABT_CONFIG_STACK_CHECK_TYPE == ABTI_STACK_CHECK_TYPE_CANARY
*((int *)val) = 1;
#else
*((int *)val) = 0;
#endif
default:
ABTI_HANDLE_ERROR(ABT_ERR_INV_QUERY_KIND);
break;
Expand Down

0 comments on commit eac3fd9

Please sign in to comment.