mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Remove debug_shared
The last remnant of the old debug system, this was only used in show_stackframe. Because that's only ever called with an "E" level currently I've removed the level argument entirely. If it's needed we'd have to pass a flog category here.
This commit is contained in:
parent
98bf01568d
commit
89996c0c8a
|
@ -95,8 +95,6 @@ const wchar_t *program_name;
|
|||
/// This is set during startup and not modified after.
|
||||
static relaxed_atomic_t<pid_t> initial_fg_process_group{-1};
|
||||
|
||||
static void debug_shared(wchar_t msg_level, const wcstring &msg);
|
||||
|
||||
#if defined(OS_IS_CYGWIN) || defined(WSL)
|
||||
// MS Windows tty devices do not currently have either a read or write timestamp. Those
|
||||
// respective fields of `struct stat` are always the current time. Which means we can't
|
||||
|
@ -224,17 +222,17 @@ bool is_windows_subsystem_for_linux() {
|
|||
return backtrace_text;
|
||||
}
|
||||
|
||||
[[gnu::noinline]] void show_stackframe(const wchar_t msg_level, int frame_count, int skip_levels) {
|
||||
[[gnu::noinline]] void show_stackframe(int frame_count, int skip_levels) {
|
||||
if (frame_count < 1) return;
|
||||
|
||||
wcstring_list_t bt = demangled_backtrace(frame_count, skip_levels + 2);
|
||||
debug_shared(msg_level, L"Backtrace:\n" + join_strings(bt, L'\n') + L'\n');
|
||||
FLOG(error, L"Backtrace:\n" + join_strings(bt, L'\n') + L'\n');
|
||||
}
|
||||
|
||||
#else // HAVE_BACKTRACE_SYMBOLS
|
||||
|
||||
[[gnu::noinline]] void show_stackframe(const wchar_t msg_level, int, int) {
|
||||
debug_shared(msg_level, L"Sorry, but your system does not support backtraces");
|
||||
[[gnu::noinline]] void show_stackframe(int, int) {
|
||||
FLOGF(error, L"Sorry, but your system does not support backtraces");
|
||||
}
|
||||
#endif // HAVE_BACKTRACE_SYMBOLS
|
||||
|
||||
|
@ -606,17 +604,6 @@ bool should_suppress_stderr_for_tests() {
|
|||
return program_name && !std::wcscmp(program_name, TESTS_PROGRAM_NAME);
|
||||
}
|
||||
|
||||
static void debug_shared(const wchar_t level, const wcstring &msg) {
|
||||
pid_t current_pid;
|
||||
if (!is_forked_child()) {
|
||||
std::fwprintf(stderr, L"<%lc> %ls: %ls\n", level, program_name, msg.c_str());
|
||||
} else {
|
||||
current_pid = getpid();
|
||||
std::fwprintf(stderr, L"<%lc> %ls: %d: %ls\n", level, program_name, current_pid,
|
||||
msg.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Careful to not negate LLONG_MIN.
|
||||
static unsigned long long absolute_value(long long x) {
|
||||
if (x >= 0) return static_cast<unsigned long long>(x);
|
||||
|
@ -1833,7 +1820,7 @@ void redirect_tty_output() {
|
|||
} else {
|
||||
FLOGF(error, L"%s:%zu: failed assertion: %s", file, line, msg);
|
||||
}
|
||||
show_stackframe(L'E', 99, 1);
|
||||
show_stackframe(99, 1);
|
||||
abort();
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ extern const wcstring g_empty_string;
|
|||
#define FATAL_EXIT() \
|
||||
do { \
|
||||
char exit_read_buff; \
|
||||
show_stackframe(L'E'); \
|
||||
show_stackframe(); \
|
||||
ignore_result(read(0, &exit_read_buff, 1)); \
|
||||
exit_without_destructors(1); \
|
||||
} while (0)
|
||||
|
@ -276,7 +276,7 @@ std::shared_ptr<T> move_to_sharedptr(T &&v) {
|
|||
using cancel_checker_t = std::function<bool()>;
|
||||
|
||||
/// Print a stack trace to stderr.
|
||||
void show_stackframe(const wchar_t msg_level, int frame_count = 100, int skip_levels = 0);
|
||||
void show_stackframe(int frame_count = 100, int skip_levels = 0);
|
||||
|
||||
/// Returns a wide character string equivalent of the specified multibyte character string.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue
Block a user