1/* Copyright (C) 2007-2010 The Android Open Source Project
2**
3** This software is licensed under the terms of the GNU General Public
4** License version 2, as published by the Free Software Foundation, and
5** may be copied, distributed, and modified under those terms.
6**
7** This program is distributed in the hope that it will be useful,
8** but WITHOUT ANY WARRANTY; without even the implied warranty of
9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10** GNU General Public License for more details.
11*/
12
13/*
14 * Contains declarations of misc. DWARF utility routines.
15 */
16
17#ifndef ELFF_DWARF_UTILS_
18#define ELFF_DWARF_UTILS_
19
20#include "dwarf_defs.h"
21
22/* Gets DWARF attribute name string (DW_AT_Xxx) for a given attribute ID.
23 * Param:
24 *  at - DWARF attribute ID to get name string for.
25 * Return:
26 *  Attribute name string. Note that this routine returns "DW_AT_Unknown",
27 *  if DWARF attribute value passed to this routine has not been recognized.
28 */
29const char* dwarf_at_name(Dwarf_At at);
30
31/* Gets DWARF form name string (DW_FORM_Xxx) for a given form.
32 * Param:
33 *  form - DWARF form to get name string for.
34 * Return:
35 *  Form name string. Note that this routine returns "DW_FORM_Unknown", if
36 *  DWARF form value passed to this routine has not been recognized.
37 */
38const char* dwarf_form_name(Dwarf_Form form);
39
40/* Gets DWARF tag name string (DW_TAG_Xxx) for a given tag.
41 * Param:
42 *  tag - DWARF tag to get name string for.
43 * Return:
44 *  Tag name string. Note that this routine returns "DW_TAG_Unknown", if DWARF
45 *  tag value passed to this routine has not been recognized.
46 */
47const char* dwarf_tag_name(Dwarf_Tag tag);
48
49/* Dumps DWARF attribute to stdout.
50 * Param:
51 *  at - Attribute ID (DW_AT_Xxx)
52 *  form - Attribute form (DW_FORM_Xxx)
53 *  val - Attribute value.
54 */
55void dump_attrib(Dwarf_At at, Dwarf_Form form, const Dwarf_Value* val);
56
57/* Dumps DWARF attribute value to stdout.
58 * Param:
59 *  val - Attribute value.
60 */
61void dump_value(const Dwarf_Value* val);
62
63#endif  // ELFF_DWARF_UTILS_
64