Debian Codegraph @

src/lib/libdwarf/dwarf_error.h

raw
1 /*
2
3 Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 Portions Copyright (C) 2011-2023 David Anderson. All Rights Reserved.
5
6 This program is free software; you can redistribute it
7 and/or modify it under the terms of version 2.1 of the
8 GNU Lesser General Public License as published by the Free
9 Software Foundation.
10
11 This program is distributed in the hope that it would be
12 useful, but WITHOUT ANY WARRANTY; without even the implied
13 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE.
15
16 Further, this software is distributed without any warranty
17 that it is free of the rightful claim of any third person
18 regarding infringement or the like. Any license provided
19 herein, whether implied or otherwise, applies only to this
20 software file. Patent licenses, if any, provided herein
21 do not apply to combinations of this program with other
22 software, or any other product whatsoever.
23
24 You should have received a copy of the GNU Lesser General
25 Public License along with this program; if not, write the
26 Free Software Foundation, Inc., 51 Franklin Street - Fifth
27 Floor, Boston MA 02110-1301, USA.
28
29 */
30
31 #ifndef DWARF_ERROR_H
32 #define DWARF_ERROR_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36
37 void _dwarf_error(Dwarf_Debug dbg, Dwarf_Error * error,
38 Dwarf_Signed errval);
39 void _dwarf_error_string(Dwarf_Debug dbg, Dwarf_Error * error,
40 Dwarf_Signed errval, char *msg);
41
42 #define DWARF_DBG_ERROR(dbg,errval,retval) \
43 _dwarf_error((dbg), error, (errval)); return(retval);
44
45 #define DE_STANDARD 0 /* Normal alloc attached to dbg. */
46 #define DE_STATIC 1 /* Using global static var */
47 #define DE_MALLOC 2 /* Using malloc space */
48 struct Dwarf_Error_s {
49 Dwarf_Signed er_errval;
50 void * er_msg;
51
52 /* If non-zero the Dwarf_Error_s struct is not malloc'd.
53 To aid when malloc returns NULL.
54 If zero a normal dwarf_dealloc will work.
55 er_static_alloc only accessed by dwarf_alloc.c.
56
57 If er_static_alloc is 1 in a Dwarf_Error_s
58 struct (set by libdwarf) and client code accidentally
59 turns that 0 to zero through a wild
60 pointer reference (the field is hidden
61 from clients...) then chaos will
62 eventually follow.
63 */
64 int er_static_alloc;
65 };
66 extern struct Dwarf_Error_s _dwarf_failsafe_error;
67
68 #ifdef __cplusplus
69 }
70 #endif /* __cplusplus */
71 #endif /* DWARF_ERROR_H */