47 #include <elfutils/libebl.h>
48 #include <elfutils/libdw.h>
49 #include <elfutils/libdwfl.h>
65 struct scope *root_scope;
67 unsigned char *linestartp =
68 (
unsigned char *)&debugfile->
linetab[offset];
69 unsigned char *lineendp =
71 unsigned char *linep = linestartp;
72 const unsigned char *clinep;
80 Dwarf_Word unit_length;
82 uint_fast16_t version;
83 Dwarf_Word header_length;
84 uint_fast8_t minimum_instr_len;
85 uint_fast8_t max_ops_per_instr;
86 uint_fast8_t default_is_stmt;
87 int_fast8_t line_base;
88 uint_fast8_t line_range;
89 uint_fast8_t opcode_base;
90 uint8_t *standard_opcode_lengths;
94 unsigned int op_index;
101 struct symbol *candidate_symbol = NULL;
102 bool prologue_end =
false;
103 bool epilogue_begin =
false;
107 char *currentfile = NULL;
111 unsigned char *startp;
127 if (g_hash_table_size(debugfile->
addresses) == 0)
132 while (linep < lineendp) {
133 start_offset = linep - linestartp;
137 dirlist = array_list_create(16);
138 filelist = array_list_create(16);
140 if (
unlikely (unit_length == 0xffffffff)) {
141 if (
unlikely (linep + 8 > lineendp))
142 goto invalid_data_out;
149 if (unit_length < 2 + length + 5 * 1
150 ||
unlikely (linep + unit_length > lineendp))
151 goto invalid_data_out;
153 lineendp = linep + unit_length;
165 minimum_instr_len = *linep++;
168 max_ops_per_instr = version < 4 ? 1 : *linep++;
172 default_is_stmt = *linep++;
175 line_base = *((int_fast8_t *)linep);
179 line_range = *(linep++);
182 opcode_base = *(linep++);
184 if (
unlikely (linep + opcode_base - 1 >= lineendp))
185 goto invalid_unit_out;
187 standard_opcode_lengths = linep - 1;
189 linep += opcode_base - 1;
191 goto invalid_unit_out;
193 while (*linep != 0) {
194 endp = memchr(linep,
'\0',lineendp - linep);
196 goto invalid_unit_out;
198 array_list_append(dirlist,linep);
206 goto invalid_unit_out;
208 while (*linep != 0) {
210 endp = memchr(linep,
'\0',lineendp - linep);
212 goto invalid_unit_out;
217 clinep = (
const unsigned char *)linep;
225 dirp = (
char *)array_list_item(dirlist,0);
228 dirp = (
char *)array_list_item(dirlist,u128 - 1);
229 filenamelen = strlen(dirp)+1+(endp - startp)+1;
230 buf =
malloc(filenamelen);
231 snprintf(buf,filenamelen,
"%s/%s",dirp,(
char *)startp);
232 array_list_add(filelist,buf);
240 linep = (
unsigned char *)clinep;
248 is_stmt = default_is_stmt;
249 prologue_end =
false;
250 epilogue_begin =
false;
252 currentfile = (
char *)array_list_item(filelist,0);
254 currentclfrev = NULL;
256 inline void advance_pc(
unsigned int op_advance) {
257 address += op_advance;
258 op_index = (op_index + op_advance) % max_ops_per_instr;
261 inline void storeline() {
262 gpointer orig_key = NULL;
265 g_hash_table_lookup_extended(debugfile->
srclines,
266 currentfile,&orig_key,¤tclf);
289 g_hash_table_steal(debugfile->
srclines,currentfile);
290 g_hash_table_insert(debugfile->
srclines,orig_key,
294 g_hash_table_insert(debugfile->
srclines,strdup(currentfile),
303 currentfile,&orig_key,¤tclfrev);
305 (
ADDR)address,(
void *)(uintptr_t)line);
311 g_hash_table_steal(debugfile->
srcaddrlines,currentfile);
316 g_hash_table_insert(debugfile->
srcaddrlines,strdup(currentfile),
320 while (linep < lineendp) {
322 opcode = *(
unsigned char *)linep++;
325 if (
likely(opcode >= opcode_base)) {
332 line_increment = (line_base
333 + (opcode - opcode_base) % line_range);
336 line += line_increment;
337 advance_pc((opcode - opcode_base) / line_range);
344 if (epilogue_begin && candidate_symbol
350 sf->epilogue_begin = (
ADDR)address;
352 "set_epilogue_begin: %s is 0x%"PRIxADDR"\n",
355 sf->epilogue_known = 1;
359 "set_epilogue_begin: address 0x%"PRIxADDR" not in %s\n",
368 if (prologue_end && candidate_symbol
374 sf->prologue_end = (
ADDR)address;
376 "set_prologue_end: %s is 0x%"PRIxADDR"\n",
381 sf->prologue_guessed = 0;
382 sf->prologue_known = 1;
390 "set_prologue_end: address 0x%"PRIxADDR" not in %s\n",
397 prologue_end =
false;
398 epilogue_begin =
false;
413 sf->prologue_end = (
ADDR)address;
415 "assuming prologue_end of %s is 0x%"PRIxADDR"\n",
419 sf->prologue_guessed = 1;
423 "address 0x%"PRIxADDR" not in %s\n",
441 symbol = (
struct symbol *) \
442 g_hash_table_lookup(debugfile->
addresses,
443 (gpointer)(
ADDR)address);
446 "found candidate prologue function %s at 0x%"PRIxADDR"\n",
448 candidate_symbol = symbol;
452 "did not find function at 0x%"PRIxADDR"\n",
456 else if (opcode == 0) {
459 goto invalid_unit_out;
462 length = *(
unsigned char *)linep++;
464 if (
unlikely(linep + length > lineendp))
465 goto invalid_unit_out;
468 opcode = *(
unsigned char *)linep++;
471 case DW_LNE_end_sequence:
475 currentfile = (
char *)array_list_item(filelist,0);
477 currentclfrev = NULL;
483 is_stmt = default_is_stmt;
485 case DW_LNE_set_address:
487 if (address_size == 4)
493 symbol = (
struct symbol *) \
494 g_hash_table_lookup(debugfile->
addresses,
495 (gpointer)(
ADDR)address);
498 "found candidate prologue function %s at 0x%"PRIxADDR"\n",
500 candidate_symbol = symbol;
505 case DW_LNE_define_file:;
506 endp = memchr(linep,
'\0',lineendp - linep);
508 goto invalid_unit_out;
512 clinep = (
const unsigned char *)linep;
522 dirp = (
char *)array_list_item(dirlist,0);
525 dirp = (
char *)array_list_item(dirlist,u128 - 1);
526 filenamelen = strlen(dirp)+1+(endp - startp)+1;
527 buf =
malloc(filenamelen);
528 snprintf(buf,filenamelen,
"%s/%s",dirp,(
char *)startp);
529 array_list_add(filelist,buf);
536 currentclfrev = NULL;
542 linep = (
unsigned char *)clinep;
545 #if _INT_ELFUTILS_VERSION > 147
546 case DW_LNE_set_discriminator:
548 if (
unlikely(standard_opcode_lengths[opcode] != 1))
549 goto invalid_unit_out;
551 clinep = (
const unsigned char *)linep;
553 linep = (
unsigned char *)clinep;
558 vwarn(
"unknown opcode\n");
563 else if (opcode <= DW_LNS_set_isa) {
574 prologue_end =
false;
575 epilogue_begin =
false;
577 case DW_LNS_advance_pc:
580 clinep = (
const unsigned char *)linep;
582 linep = (
unsigned char *)clinep;
585 case DW_LNS_advance_line:
588 clinep = (
const unsigned char *)linep;
590 linep = (
unsigned char *)clinep;
593 case DW_LNS_set_file:
595 clinep = (
const unsigned char *)linep;
599 if (u128 >= (
unsigned int)array_list_len(filelist)) {
601 "set_file index %u out of bounds; aborting!\n",
603 goto invalid_unit_out;
605 currentfile = array_list_item(filelist,((
int)u128) - 1);
607 currentclfrev = NULL;
611 linep = (
unsigned char *)clinep;
613 case DW_LNS_set_column:
615 if (
unlikely(standard_opcode_lengths[opcode] != 1))
616 goto invalid_unit_out;
617 clinep = (
const unsigned char *)linep;
619 linep = (
unsigned char *)clinep;
621 case DW_LNS_negate_stmt:
623 is_stmt = 1 - is_stmt;
625 case DW_LNS_set_basic_block:
628 case DW_LNS_const_add_pc:
630 advance_pc((255 - opcode_base) / line_range);
632 case DW_LNS_fixed_advance_pc:
635 if (
unlikely(standard_opcode_lengths[opcode] != 1))
636 goto invalid_unit_out;
641 case DW_LNS_set_prologue_end:
645 case DW_LNS_set_epilogue_begin:
647 epilogue_begin =
true;
651 if (
unlikely(standard_opcode_lengths[opcode] != 1))
652 goto invalid_unit_out;
653 clinep = (
const unsigned char *)linep;
655 linep = (
unsigned char *)clinep;
663 vwarn(
" unknown opcode with %" PRIu8
" parameters:",
664 standard_opcode_lengths[opcode]);
665 for (i = standard_opcode_lengths[opcode]; i > 0; --
i) {
666 clinep = (
const unsigned char *)linep;
668 linep = (
unsigned char *)clinep;
669 if (i != standard_opcode_lengths[opcode])
686 "invalid DWARF line info at offset %tu\n",linep - linestartp);
691 verror(
"invalid line data (overrun)!\n");
697 array_list_free(dirlist);
699 array_list_deep_free(filelist);
710 static const char *
const known_tags[] =
712 [DW_TAG_array_type] =
"array_type",
713 [DW_TAG_class_type] =
"class_type",
714 [DW_TAG_entry_point] =
"entry_point",
715 [DW_TAG_enumeration_type] =
"enumeration_type",
716 [DW_TAG_formal_parameter] =
"formal_parameter",
717 [DW_TAG_imported_declaration] =
"imported_declaration",
718 [DW_TAG_label] =
"label",
719 [DW_TAG_lexical_block] =
"lexical_block",
720 [DW_TAG_member] =
"member",
721 [DW_TAG_pointer_type] =
"pointer_type",
722 [DW_TAG_reference_type] =
"reference_type",
723 [DW_TAG_compile_unit] =
"compile_unit",
724 [DW_TAG_string_type] =
"string_type",
725 [DW_TAG_structure_type] =
"structure_type",
726 [DW_TAG_subroutine_type] =
"subroutine_type",
727 [DW_TAG_typedef] =
"typedef",
728 [DW_TAG_union_type] =
"union_type",
729 [DW_TAG_unspecified_parameters] =
"unspecified_parameters",
730 [DW_TAG_variant] =
"variant",
731 [DW_TAG_common_block] =
"common_block",
732 [DW_TAG_common_inclusion] =
"common_inclusion",
733 [DW_TAG_inheritance] =
"inheritance",
734 [DW_TAG_inlined_subroutine] =
"inlined_subroutine",
735 [DW_TAG_module] =
"module",
736 [DW_TAG_ptr_to_member_type] =
"ptr_to_member_type",
737 [DW_TAG_set_type] =
"set_type",
738 [DW_TAG_subrange_type] =
"subrange_type",
739 [DW_TAG_with_stmt] =
"with_stmt",
740 [DW_TAG_access_declaration] =
"access_declaration",
741 [DW_TAG_base_type] =
"base_type",
742 [DW_TAG_catch_block] =
"catch_block",
743 [DW_TAG_const_type] =
"const_type",
744 [DW_TAG_constant] =
"constant",
745 [DW_TAG_enumerator] =
"enumerator",
746 [DW_TAG_file_type] =
"file_type",
747 [DW_TAG_friend] =
"friend",
748 [DW_TAG_namelist] =
"namelist",
749 [DW_TAG_namelist_item] =
"namelist_item",
750 [DW_TAG_packed_type] =
"packed_type",
751 [DW_TAG_subprogram] =
"subprogram",
752 [DW_TAG_template_type_parameter] =
"template_type_parameter",
753 [DW_TAG_template_value_parameter] =
"template_value_parameter",
754 [DW_TAG_thrown_type] =
"thrown_type",
755 [DW_TAG_try_block] =
"try_block",
756 [DW_TAG_variant_part] =
"variant_part",
757 [DW_TAG_variable] =
"variable",
758 [DW_TAG_volatile_type] =
"volatile_type",
759 [DW_TAG_dwarf_procedure] =
"dwarf_procedure",
760 [DW_TAG_restrict_type] =
"restrict_type",
761 [DW_TAG_interface_type] =
"interface_type",
762 [DW_TAG_namespace] =
"namespace",
763 [DW_TAG_imported_module] =
"imported_module",
764 [DW_TAG_unspecified_type] =
"unspecified_type",
765 [DW_TAG_partial_unit] =
"partial_unit",
766 [DW_TAG_imported_unit] =
"imported_unit",
767 #if _INT_ELFUTILS_VERSION < 160
768 [DW_TAG_mutable_type] =
"mutable_type",
770 [DW_TAG_condition] =
"condition",
771 [DW_TAG_shared_type] =
"shared_type",
772 #if _INT_ELFUTILS_VERSION > 141
773 [DW_TAG_type_unit] =
"type_unit",
774 [DW_TAG_rvalue_reference_type] =
"rvalue_reference_type",
776 #if _INT_ELFUTILS_VERSION > 147
777 [DW_TAG_template_alias] =
"template_alias",
779 #if _INT_ELFUTILS_VERSION > 161
780 [DW_TAG_atomic_type] =
"atomic_type",
783 const unsigned int nknown_tags = (
sizeof (known_tags)
784 /
sizeof (known_tags[0]));
786 const char *
result = NULL;
788 if (
likely (tag < nknown_tags))
789 result = known_tags[tag];
795 case DW_TAG_MIPS_loop:
796 result =
"MIPS_loop";
799 case DW_TAG_format_label:
800 result =
"format_label";
803 case DW_TAG_function_template:
804 result =
"function_template";
807 case DW_TAG_class_template:
808 result =
"class_template";
811 #if _INT_ELFUTILS_VERSION >= 147
812 case DW_TAG_GNU_BINCL:
813 result =
"GNU_BINCL";
816 case DW_TAG_GNU_EINCL:
817 result =
"GNU_EINCL";
820 case DW_TAG_GNU_template_template_param:
821 result =
"GNU_template_template_param";
824 case DW_TAG_GNU_template_parameter_pack:
825 result =
"GNU_template_parameter_pack";
828 case DW_TAG_GNU_formal_parameter_pack:
829 result =
"GNU_formal_parameter_pack";
834 if (tag < DW_TAG_lo_user)
835 snprintf (buf,
sizeof buf,
"unknown tag %hx", tag);
837 snprintf (buf,
sizeof buf,
"unknown user tag %hx", tag);
852 static const char *
const known_attrs[] =
854 [DW_AT_sibling] =
"sibling",
855 [DW_AT_location] =
"location",
856 [DW_AT_name] =
"name",
857 [DW_AT_ordering] =
"ordering",
858 [DW_AT_subscr_data] =
"subscr_data",
859 [DW_AT_byte_size] =
"byte_size",
860 [DW_AT_bit_offset] =
"bit_offset",
861 [DW_AT_bit_size] =
"bit_size",
862 [DW_AT_element_list] =
"element_list",
863 [DW_AT_stmt_list] =
"stmt_list",
864 [DW_AT_low_pc] =
"low_pc",
865 [DW_AT_high_pc] =
"high_pc",
866 [DW_AT_language] =
"language",
867 [DW_AT_member] =
"member",
868 [DW_AT_discr] =
"discr",
869 [DW_AT_discr_value] =
"discr_value",
870 [DW_AT_visibility] =
"visibility",
871 [DW_AT_import] =
"import",
872 [DW_AT_string_length] =
"string_length",
873 [DW_AT_common_reference] =
"common_reference",
874 [DW_AT_comp_dir] =
"comp_dir",
875 [DW_AT_const_value] =
"const_value",
876 [DW_AT_containing_type] =
"containing_type",
877 [DW_AT_default_value] =
"default_value",
878 [DW_AT_inline] =
"inline",
879 [DW_AT_is_optional] =
"is_optional",
880 [DW_AT_lower_bound] =
"lower_bound",
881 [DW_AT_producer] =
"producer",
882 [DW_AT_prototyped] =
"prototyped",
883 [DW_AT_return_addr] =
"return_addr",
884 [DW_AT_start_scope] =
"start_scope",
885 [DW_AT_bit_stride] =
"bit_stride",
886 [DW_AT_upper_bound] =
"upper_bound",
887 [DW_AT_abstract_origin] =
"abstract_origin",
888 [DW_AT_accessibility] =
"accessibility",
889 [DW_AT_address_class] =
"address_class",
890 [DW_AT_artificial] =
"artificial",
891 [DW_AT_base_types] =
"base_types",
892 [DW_AT_calling_convention] =
"calling_convention",
893 [DW_AT_count] =
"count",
894 [DW_AT_data_member_location] =
"data_member_location",
895 [DW_AT_decl_column] =
"decl_column",
896 [DW_AT_decl_file] =
"decl_file",
897 [DW_AT_decl_line] =
"decl_line",
898 [DW_AT_declaration] =
"declaration",
899 [DW_AT_discr_list] =
"discr_list",
900 [DW_AT_encoding] =
"encoding",
901 [DW_AT_external] =
"external",
902 [DW_AT_frame_base] =
"frame_base",
903 [DW_AT_friend] =
"friend",
904 [DW_AT_identifier_case] =
"identifier_case",
905 [DW_AT_macro_info] =
"macro_info",
906 [DW_AT_namelist_item] =
"namelist_item",
907 [DW_AT_priority] =
"priority",
908 [DW_AT_segment] =
"segment",
909 [DW_AT_specification] =
"specification",
910 [DW_AT_static_link] =
"static_link",
911 [DW_AT_type] =
"type",
912 [DW_AT_use_location] =
"use_location",
913 [DW_AT_variable_parameter] =
"variable_parameter",
914 [DW_AT_virtuality] =
"virtuality",
915 [DW_AT_vtable_elem_location] =
"vtable_elem_location",
916 [DW_AT_allocated] =
"allocated",
917 [DW_AT_associated] =
"associated",
918 [DW_AT_data_location] =
"data_location",
919 [DW_AT_byte_stride] =
"byte_stride",
920 [DW_AT_entry_pc] =
"entry_pc",
921 [DW_AT_use_UTF8] =
"use_UTF8",
922 [DW_AT_extension] =
"extension",
923 [DW_AT_ranges] =
"ranges",
924 [DW_AT_trampoline] =
"trampoline",
925 [DW_AT_call_column] =
"call_column",
926 [DW_AT_call_file] =
"call_file",
927 [DW_AT_call_line] =
"call_line",
928 [DW_AT_description] =
"description",
929 [DW_AT_binary_scale] =
"binary_scale",
930 [DW_AT_decimal_scale] =
"decimal_scale",
931 [DW_AT_small] =
"small",
932 [DW_AT_decimal_sign] =
"decimal_sign",
933 [DW_AT_digit_count] =
"digit_count",
934 [DW_AT_picture_string] =
"picture_string",
935 [DW_AT_mutable] =
"mutable",
936 [DW_AT_threads_scaled] =
"threads_scaled",
937 [DW_AT_explicit] =
"explicit",
938 [DW_AT_object_pointer] =
"object_pointer",
939 [DW_AT_endianity] =
"endianity",
940 [DW_AT_elemental] =
"elemental",
941 [DW_AT_pure] =
"pure",
942 [DW_AT_recursive] =
"recursive",
943 #if _INT_ELFUTILS_VERSION > 141
944 [DW_AT_signature] =
"signature",
945 [DW_AT_main_subprogram] =
"main_subprogram",
946 [DW_AT_data_bit_offset] =
"data_bit_offset",
947 [DW_AT_const_expr] =
"const_expr",
949 #if _INT_ELFUTILS_VERSION > 147
950 [DW_AT_enum_class] =
"enum_class",
951 [DW_AT_linkage_name] =
"linkage_name",
954 const unsigned int nknown_attrs = (
sizeof (known_attrs)
955 /
sizeof (known_attrs[0]));
957 const char *
result = NULL;
959 if (
likely (attrnum < nknown_attrs))
960 result = known_attrs[attrnum];
970 case DW_AT_MIPS_loop_begin:
971 result =
"MIPS_loop_begin";
974 case DW_AT_MIPS_tail_loop_begin:
975 result =
"MIPS_tail_loop_begin";
978 case DW_AT_MIPS_epilog_begin:
979 result =
"MIPS_epilog_begin";
982 case DW_AT_MIPS_loop_unroll_factor:
983 result =
"MIPS_loop_unroll_factor";
986 case DW_AT_MIPS_software_pipeline_depth:
987 result =
"MIPS_software_pipeline_depth";
990 case DW_AT_MIPS_linkage_name:
991 result =
"MIPS_linkage_name";
994 case DW_AT_MIPS_stride:
995 result =
"MIPS_stride";
998 case DW_AT_MIPS_abstract_name:
999 result =
"MIPS_abstract_name";
1002 case DW_AT_MIPS_clone_origin:
1003 result =
"MIPS_clone_origin";
1006 case DW_AT_MIPS_has_inlines:
1007 result =
"MIPS_has_inlines";
1010 case DW_AT_MIPS_stride_byte:
1011 result =
"MIPS_stride_byte";
1014 case DW_AT_MIPS_stride_elem:
1015 result =
"MIPS_stride_elem";
1018 case DW_AT_MIPS_ptr_dopetype:
1019 result =
"MIPS_ptr_dopetype";
1022 case DW_AT_MIPS_allocatable_dopetype:
1023 result =
"MIPS_allocatable_dopetype";
1026 case DW_AT_MIPS_assumed_shape_dopetype:
1027 result =
"MIPS_assumed_shape_dopetype";
1030 case DW_AT_MIPS_assumed_size:
1031 result =
"MIPS_assumed_size";
1034 case DW_AT_sf_names:
1035 result =
"sf_names";
1038 case DW_AT_src_info:
1039 result =
"src_info";
1042 case DW_AT_mac_info:
1043 result =
"mac_info";
1046 case DW_AT_src_coords:
1047 result =
"src_coords";
1050 case DW_AT_body_begin:
1051 result =
"body_begin";
1054 case DW_AT_body_end:
1055 result =
"body_end";
1058 #if _INT_ELFUTILS_VERSION > 143
1059 case DW_AT_GNU_vector:
1060 result =
"GNU_vector";
1063 case DW_AT_GNU_guarded_by:
1064 result =
"GNU_guarded_by";
1067 case DW_AT_GNU_pt_guarded_by:
1068 result =
"GNU_pt_guarded_by";
1071 case DW_AT_GNU_guarded:
1072 result =
"GNU_guarded";
1075 case DW_AT_GNU_pt_guarded:
1076 result =
"GNU_pt_guarded";
1079 case DW_AT_GNU_locks_excluded:
1080 result =
"GNU_locks_excluded";
1083 case DW_AT_GNU_exclusive_locks_required:
1084 result =
"GNU_exclusive_locks_required";
1087 case DW_AT_GNU_shared_locks_required:
1088 result =
"GNU_shared_locks_required";
1091 case DW_AT_GNU_odr_signature:
1092 result =
"GNU_odr_signature";
1095 case DW_AT_GNU_template_name:
1096 result =
"GNU_template_name";
1101 if (attrnum < DW_AT_lo_user)
1102 snprintf (buf,
sizeof buf,
"unknown attribute %hx",
1105 snprintf (buf,
sizeof buf,
"unknown user attribute %hx",
1121 static const char *
const known_forms[] =
1123 [DW_FORM_addr] =
"addr",
1124 [DW_FORM_block2] =
"block2",
1125 [DW_FORM_block4] =
"block4",
1126 [DW_FORM_data2] =
"data2",
1127 [DW_FORM_data4] =
"data4",
1128 [DW_FORM_data8] =
"data8",
1129 [DW_FORM_string] =
"string",
1130 [DW_FORM_block] =
"block",
1131 [DW_FORM_block1] =
"block1",
1132 [DW_FORM_data1] =
"data1",
1133 [DW_FORM_flag] =
"flag",
1134 [DW_FORM_sdata] =
"sdata",
1135 [DW_FORM_strp] =
"strp",
1136 [DW_FORM_udata] =
"udata",
1137 [DW_FORM_ref_addr] =
"ref_addr",
1138 [DW_FORM_ref1] =
"ref1",
1139 [DW_FORM_ref2] =
"ref2",
1140 [DW_FORM_ref4] =
"ref4",
1141 [DW_FORM_ref8] =
"ref8",
1142 [DW_FORM_ref_udata] =
"ref_udata",
1143 [DW_FORM_indirect] =
"indirect",
1144 #if _INT_ELFUTILS_VERSION > 141
1145 [DW_FORM_sec_offset] =
"sec_offset",
1146 [DW_FORM_exprloc] =
"exprloc",
1147 [DW_FORM_flag_present] =
"flag_present",
1148 [DW_FORM_ref_sig8] =
"ref_sig8"
1151 const unsigned int nknown_forms = (
sizeof (known_forms)
1152 /
sizeof (known_forms[0]));
1153 static char buf[40];
1154 const char *
result = NULL;
1156 if (
likely (form < nknown_forms))
1157 result = known_forms[form];
1160 snprintf (buf,
sizeof buf,
"unknown form %x",form);
1172 static const char *
const known[] =
1174 [DW_LANG_C89] =
"ISO C89",
1176 [DW_LANG_Ada83] =
"Ada83",
1177 [DW_LANG_C_plus_plus] =
"C++",
1178 [DW_LANG_Cobol74] =
"Cobol74",
1179 [DW_LANG_Cobol85] =
"Cobol85",
1180 [DW_LANG_Fortran77] =
"Fortran77",
1181 [DW_LANG_Fortran90] =
"Fortran90",
1182 [DW_LANG_Pascal83] =
"Pascal83",
1183 [DW_LANG_Modula2] =
"Modula2",
1184 [DW_LANG_Java] =
"Java",
1185 [DW_LANG_C99] =
"ISO C99",
1186 [DW_LANG_Ada95] =
"Ada95",
1187 [DW_LANG_Fortran95] =
"Fortran95",
1188 [DW_LANG_PL1] =
"PL1",
1189 #if _INT_ELFUTILS_VERSION >= 155
1190 [DW_LANG_ObjC] =
"Objective C",
1192 [DW_LANG_Objc] =
"Objective C",
1194 [DW_LANG_ObjC_plus_plus] =
"Objective C++",
1195 [DW_LANG_UPC] =
"UPC",
1199 if (
likely (lang <
sizeof (known) /
sizeof (known[0])))
1201 else if (lang == DW_LANG_Mips_Assembler)
1205 if (lang >= DW_LANG_lo_user && lang <= DW_LANG_hi_user)
1207 static char buf[30];
1208 snprintf (buf,
sizeof (buf),
"lo_user+%u", lang - DW_LANG_lo_user);
1222 static const char *
const known[] =
1224 [DW_INL_not_inlined] =
"not_inlined",
1225 [DW_INL_inlined] =
"inlined",
1226 [DW_INL_declared_not_inlined] =
"declared_not_inlined",
1227 [DW_INL_declared_inlined] =
"declared_inlined"
1230 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1243 static const char *
const known[] =
1245 [DW_ATE_void] =
"void",
1246 [DW_ATE_address] =
"address",
1247 [DW_ATE_boolean] =
"boolean",
1248 [DW_ATE_complex_float] =
"complex_float",
1249 [DW_ATE_float] =
"float",
1250 [DW_ATE_signed] =
"signed",
1251 [DW_ATE_signed_char] =
"signed_char",
1252 [DW_ATE_unsigned] =
"unsigned",
1253 [DW_ATE_unsigned_char] =
"unsigned_char",
1254 [DW_ATE_imaginary_float] =
"imaginary_float",
1255 [DW_ATE_packed_decimal] =
"packed_decimal",
1256 [DW_ATE_numeric_string] =
"numeric_string",
1257 [DW_ATE_edited] =
"edited",
1258 [DW_ATE_signed_fixed] =
"signed_fixed",
1259 [DW_ATE_unsigned_fixed] =
"unsigned_fixed",
1260 [DW_ATE_decimal_float] =
"decimal_float",
1263 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1266 if (code >= DW_ATE_lo_user && code <= DW_ATE_hi_user)
1268 static char buf[30];
1269 snprintf (buf,
sizeof (buf),
"lo_user+%u", code - DW_ATE_lo_user);
1283 static const char *
const known[] =
1285 [DW_ACCESS_public] =
"public",
1286 [DW_ACCESS_protected] =
"protected",
1287 [DW_ACCESS_private] =
"private"
1290 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1303 static const char *
const known[] =
1305 [DW_VIS_local] =
"local",
1306 [DW_VIS_exported] =
"exported",
1307 [DW_VIS_qualified] =
"qualified"
1310 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1323 static const char *
const known[] =
1325 [DW_VIRTUALITY_none] =
"none",
1326 [DW_VIRTUALITY_virtual] =
"virtual",
1327 [DW_VIRTUALITY_pure_virtual] =
"pure_virtual"
1330 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1343 static const char *
const known[] =
1345 [DW_ID_case_sensitive] =
"sensitive",
1346 [DW_ID_up_case] =
"up_case",
1347 [DW_ID_down_case] =
"down_case",
1348 [DW_ID_case_insensitive] =
"insensitive"
1351 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1364 static const char *
const known[] =
1366 [DW_CC_normal] =
"normal",
1367 [DW_CC_program] =
"program",
1368 [DW_CC_nocall] =
"nocall",
1371 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1374 if (code >= DW_CC_lo_user && code <= DW_CC_hi_user)
1376 static char buf[30];
1377 snprintf (buf,
sizeof (buf),
"lo_user+%u", code - DW_CC_lo_user);
1391 static const char *
const known[] =
1393 [DW_ORD_row_major] =
"row_major",
1394 [DW_ORD_col_major] =
"col_major"
1397 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
1410 static const char *
const known[] =
1412 [DW_DSC_label] =
"label",
1413 [DW_DSC_range] =
"range"
1416 if (
likely (code <
sizeof (known) /
sizeof (known[0])))
int symbol_contains_addr(struct symbol *symbol, ADDR obj_addr)
#define vwarnopt(level, area, flags, format,...)
const char * dwarf_encoding_string(unsigned int code)
const char * dwarf_ordering_string(unsigned int code)
const char * dwarf_attr_string(unsigned int attrnum)
struct scope * symbol_read_owned_scope(struct symbol *symbol)
static uint64_t unsigned int i
GHashTable * srcaddrlines
const char * dwarf_virtuality_string(unsigned int code)
#define get_uleb128(var, addr)
int clmatchone_add(clmatchone_t *clf, Word_t index, void *data)
const char * dwarf_access_string(unsigned int code)
#define verror(format,...)
#define SYMBOLX_ROOT(sym)
#define vwarn(format,...)
const char * dwarf_identifier_case_string(unsigned int code)
const char * dwarf_discr_list_string(unsigned int code)
const char * dwarf_form_string(unsigned int form)
int clmatch_add(clmatch_t *clf, Word_t index, void *data)
struct debugfile * debugfile
#define read_8ubyte_unaligned_inc(obo, Addr)
#define vdebug(devel, areas, flags, format,...)
const char * dwarf_tag_string(unsigned int tag)
const char * dwarf_inline_string(unsigned int code)
#define SYMBOL_WX_FUNC(sym, wvar, reterr)
#define get_sleb128(var, addr)
#define read_4ubyte_unaligned_inc(obo, Addr)
#define vwarnc(format,...)
const char * dwarf_visibility_string(unsigned int code)
#define read_2ubyte_unaligned_inc(obo, Addr)
int dwarf_get_lines(struct symbol_root_dwarf *srd, Dwarf_Off offset)
char * symbol_get_name(struct symbol *symbol)
struct symbol_root * root
void * malloc(size_t size)
const char * dwarf_calling_convention_string(unsigned int code)
#define SYMBOL_IS_FUNC(sym)
const char * dwarf_lang_string(unsigned int lang)