MySQL 8.0.39
Source Code Documentation
|
#include "my_config.h"
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <algorithm>
#include <cinttypes>
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_stacktrace.h"
#include "template_utils.h"
#include <signal.h>
#include "my_thread.h"
#include <unistd.h>
#include <execinfo.h>
#include <cxxabi.h>
Functions | |
static bool | ptr_sane (const char *p, const char *heap_end) |
void | my_init_stacktrace () |
void | my_safe_puts_stderr (const char *val, size_t max_len) |
static char * | my_demangle (const char *mangled_name, int *status) |
static bool | my_demangle_symbol (char *line) |
static void | my_demangle_symbols (char **addrs, int n) |
void | my_print_stacktrace (const uchar *stack_bottom, ulong thread_stack) |
void | my_write_core (int sig) |
size_t | my_write_stderr (const void *buf, size_t count) |
Writes up to count bytes from buffer to STDERR. More... | |
char * | my_safe_utoa (int base, ulonglong val, char *buf) |
Converts a ulonglong value to string. More... | |
char * | my_safe_itoa (int base, longlong val, char *buf) |
Async-signal-safe utility functions used by signal handler routines. More... | |
static const char * | check_longlong (const char *fmt, bool *have_longlong) |
static size_t | my_safe_vsnprintf (char *to, size_t size, const char *format, va_list ap) |
size_t | my_safe_snprintf (char *to, size_t n, const char *fmt,...) |
A (very) limited version of snprintf. More... | |
size_t | my_safe_printf_stderr (const char *fmt,...) |
A (very) limited version of snprintf, which writes the result to STDERR. More... | |
void | my_safe_print_system_time () |
Writes system time to STDERR without allocating new memory. More... | |
Variables | |
static const char | digits [] = "0123456789abcdef" |
|
static |
|
static |
|
static |
|
static |
void my_init_stacktrace | ( | ) |
void my_print_stacktrace | ( | const uchar * | stack_bottom, |
ulong | thread_stack | ||
) |
char * my_safe_itoa | ( | int | base, |
longlong | val, | ||
char * | buf | ||
) |
Async-signal-safe utility functions used by signal handler routines.
Declared here in order to unit-test them. These are not general-purpose, but tailored to the signal handling routines. Converts a longlong value to string.
base | 10 for decimal, 16 for hex values (0..9a..f) |
val | The value to convert |
buf | Assumed to point to the end of the buffer. |
void my_safe_print_system_time | ( | ) |
Writes system time to STDERR without allocating new memory.
size_t my_safe_printf_stderr | ( | const char * | fmt, |
... | |||
) |
A (very) limited version of snprintf, which writes the result to STDERR.
void my_safe_puts_stderr | ( | const char * | val, |
size_t | max_len | ||
) |
size_t my_safe_snprintf | ( | char * | to, |
size_t | n, | ||
const char * | fmt, | ||
... | |||
) |
A (very) limited version of snprintf.
to | Destination buffer. |
n | Size of destination buffer. |
fmt | printf() style format string. |
char * my_safe_utoa | ( | int | base, |
ulonglong | val, | ||
char * | buf | ||
) |
Converts a ulonglong value to string.
base | 10 for decimal, 16 for hex values (0..9a..f) |
val | The value to convert |
buf | Assumed to point to the end of the buffer. |
|
static |
void my_write_core | ( | int | sig | ) |
size_t my_write_stderr | ( | const void * | buf, |
size_t | count | ||
) |
Writes up to count bytes from buffer to STDERR.
Implemented with simplicity, and async-signal-safety in mind.
buf | Buffer containing data to be written. |
count | Number of bytes to write. |
|
inlinestatic |
|
static |