@@ -379,7 +379,7 @@ enum drgn_dwarf_index_abbrev_insn {
379379 * Instructions > 0 and <= INSN_MAX_SKIP indicate a number of bytes to
380380 * be skipped over.
381381 */
382- INSN_MAX_SKIP = 199 ,
382+ INSN_MAX_SKIP = 193 ,
383383
384384 /* These instructions indicate an attribute that can be skipped over. */
385385 INSN_SKIP_BLOCK ,
@@ -403,6 +403,8 @@ enum drgn_dwarf_index_abbrev_insn {
403403 INSN_NAME_STRX2 ,
404404 INSN_NAME_STRX3 ,
405405 INSN_NAME_STRX4 ,
406+ INSN_NAME_STRP_ALT4 ,
407+ INSN_NAME_STRP_ALT8 ,
406408 INSN_COMP_DIR_STRP4 ,
407409 INSN_COMP_DIR_STRP8 ,
408410 INSN_COMP_DIR_LINE_STRP4 ,
@@ -413,6 +415,8 @@ enum drgn_dwarf_index_abbrev_insn {
413415 INSN_COMP_DIR_STRX2 ,
414416 INSN_COMP_DIR_STRX3 ,
415417 INSN_COMP_DIR_STRX4 ,
418+ INSN_COMP_DIR_STRP_ALT4 ,
419+ INSN_COMP_DIR_STRP_ALT8 ,
416420 INSN_STR_OFFSETS_BASE4 ,
417421 INSN_STR_OFFSETS_BASE8 ,
418422 INSN_STMT_LIST_LINEPTR4 ,
@@ -435,6 +439,8 @@ enum drgn_dwarf_index_abbrev_insn {
435439 INSN_SPECIFICATION_REF_UDATA ,
436440 INSN_SPECIFICATION_REF_ADDR4 ,
437441 INSN_SPECIFICATION_REF_ADDR8 ,
442+ INSN_SPECIFICATION_REF_ALT4 ,
443+ INSN_SPECIFICATION_REF_ALT8 ,
438444 INSN_INDIRECT ,
439445 INSN_SIBLING_INDIRECT ,
440446 INSN_NAME_INDIRECT ,
@@ -674,6 +680,8 @@ static struct drgn_error *dw_form_to_insn(struct drgn_dwarf_index_cu *cu,
674680 case DW_FORM_strp :
675681 case DW_FORM_strp_sup :
676682 case DW_FORM_line_strp :
683+ case DW_FORM_GNU_ref_alt :
684+ case DW_FORM_GNU_strp_alt :
677685 * insn_ret = cu -> is_64_bit ? 8 : 4 ;
678686 return NULL ;
679687 case DW_FORM_string :
@@ -759,6 +767,16 @@ static struct drgn_error *dw_at_name_to_insn(struct drgn_dwarf_index_cu *cu,
759767 case DW_FORM_strx4 :
760768 * insn_ret = INSN_NAME_STRX4 ;
761769 return NULL ;
770+ case DW_FORM_GNU_strp_alt :
771+ if (!cu -> module -> alt_debug_str_data ) {
772+ return binary_buffer_error (bb ,
773+ "DW_FORM_GNU_strp_alt without alternate .debug_str section" );
774+ }
775+ if (cu -> is_64_bit )
776+ * insn_ret = INSN_NAME_STRP_ALT8 ;
777+ else
778+ * insn_ret = INSN_NAME_STRP_ALT4 ;
779+ return NULL ;
762780 case DW_FORM_indirect :
763781 * insn_ret = INSN_NAME_INDIRECT ;
764782 return NULL ;
@@ -813,6 +831,16 @@ static struct drgn_error *dw_at_comp_dir_to_insn(struct drgn_dwarf_index_cu *cu,
813831 case DW_FORM_strx4 :
814832 * insn_ret = INSN_COMP_DIR_STRX4 ;
815833 return NULL ;
834+ case DW_FORM_GNU_strp_alt :
835+ if (!cu -> module -> alt_debug_str_data ) {
836+ return binary_buffer_error (bb ,
837+ "DW_FORM_GNU_strp_alt without alternate .debug_str section" );
838+ }
839+ if (cu -> is_64_bit )
840+ * insn_ret = INSN_COMP_DIR_STRP_ALT8 ;
841+ else
842+ * insn_ret = INSN_COMP_DIR_STRP_ALT4 ;
843+ return NULL ;
816844 case DW_FORM_indirect :
817845 * insn_ret = INSN_COMP_DIR_INDIRECT ;
818846 return NULL ;
@@ -976,6 +1004,16 @@ dw_at_specification_to_insn(struct drgn_dwarf_index_cu *cu,
9761004 cu -> address_size );
9771005 }
9781006 return NULL ;
1007+ case DW_FORM_GNU_ref_alt :
1008+ if (!cu -> module -> alt_debug_info_data ) {
1009+ return binary_buffer_error (bb ,
1010+ "DW_FORM_GNU_ref_alt without alternate .debug_info section" );
1011+ }
1012+ if (cu -> is_64_bit )
1013+ * insn_ret = INSN_SPECIFICATION_REF_ALT8 ;
1014+ else
1015+ * insn_ret = INSN_SPECIFICATION_REF_ALT4 ;
1016+ return NULL ;
9791017 case DW_FORM_indirect :
9801018 * insn_ret = INSN_SPECIFICATION_INDIRECT ;
9811019 return NULL ;
@@ -2092,6 +2130,17 @@ indirect_insn:;
20922130 return err ;
20932131 comp_dir = & comp_dir_is_strx ;
20942132 break ;
2133+ case INSN_COMP_DIR_STRP_ALT4 :
2134+ if ((err = binary_buffer_next_u32_into_u64 (& buffer -> bb ,
2135+ & tmp )))
2136+ return err ;
2137+ strp_scn = cu -> module -> alt_debug_str_data ;
2138+ goto comp_dir_strp ;
2139+ case INSN_COMP_DIR_STRP_ALT8 :
2140+ if ((err = binary_buffer_next_u64 (& buffer -> bb , & tmp )))
2141+ return err ;
2142+ strp_scn = cu -> module -> alt_debug_str_data ;
2143+ goto comp_dir_strp ;
20952144 case INSN_STR_OFFSETS_BASE4 :
20962145 if ((err = binary_buffer_next_u32_into_u64 (& buffer -> bb ,
20972146 & tmp )))
@@ -2135,10 +2184,12 @@ indirect_insn:;
21352184 goto skip ;
21362185 case INSN_NAME_STRP4 :
21372186 case INSN_NAME_STRX4 :
2187+ case INSN_NAME_STRP_ALT4 :
21382188 case INSN_DECL_FILE_DATA4 :
21392189 skip = 4 ;
21402190 goto skip ;
21412191 case INSN_NAME_STRP8 :
2192+ case INSN_NAME_STRP_ALT8 :
21422193 case INSN_DECL_FILE_DATA8 :
21432194 skip = 8 ;
21442195 goto skip ;
@@ -2194,6 +2245,19 @@ indirect_insn:;
21942245specification_ref_addr :
21952246 specification = (uintptr_t )debug_info_buffer + tmp ;
21962247 break ;
2248+ case INSN_SPECIFICATION_REF_ALT4 :
2249+ if ((err = binary_buffer_next_u32_into_u64 (& buffer -> bb ,
2250+ & tmp )))
2251+ return err ;
2252+ goto specification_ref_alt ;
2253+ case INSN_SPECIFICATION_REF_ALT8 :
2254+ if ((err = binary_buffer_next_u64 (& buffer -> bb ,
2255+ & tmp )))
2256+ return err ;
2257+ specification_ref_alt :
2258+ specification = ((uintptr_t )cu -> module -> alt_debug_info_data -> d_buf
2259+ + tmp );
2260+ break ;
21972261 case INSN_INDIRECT :
21982262 case INSN_SIBLING_INDIRECT :
21992263 case INSN_NAME_INDIRECT :
@@ -2545,14 +2609,32 @@ indirect_insn:;
25452609 return err ;
25462610 __builtin_prefetch (name );
25472611 break ;
2612+ case INSN_NAME_STRP_ALT4 :
2613+ if ((err = binary_buffer_next_u32_into_u64 (& buffer -> bb ,
2614+ & tmp )))
2615+ return err ;
2616+ goto name_alt_strp ;
2617+ case INSN_NAME_STRP_ALT8 :
2618+ if ((err = binary_buffer_next_u64 (& buffer -> bb , & tmp )))
2619+ return err ;
2620+ name_alt_strp :
2621+ if (tmp >= cu -> module -> alt_debug_str_data -> d_size ) {
2622+ return binary_buffer_error (& buffer -> bb ,
2623+ "DW_AT_name is out of bounds" );
2624+ }
2625+ name = (const char * )cu -> module -> alt_debug_str_data -> d_buf + tmp ;
2626+ __builtin_prefetch (name );
2627+ break ;
25482628 case INSN_COMP_DIR_STRP4 :
25492629 case INSN_COMP_DIR_LINE_STRP4 :
2630+ case INSN_COMP_DIR_STRP_ALT4 :
25502631 case INSN_STR_OFFSETS_BASE4 :
25512632 case INSN_STMT_LIST_LINEPTR4 :
25522633 skip = 4 ;
25532634 goto skip ;
25542635 case INSN_COMP_DIR_STRP8 :
25552636 case INSN_COMP_DIR_LINE_STRP8 :
2637+ case INSN_COMP_DIR_STRP_ALT8 :
25562638 case INSN_STR_OFFSETS_BASE8 :
25572639 case INSN_STMT_LIST_LINEPTR8 :
25582640 skip = 8 ;
@@ -2623,13 +2705,15 @@ indirect_insn:;
26232705 goto skip ;
26242706 case INSN_SPECIFICATION_REF4 :
26252707 case INSN_SPECIFICATION_REF_ADDR4 :
2708+ case INSN_SPECIFICATION_REF_ALT4 :
26262709 specification = true;
26272710 /* fallthrough */
26282711 case INSN_COMP_DIR_STRX4 :
26292712 skip = 4 ;
26302713 goto skip ;
26312714 case INSN_SPECIFICATION_REF8 :
26322715 case INSN_SPECIFICATION_REF_ADDR8 :
2716+ case INSN_SPECIFICATION_REF_ALT8 :
26332717 specification = true;
26342718 skip = 8 ;
26352719 goto skip ;
0 commit comments