| 1 |
/* |
| 2 |
Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. |
| 3 |
Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved. |
| 4 |
Portions Copyright 2009-2018 SN Systems Ltd. All rights reserved. |
| 5 |
Portions Copyright 2007-2020 David Anderson. All rights reserved. |
| 6 |
|
| 7 |
This program is free software; you can redistribute it and/or |
| 8 |
modify it under the terms of version 2 of the GNU General |
| 9 |
Public License as published by the Free Software Foundation. |
| 10 |
|
| 11 |
This program is distributed in the hope that it would be |
| 12 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 13 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
PURPOSE. |
| 15 |
|
| 16 |
Further, this software is distributed without any warranty |
| 17 |
that it is free of the rightful claim of any third person |
| 18 |
regarding infringement or the like. Any license provided |
| 19 |
herein, whether implied or otherwise, applies only to this |
| 20 |
software file. Patent licenses, if any, provided herein |
| 21 |
do not apply to combinations of this program with other |
| 22 |
software, or any other product whatsoever. |
| 23 |
|
| 24 |
You should have received a copy of the GNU General Public |
| 25 |
License along with this program; if not, write the Free |
| 26 |
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, |
| 27 |
Boston MA 02110-1301, USA. |
| 28 |
*/ |
| 29 |
|
| 30 |
/* The address of the Free Software Foundation is |
| 31 |
Free Software Foundation, Inc., 51 Franklin St, Fifth |
| 32 |
Floor, Boston, MA 02110-1301, USA. SGI has moved from |
| 33 |
the Crittenden Lane address. */ |
| 34 |
|
| 35 |
#include <config.h> |
| 36 |
#include <stdio.h> /* FILE decl for dd_esb.h, printf etc */ |
| 37 |
|
| 38 |
#include "dwarf.h" |
| 39 |
#include "libdwarf.h" |
| 40 |
#include "libdwarf_private.h" |
| 41 |
#include "dd_defined_types.h" |
| 42 |
#include "dd_checkutil.h" |
| 43 |
#include "dd_glflags.h" |
| 44 |
#include "dd_globals.h" |
| 45 |
#include "dd_naming.h" |
| 46 |
#include "dd_esb.h" /* For flexible string buffer. */ |
| 47 |
#include "dd_esb_using_functions.h" |
| 48 |
#include "dd_sanitized.h" |
| 49 |
#include "dd_helpertree.h" |
| 50 |
#include "dd_tag_common.h" |
| 51 |
|
| 52 |
/* Prints locentry descriptions for DW_LKIND_loclist */ |
| 53 |
|
| 54 |
int |
| 55 |
print_original_loclist_linecodes(Dwarf_Bool checking, |
| 56 |
const char * tagname, |
| 57 |
const char * attrname, |
| 58 |
unsigned int llent, |
| 59 |
Dwarf_Small lle_value, |
| 60 |
Dwarf_Addr base_address, |
| 61 |
Dwarf_Addr rawlopc, |
| 62 |
Dwarf_Addr rawhipc, |
| 63 |
Dwarf_Bool debug_addr_unavailable, |
| 64 |
Dwarf_Addr lopc, |
| 65 |
Dwarf_Addr hipc, |
| 66 |
Dwarf_Unsigned locdesc_offset, |
| 67 |
struct esb_s * esbp, |
| 68 |
Dwarf_Bool * bError) |
| 69 |
{ |
| 70 |
switch(lle_value) { |
| 71 |
case DW_LLE_base_address: |
| 72 |
esb_append_printf_u(esbp, |
| 73 |
"<base address 0x%" |
| 74 |
DW_PR_XZEROS DW_PR_DUx |
| 75 |
">", |
| 76 |
hipc); |
| 77 |
break; |
| 78 |
case DW_LLE_end_of_list: |
| 79 |
/* Nothing to do. */ |
| 80 |
esb_append(esbp,"<end-of-list>"); |
| 81 |
break; |
| 82 |
case DW_LLE_offset_pair: |
| 83 |
{ |
| 84 |
if (glflags.verbose) { |
| 85 |
esb_append_printf_u(esbp, |
| 86 |
"<DW_LLE_offset_pair 0x%" |
| 87 |
DW_PR_XZEROS DW_PR_DUx,rawlopc); |
| 88 |
esb_append_printf_u(esbp, |
| 89 |
" , 0x%" |
| 90 |
DW_PR_XZEROS DW_PR_DUx |
| 91 |
">",rawhipc); |
| 92 |
esb_append_printf_i(esbp, "\n [%2d]",llent); |
| 93 |
} |
| 94 |
esb_append_printf_u(esbp, |
| 95 |
"<low,hi addrs 0x%" |
| 96 |
DW_PR_XZEROS DW_PR_DUx, lopc); |
| 97 |
esb_append_printf_u(esbp, |
| 98 |
" , 0x%" |
| 99 |
DW_PR_XZEROS DW_PR_DUx |
| 100 |
">", hipc); |
| 101 |
if (checking && !debug_addr_unavailable) { |
| 102 |
loc_error_check(tagname,attrname, |
| 103 |
lopc, rawlopc, |
| 104 |
hipc,rawhipc, locdesc_offset, |
| 105 |
base_address, |
| 106 |
bError); |
| 107 |
} |
| 108 |
} |
| 109 |
break; |
| 110 |
case DW_LLE_start_end: |
| 111 |
/* debug_addr_unavailable does not apply here */ |
| 112 |
esb_append_printf_u(esbp, |
| 113 |
"<start,end 0x%" |
| 114 |
DW_PR_XZEROS DW_PR_DUx,lopc); |
| 115 |
esb_append_printf_u(esbp, |
| 116 |
" 0x%" |
| 117 |
DW_PR_XZEROS DW_PR_DUx |
| 118 |
">",hipc); |
| 119 |
if (checking && !debug_addr_unavailable) { |
| 120 |
loc_error_check(tagname,attrname, |
| 121 |
lopc, rawlopc, |
| 122 |
hipc, rawhipc, locdesc_offset, base_address, |
| 123 |
bError); |
| 124 |
} |
| 125 |
break; |
| 126 |
|
| 127 |
default: { |
| 128 |
struct esb_s unexp; |
| 129 |
|
| 130 |
esb_constructor(&unexp); |
| 131 |
esb_append_printf_u(&unexp, |
| 132 |
"ERROR: Unexpected LLE code 0x%x" |
| 133 |
" in original loclist (synthesized code error)", |
| 134 |
lle_value); |
| 135 |
print_error_and_continue(esb_get_string(&unexp), |
| 136 |
DW_DLV_OK, 0); |
| 137 |
esb_destructor(&unexp); |
| 138 |
} |
| 139 |
break; |
| 140 |
} |
| 141 |
return DW_DLV_OK; |
| 142 |
} |