MySQL 9.1.0
Source Code Documentation
check_stack.cc File Reference
#include "sql/check_stack.h"
#include "my_config.h"
#include <assert.h>
#include <stdio.h>
#include <algorithm>
#include <atomic>
#include <new>
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sys.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/current_thd.h"
#include "sql/derror.h"
#include "sql/sql_class.h"

Namespaces

namespace  anonymous_namespace{check_stack.cc}
 

Functions

NO_INLINE int stack_direction_f (int *a)
 
NO_INLINE int initialize_stack_direction ()
 
long anonymous_namespace{check_stack.cc}::used_stack (const char *a_ptr, const char *b_ptr)
 
bool check_stack_overrun (const THD *thd, long margin, unsigned char *buf)
 Check stack for a overrun. More...
 

Variables

int anonymous_namespace{check_stack.cc}::stack_direction = 0
 
int(* ptr_f )(int *) = stack_direction_f
 
std::atomic< long > max_stack_used
 

Function Documentation

◆ check_stack_overrun()

bool check_stack_overrun ( const THD thd,
long  margin,
unsigned char *  buf 
)

Check stack for a overrun.

Parameters
thdThread handler.
marginMinimal acceptable unused space in the stack.
bufSee a note below.
Returns
false if success, true if error (reported).
Note
Note: The 'buf' parameter is necessary, and we must have code which uses it.
  • Some of the fix_fields functions have a "dummy" buffer large enough for the corresponding execution. (Thus we only have to check in fix_fields.)
  • Passing the buffer to check_stack_overrun() prevents the compiler from removing it.
  • For -flto builds, the dummy buffer may be optimized away, so we need to write something into it.

◆ initialize_stack_direction()

NO_INLINE int initialize_stack_direction ( )

◆ stack_direction_f()

NO_INLINE int stack_direction_f ( int *  a)

Variable Documentation

◆ max_stack_used

std::atomic<long> max_stack_used

◆ ptr_f

int(* ptr_f) (int *) ( int *  ) = stack_direction_f