aboutsummaryrefslogtreecommitdiffstats
path: root/elff/dwarf_utils.h
blob: fc007d17dcca244c1e985605ac0632397d20e289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* Copyright (C) 2007-2010 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/

/*
 * Contains declarations of misc. DWARF utility routines.
 */

#ifndef ELFF_DWARF_UTILS_
#define ELFF_DWARF_UTILS_

#include "dwarf_defs.h"

/* Gets DWARF attribute name string (DW_AT_Xxx) for a given attribute ID.
 * Param:
 *  at - DWARF attribute ID to get name string for.
 * Return:
 *  Attribute name string. Note that this routine returns "DW_AT_Unknown",
 *  if DWARF attribute value passed to this routine has not been recognized.
 */
const char* dwarf_at_name(Dwarf_At at);

/* Gets DWARF form name string (DW_FORM_Xxx) for a given form.
 * Param:
 *  form - DWARF form to get name string for.
 * Return:
 *  Form name string. Note that this routine returns "DW_FORM_Unknown", if
 *  DWARF form value passed to this routine has not been recognized.
 */
const char* dwarf_form_name(Dwarf_Form form);

/* Gets DWARF tag name string (DW_TAG_Xxx) for a given tag.
 * Param:
 *  tag - DWARF tag to get name string for.
 * Return:
 *  Tag name string. Note that this routine returns "DW_TAG_Unknown", if DWARF
 *  tag value passed to this routine has not been recognized.
 */
const char* dwarf_tag_name(Dwarf_Tag tag);

/* Dumps DWARF attribute to stdout.
 * Param:
 *  at - Attribute ID (DW_AT_Xxx)
 *  form - Attribute form (DW_FORM_Xxx)
 *  val - Attribute value.
 */
void dump_attrib(Dwarf_At at, Dwarf_Form form, const Dwarf_Value* val);

/* Dumps DWARF attribute value to stdout.
 * Param:
 *  val - Attribute value.
 */
void dump_value(const Dwarf_Value* val);

#endif  // ELFF_DWARF_UTILS_