blob: 0b19976350efc9675d765e099f3988217a4fbd24 [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#define CRASHLOGGER_REQUEST_SELF_BT_MAGIC 0xee726573756d65eeull
// Invoke this function to cause crashlogger to print a backtrace
// and resume the thread without killing the process.
static inline void crashlogger_request_backtrace(void) {
#ifdef __x86_64__
__asm__ ("int3" : : "a" (CRASHLOGGER_REQUEST_SELF_BT_MAGIC));
#endif
#ifdef __aarch64__
// This is what gdb uses.
__asm__ ("mov x0, %0\n"
"\tbrk 0"
: : "r" (CRASHLOGGER_REQUEST_SELF_BT_MAGIC) : "x0");
#endif
}