xref: /illumos-gate/usr/src/lib/libdwarf/common/dwarf_reading.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
1 /*
2 Copyright (c) 2018, David Anderson
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with
6 or without modification, are permitted provided that the
7 following conditions are met:
8 
9     Redistributions of source code must retain the above
10     copyright notice, this list of conditions and the following
11     disclaimer.
12 
13     Redistributions in binary form must reproduce the above
14     copyright notice, this list of conditions and the following
15     disclaimer in the documentation and/or other materials
16     provided with the distribution.
17 
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 */
33 #ifndef DWARF_READING_H
34 #define DWARF_READING_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 #ifndef DW_DLV_OK
41 /* DW_DLV_OK  must match libdwarf.h */
42 /* DW_DLV_NO_ENTRY  must match libdwarf.h  */
43 #define DW_DLV_OK 0
44 #define DW_DLV_NO_ENTRY -1
45 #define DW_DLV_ERROR 1
46 #endif /* DW_DLV_OK */
47 
48 #define TRUE 1
49 #define FALSE 0
50 
51 #define ALIGN4 4
52 #define ALIGN8 8
53 
54 #define PREFIX "\t"
55 #define LUFMT "%lu"
56 #define UFMT "%u"
57 #define DFMT "%d"
58 #define XFMT "0x%x"
59 
60 /* even if already seen, values must match, so no #ifdef needed. */
61 #define DW_DLV_NO_ENTRY  -1
62 #define DW_DLV_OK         0
63 #define DW_DLV_ERROR      1
64 
65 #define P printf
66 #define F fflush(stdout)
67 
68 #define RRMOA(f,buf,loc,siz,fsiz,errc) _dwarf_object_read_random(f, \
69     (char *)buf,loc,siz,fsiz,errc);
70 
71 #ifdef __cplusplus
72 }
73 #endif /* __cplusplus */
74 
75 #endif /* DWARF_READING_H */
76