source: rtems-tools/rtemstoolkit/elftoolchain/libdwarf/dwarf_get_loclist_entry.3 @ 4bb3996

5
Last change on this file since 4bb3996 was 4bb3996, checked in by Chris Johns <chrisj@…>, on 04/30/18 at 05:34:48

rtemstoolkit: Add libdwarf from elftoolchain.

The code is taken from:

https://svn.code.sf.net/p/elftoolchain/code/trunk

Update #3417

  • Property mode set to 100644
File size: 4.2 KB
Line 
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
49Function
50.Fn dwarf_get_loclist_entry
51retrieves a location list entry from the DWARF section
52.Dq ".debug_loc" .
53.Pp
54Argument
55.Ar dbg
56should reference a DWARF debug context allocated using
57.Xr dwarf_init 3 .
58.Pp
59Argument
60.Ar offset
61is an offset, relative to the
62.Dq ".debug_loc"
63section, to the start of the desired location list entry.
64.Pp
65Argument
66.Ar hipc
67should point to a location which will hold the offset, relative to the
68base address of the location list entry, of the highest program
69counter value for the entry.
70.Pp
71Argument
72.Ar lowpc
73should point to a location which will hold the offset, relative to the
74base address of the location list entry, of the lowest program counter
75value for the entry.
76.Pp
77Argument
78.Ar data
79should point to a location which will be set to a pointer to the location
80list data.
81.Pp
82Argument
83.Ar entry_len
84should point to a location which will hold the length in bytes of the
85location list data returned in argument
86.Ar data .
87.Pp
88Argument
89.Ar next_entry
90should point to a location which will hold the offset of the next
91location list entry.
92.Pp
93If argument
94.Ar err
95is not NULL, it will be used to store error information in case
96of an error.
97.Sh RETURN VALUES
98Function
99.Fn dwarf_get_loclist_entry
100returns
101.Dv DW_DLV_OK
102when it succeeds.
103It returns
104.Dv DW_DLV_NO_ENTRY
105if there is no location list at the specified offset
106.Ar offset .
107In case of an error, it returns
108.Dv DW_DLV_ERROR
109and sets the argument
110.Ar err .
111.Sh ERRORS
112Function
113.Fn dwarf_get_loclist_entry
114can fail with:
115.Bl -tag -width ".Bq Er DW_DLE_NO_ENTRY"
116.It Bq Er DW_DLE_ARGUMENT
117One of the arguments
118.Ar dbg ,
119.Ar hipc ,
120.Ar lopc ,
121.Ar data ,
122.Ar entry_len
123or
124.Ar next_entry
125was NULL.
126.It Bq Er DW_DLE_NO_ENTRY
127There is no location list at the specified offset
128.Ar offset .
129.El
130.Sh EXAMPLE
131To iterate through all the location list entries in the
132.Dq ".debug_loc"
133section, use:
134.Bd -literal -offset indent
135Dwarf_Debug dbg;
136Dwarf_Unsigned off, len, next;
137Dwarf_Addr hipc, lopc;
138Dwarf_Ptr data;
139Dwarf_Error de;
140int ret;
141
142off = 0;
143while ((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}
148if (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
Note: See TracBrowser for help on using the repository browser.