| 1 |
/* |
| 2 |
Copyright (c) 2021, David Anderson All rights reserved. |
| 3 |
|
| 4 |
Redistribution and use in source and binary forms, with |
| 5 |
or without modification, are permitted provided that the |
| 6 |
following conditions are met: |
| 7 |
|
| 8 |
Redistributions of source code must retain the above |
| 9 |
copyright notice, this list of conditions and the following |
| 10 |
disclaimer. |
| 11 |
|
| 12 |
Redistributions in binary form must reproduce the above |
| 13 |
copyright notice, this list of conditions and the following |
| 14 |
disclaimer in the documentation and/or other materials |
| 15 |
provided with the distribution. |
| 16 |
|
| 17 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
| 18 |
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 19 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 22 |
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 24 |
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 26 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 28 |
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 29 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 |
*/ |
| 31 |
|
| 32 |
#include <config.h> |
| 33 |
|
| 34 |
#include "libdwarf.h" |
| 35 |
|
| 36 |
/* FORM_CLASS is created by libdwarf, it is |
| 37 |
not a part of Standard Dwarf. Dwarf_Form_Class attempts |
| 38 |
to allow convenient processing of FORMs |
| 39 |
across DWARF2,3,4, and 5 for libdwarf, |
| 40 |
dwarfdump, and other clients and ensures |
| 41 |
type-safe referencing. */ |
| 42 |
int |
| 43 |
dwarf_get_FORM_CLASS_name (enum Dwarf_Form_Class fc, |
| 44 |
const char ** s_out) |
| 45 |
{ |
| 46 |
switch (fc) { |
| 47 |
case DW_FORM_CLASS_UNKNOWN: |
| 48 |
*s_out = "DW_FORM_CLASS_UNKNOWN"; |
| 49 |
return DW_DLV_OK; |
| 50 |
case DW_FORM_CLASS_ADDRESS: |
| 51 |
*s_out = "DW_FORM_CLASS_ADDRESS"; |
| 52 |
return DW_DLV_OK; |
| 53 |
case DW_FORM_CLASS_BLOCK: |
| 54 |
*s_out = "DW_FORM_CLASS_BLOCK"; |
| 55 |
return DW_DLV_OK; |
| 56 |
case DW_FORM_CLASS_CONSTANT: |
| 57 |
*s_out = "DW_FORM_CLASS_CONSTANT"; |
| 58 |
return DW_DLV_OK; |
| 59 |
case DW_FORM_CLASS_EXPRLOC: |
| 60 |
*s_out = "DW_FORM_CLASS_EXPRLOC"; |
| 61 |
return DW_DLV_OK; |
| 62 |
case DW_FORM_CLASS_FLAG: |
| 63 |
*s_out = "DW_FORM_CLASS_FLAG"; |
| 64 |
return DW_DLV_OK; |
| 65 |
case DW_FORM_CLASS_LINEPTR: |
| 66 |
*s_out = "DW_FORM_CLASS_LINEPTR"; |
| 67 |
return DW_DLV_OK; |
| 68 |
case DW_FORM_CLASS_LOCLISTPTR: |
| 69 |
*s_out = "DW_FORM_CLASS_LOCLISTPTR"; |
| 70 |
return DW_DLV_OK; |
| 71 |
case DW_FORM_CLASS_MACPTR: |
| 72 |
*s_out = "DW_FORM_CLASS_MACPTR"; |
| 73 |
return DW_DLV_OK; |
| 74 |
case DW_FORM_CLASS_RANGELISTPTR: |
| 75 |
*s_out = "DW_FORM_CLASS_RANGELISTPTR"; |
| 76 |
return DW_DLV_OK; |
| 77 |
case DW_FORM_CLASS_REFERENCE: |
| 78 |
*s_out = "DW_FORM_CLASS_REFERENCE"; |
| 79 |
return DW_DLV_OK; |
| 80 |
case DW_FORM_CLASS_STRING: |
| 81 |
*s_out = "DW_FORM_CLASS_STRING"; |
| 82 |
return DW_DLV_OK; |
| 83 |
case DW_FORM_CLASS_FRAMEPTR: |
| 84 |
*s_out = "DW_FORM_CLASS_FRAMEPTR"; |
| 85 |
return DW_DLV_OK; |
| 86 |
case DW_FORM_CLASS_MACROPTR: |
| 87 |
*s_out = "DW_FORM_CLASS_MAXCROPTR"; |
| 88 |
return DW_DLV_OK; |
| 89 |
case DW_FORM_CLASS_ADDRPTR: |
| 90 |
*s_out = "DW_FORM_CLASS_ADDRPTR"; |
| 91 |
return DW_DLV_OK; |
| 92 |
case DW_FORM_CLASS_LOCLIST: |
| 93 |
*s_out = "DW_FORM_CLASS_LOCLIST"; |
| 94 |
return DW_DLV_OK; |
| 95 |
case DW_FORM_CLASS_LOCLISTSPTR: |
| 96 |
*s_out = "DW_FORM_CLASS_LOCLISTSPTR"; |
| 97 |
return DW_DLV_OK; |
| 98 |
case DW_FORM_CLASS_RNGLIST: |
| 99 |
*s_out = "DW_FORM_CLASS_RNGLIST"; |
| 100 |
return DW_DLV_OK; |
| 101 |
case DW_FORM_CLASS_RNGLISTSPTR: |
| 102 |
*s_out = "DW_FORM_CLASS_RNGLISTSPTR"; |
| 103 |
return DW_DLV_OK; |
| 104 |
case DW_FORM_CLASS_STROFFSETSPTR: |
| 105 |
*s_out = "DW_FORM_CLASS_STROFFSETSPTR"; |
| 106 |
return DW_DLV_OK; |
| 107 |
default: break; |
| 108 |
} |
| 109 |
return DW_DLV_NO_ENTRY; |
| 110 |
} |