1 // Copyright 2016 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef BACKTRACE_REQUEST_BACKTRACE_REQUEST_H_ 6 #define BACKTRACE_REQUEST_BACKTRACE_REQUEST_H_ 7 8 #include <stdint.h> 9 10 #define BACKTRACE_REQUEST_MAGIC ((uint64_t)0xee726573756d65ee) 11 12 // Invoke this function to cause crashlogger to print a backtrace 13 // and resume the thread without killing the process. 14 backtrace_request(void)15static inline void backtrace_request(void) { 16 #ifdef __x86_64__ 17 __asm__ ("int3" : : "a" (BACKTRACE_REQUEST_MAGIC)); 18 #endif 19 #ifdef __aarch64__ 20 // This is what gdb uses. 21 __asm__ ("mov x0, %0\n" 22 "\tbrk 0" 23 : : "r" (BACKTRACE_REQUEST_MAGIC) : "x0"); 24 #endif 25 } 26 27 #endif // BACKTRACE_REQUEST_BACKTRACE_REQUEST_H_ 28