github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/runtime/debug/stack.go (about)

     1  // Copyright 2011 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // debug パッケージには、プログラムが実行中に自己デバッグするための機能が含まれています。
     6  package debug
     7  
     8  import (
     9  	"github.com/shogo82148/std/os"
    10  )
    11  
    12  // PrintStackはruntime.Stackによって返されたスタックトレースを標準エラー出力に出力します。
    13  func PrintStack()
    14  
    15  // Stackはそれを呼び出すgoroutineのフォーマットされたスタックトレースを返します。
    16  // [runtime.Stack] を呼び出して、トレース全体をキャプチャする十分に大きなバッファを使用します。
    17  func Stack() []byte
    18  
    19  // SetCrashOutput configures a single additional file where unhandled
    20  // panics and other fatal errors are printed, in addition to standard error.
    21  // There is only one additional file: calling SetCrashOutput again overrides
    22  // any earlier call.
    23  // SetCrashOutput duplicates f's file descriptor, so the caller may safely
    24  // close f as soon as SetCrashOutput returns.
    25  // To disable this additional crash output, call SetCrashOutput(nil).
    26  // If called concurrently with a crash, some in-progress output may be written
    27  // to the old file even after an overriding SetCrashOutput returns.
    28  func SetCrashOutput(f *os.File) error