1 // GNU D Compiler bindings for the stack backtrace functions.
2 // Copyright (C) 2013-2023 Free Software Foundation, Inc.
4 // GCC is free software; you can redistribute it and/or modify it under
5 // the terms of the GNU General Public License as published by the Free
6 // Software Foundation; either version 3, or (at your option) any later
9 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
10 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 // Under Section 7 of GPL version 3, you are granted additional
15 // permissions described in the GCC Runtime Library Exception, version
16 // 3.1, as published by the Free Software Foundation.
18 // You should have received a copy of the GNU General Public License and
19 // a copy of the GCC Runtime Library Exception along with this program;
20 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 // <http://www.gnu.org/licenses/>.
23 module gcc
.libbacktrace
;
26 * Part of backtrace-supported.h: These are platform specific variables.
27 * They are obtained via the configure script
30 enum BACKTRACE_SUPPORTED
= @BACKTRACE_SUPPORTED@
;
31 enum BACKTRACE_USES_MALLOC
= @BACKTRACE_USES_MALLOC@
;
32 enum BACKTRACE_SUPPORTS_THREADS
= @BACKTRACE_SUPPORTS_THREADS@
;
38 static if (BACKTRACE_SUPPORTED
)
40 import core
.stdc
.stddef
, core
.stdc
.stdio
, core
.stdc
.stdint
;
43 struct backtrace_state
{}
45 alias extern(C
) void function(void* data
, const(char)* msg
, int errnum
)
46 backtrace_error_callback
;
48 backtrace_state
* backtrace_create_state(const(char)* filename
, int threaded
,
49 backtrace_error_callback error_callback
, void* data
) @nogc nothrow;
51 alias extern(C
) int function(void* data
, uintptr_t pc
, const(char)* filename
, int lineno
, const(char)* func
)
52 backtrace_full_callback
;
54 int backtrace_full(backtrace_state
* state
, int skip
, backtrace_full_callback callback
,
55 backtrace_error_callback error_callback
, void* data
) @nogc nothrow;
57 alias extern(C
) int function(void* data
, uintptr_t pc
)
58 backtrace_simple_callback
;
60 int backtrace_simple(backtrace_state
* state
, int skip
, backtrace_simple_callback callback
,
61 backtrace_error_callback error_callback
, void* data
) @nogc nothrow;
63 void backtrace_print(backtrace_state
* state
, int skip
, FILE
* file
) @nogc nothrow;
65 int backtrace_pcinfo(backtrace_state
* state
, uintptr_t pc
, backtrace_full_callback callback
,
66 backtrace_error_callback error_callback
, void* data
) @nogc nothrow;
68 alias extern(C
) void function(void* data
, uintptr_t pc
, const(char)* symname
, uintptr_t symval
)
69 backtrace_syminfo_callback
;
71 int backtrace_syminfo(backtrace_state
*state
, uintptr_t pc
, backtrace_syminfo_callback callback
,
72 backtrace_error_callback error_callback
, void* data
) @nogc nothrow;