# Gimp.stack_trace_print

    function stack_trace_print(prog_name: String, stream: void): [ok: Boolean, trace: String] {
        // Gjs wrapper for gimp_stack_trace_print()
    }

Attempts to generate a stack trace at current code position in prog_name. prog_name is mostly a helper and can be set to NULL. Nevertheless if set, it has to be the current program name (argv[0]). This function is not meant to generate stack trace for third-party programs, and will attach the current process id only. Internally, this function uses `gdb` or `lldb` if they are available, or the stacktrace() API on platforms where it is available. It always fails on Win32.

The stack trace, once generated, will either be printed to stream or returned as a newly allocated string in trace, if not null.

In some error cases (e.g. segmentation fault), trying to allocate more memory will trigger more segmentation faults and therefore loop our error handling (which is just wrong). Therefore printing to a file description is an implementation without any memory allocation.

Since 2.10

prog_name

  the program to attach to.

stream

  a FILE* stream.

ok

  true if a stack trace could be generated, false otherwise.

trace

  location to store a newly allocated string of the trace.