1 | .\" Copyright (c) 2011 Kai Wang |
---|
2 | .\" All rights reserved. |
---|
3 | .\" |
---|
4 | .\" Redistribution and use in source and binary forms, with or without |
---|
5 | .\" modification, are permitted provided that the following conditions |
---|
6 | .\" are met: |
---|
7 | .\" 1. Redistributions of source code must retain the above copyright |
---|
8 | .\" notice, this list of conditions and the following disclaimer. |
---|
9 | .\" 2. Redistributions in binary form must reproduce the above copyright |
---|
10 | .\" notice, this list of conditions and the following disclaimer in the |
---|
11 | .\" documentation and/or other materials provided with the distribution. |
---|
12 | .\" |
---|
13 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
14 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
15 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
16 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
17 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
18 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
19 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
20 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
21 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
22 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
23 | .\" SUCH DAMAGE. |
---|
24 | .\" |
---|
25 | .\" $Id: dwarf_get_loclist_entry.3 2071 2011-10-27 03:20:00Z jkoshy $ |
---|
26 | .\" |
---|
27 | .Dd July 6, 2011 |
---|
28 | .Os |
---|
29 | .Dt DWARF_GET_LOCLIST_ENTRY 3 |
---|
30 | .Sh NAME |
---|
31 | .Nm dwarf_get_loclist_entry |
---|
32 | .Nd retrieve DWARF location list entry |
---|
33 | .Sh LIBRARY |
---|
34 | .Lb libdwarf |
---|
35 | .Sh SYNOPSIS |
---|
36 | .In libdwarf.h |
---|
37 | .Ft int |
---|
38 | .Fo dwarf_get_loclist_entry |
---|
39 | .Fa "Dwarf_Debug dbg" |
---|
40 | .Fa "Dwarf_Unsigned offset" |
---|
41 | .Fa "Dwarf_Addr *hipc" |
---|
42 | .Fa "Dwarf_Addr *lopc" |
---|
43 | .Fa "Dwarf_Ptr *data" |
---|
44 | .Fa "Dwarf_Unsigned *entry_len" |
---|
45 | .Fa "Dwarf_Unsigned *next_entry" |
---|
46 | .Fa "Dwarf_Error *err" |
---|
47 | .Fc |
---|
48 | .Sh DESCRIPTION |
---|
49 | Function |
---|
50 | .Fn dwarf_get_loclist_entry |
---|
51 | retrieves a location list entry from the DWARF section |
---|
52 | .Dq ".debug_loc" . |
---|
53 | .Pp |
---|
54 | Argument |
---|
55 | .Ar dbg |
---|
56 | should reference a DWARF debug context allocated using |
---|
57 | .Xr dwarf_init 3 . |
---|
58 | .Pp |
---|
59 | Argument |
---|
60 | .Ar offset |
---|
61 | is an offset, relative to the |
---|
62 | .Dq ".debug_loc" |
---|
63 | section, to the start of the desired location list entry. |
---|
64 | .Pp |
---|
65 | Argument |
---|
66 | .Ar hipc |
---|
67 | should point to a location which will hold the offset, relative to the |
---|
68 | base address of the location list entry, of the highest program |
---|
69 | counter value for the entry. |
---|
70 | .Pp |
---|
71 | Argument |
---|
72 | .Ar lowpc |
---|
73 | should point to a location which will hold the offset, relative to the |
---|
74 | base address of the location list entry, of the lowest program counter |
---|
75 | value for the entry. |
---|
76 | .Pp |
---|
77 | Argument |
---|
78 | .Ar data |
---|
79 | should point to a location which will be set to a pointer to the location |
---|
80 | list data. |
---|
81 | .Pp |
---|
82 | Argument |
---|
83 | .Ar entry_len |
---|
84 | should point to a location which will hold the length in bytes of the |
---|
85 | location list data returned in argument |
---|
86 | .Ar data . |
---|
87 | .Pp |
---|
88 | Argument |
---|
89 | .Ar next_entry |
---|
90 | should point to a location which will hold the offset of the next |
---|
91 | location list entry. |
---|
92 | .Pp |
---|
93 | If argument |
---|
94 | .Ar err |
---|
95 | is not NULL, it will be used to store error information in case |
---|
96 | of an error. |
---|
97 | .Sh RETURN VALUES |
---|
98 | Function |
---|
99 | .Fn dwarf_get_loclist_entry |
---|
100 | returns |
---|
101 | .Dv DW_DLV_OK |
---|
102 | when it succeeds. |
---|
103 | It returns |
---|
104 | .Dv DW_DLV_NO_ENTRY |
---|
105 | if there is no location list at the specified offset |
---|
106 | .Ar offset . |
---|
107 | In case of an error, it returns |
---|
108 | .Dv DW_DLV_ERROR |
---|
109 | and sets the argument |
---|
110 | .Ar err . |
---|
111 | .Sh ERRORS |
---|
112 | Function |
---|
113 | .Fn dwarf_get_loclist_entry |
---|
114 | can fail with: |
---|
115 | .Bl -tag -width ".Bq Er DW_DLE_NO_ENTRY" |
---|
116 | .It Bq Er DW_DLE_ARGUMENT |
---|
117 | One of the arguments |
---|
118 | .Ar dbg , |
---|
119 | .Ar hipc , |
---|
120 | .Ar lopc , |
---|
121 | .Ar data , |
---|
122 | .Ar entry_len |
---|
123 | or |
---|
124 | .Ar next_entry |
---|
125 | was NULL. |
---|
126 | .It Bq Er DW_DLE_NO_ENTRY |
---|
127 | There is no location list at the specified offset |
---|
128 | .Ar offset . |
---|
129 | .El |
---|
130 | .Sh EXAMPLE |
---|
131 | To iterate through all the location list entries in the |
---|
132 | .Dq ".debug_loc" |
---|
133 | section, use: |
---|
134 | .Bd -literal -offset indent |
---|
135 | Dwarf_Debug dbg; |
---|
136 | Dwarf_Unsigned off, len, next; |
---|
137 | Dwarf_Addr hipc, lopc; |
---|
138 | Dwarf_Ptr data; |
---|
139 | Dwarf_Error de; |
---|
140 | int ret; |
---|
141 | |
---|
142 | off = 0; |
---|
143 | while ((ret = dwarf_get_loclist_entry(dbg, off, &hipc, &lopc, &data, |
---|
144 | &len, &next, &de)) == DW_DLV_OK) { |
---|
145 | /* ... use loclist entry ... */ |
---|
146 | off = next; |
---|
147 | } |
---|
148 | if (ret == DW_DLV_ERROR) |
---|
149 | warnx("dwarf_get_loclist_entry failed: %s", dwarf_errmsg(de)); |
---|
150 | .Ed |
---|
151 | .Sh SEE ALSO |
---|
152 | .Xr dwarf 3 , |
---|
153 | .Xr dwarf_loclist 3 , |
---|
154 | .Xr dwarf_loclist_n 3 , |
---|
155 | .Xr dwarf_loclist_from_expr 3 , |
---|
156 | .Xr dwarf_loclist_from_expr_a 3 |
---|