@@ -4735,8 +4735,8 @@ print_attribute(Dwarf_Debug dbg, Dwarf_Die die,
47354735 case DW_AT_language_version : {
47364736 char atnamebuf [ESB_FIXED_ALLOC_SIZE ];
47374737 struct esb_s langver ;
4738-
4739- if (fc != DW_FORM_CLASS_STRING ) {
4738+
4739+ if (fc != DW_FORM_CLASS_CONSTANT ) {
47404740 remark_wrong_string_format (attr ,theform );
47414741 esb_destructor (& valname );
47424742 esb_destructor (& esb_extra );
@@ -4784,7 +4784,7 @@ print_attribute(Dwarf_Debug dbg, Dwarf_Die die,
47844784 & lv_lower_bound , & lv_version_details );
47854785 if (res == DW_DLV_OK ) {
47864786 esb_append_printf_i (& valname ,
4787- "(low bound: %d" ,lv_lower_bound );
4787+ " (low bound: %d" ,lv_lower_bound );
47884788 if (lv_version_details ) {
47894789 esb_append_printf_s (& valname ,
47904790 " format: %s)" ,
@@ -8613,7 +8613,16 @@ get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
86138613 Dwarf_Bool hex_format = TRUE;
86148614 Dwarf_Half dwversion = 0 ;
86158615
8616- formx_unsigned (tempud ,esbp ,hex_format );
8616+ if (attr == DW_AT_language_version ) {
8617+ hex_format = FALSE;
8618+ formx_unsigned (tempud ,esbp ,hex_format );
8619+ esb_append (esbp ," (" );
8620+ hex_format = TRUE;
8621+ formx_unsigned (tempud ,esbp ,hex_format );
8622+ esb_append (esbp ,")" );
8623+ } else {
8624+ formx_unsigned (tempud ,esbp ,hex_format );
8625+ }
86178626 /* Check attribute encoding */
86188627 if (glflags .gf_check_attr_encoding ) {
86198628 check_attributes_encoding (attr ,theform ,
@@ -8778,34 +8787,77 @@ get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
87788787 }
87798788 }
87808789 break ;
8781- case DW_FORM_sdata :
8782- wres = dwarf_formsdata (attrib , & tempsd , err );
8783- if (wres == DW_DLV_OK ) {
8784- Dwarf_Bool hxform = TRUE;
8785- tempud = tempsd ;
8786- formx_unsigned_and_signed_if_neg (tempud ,tempsd ,
8787- " (" ,hxform ,esbp );
8788- } else if (wres == DW_DLV_NO_ENTRY ) {
8789- /* nothing? */
8790- } else {
8791- print_error_and_continue (
8792- "Cannot get DW_FORM_sdata value.." ,
8793- wres , * err );
8794- return wres ;
8790+ case DW_FORM_sdata : {
8791+ Dwarf_Half attrs = 0 ;
8792+ int ares = 0 ;
8793+ Dwarf_Bool hxform = TRUE;
8794+ Dwarf_Error attrerr = 0 ;
8795+
8796+ ares = dwarf_whatattr (attrib , & attrs , & attrerr );
8797+ { /* Do regardless of ares value! */
8798+ wres = dwarf_formsdata (attrib , & tempsd , err );
8799+ if (wres == DW_DLV_OK ) {
8800+ tempud = tempsd ;
8801+ if (attrs == DW_AT_language_version ) {
8802+ hxform = FALSE;
8803+ formx_signed (tempsd ,esbp );
8804+ esb_append (esbp ," (" );
8805+ hxform = TRUE;
8806+ formx_unsigned_and_signed_if_neg (tempud ,tempsd ,
8807+ " (" ,hxform ,esbp );
8808+ esb_append (esbp ,")" );
8809+ } else {
8810+ formx_unsigned_and_signed_if_neg (tempud ,tempsd ,
8811+ " (" ,hxform ,esbp );
8812+ }
8813+ } else if (wres == DW_DLV_NO_ENTRY ) {
8814+ /* nothing? */
8815+ } else {
8816+ print_error_and_continue (
8817+ "Cannot get DW_FORM_sdata value.." ,
8818+ wres , * err );
8819+ return wres ;
8820+ }
8821+ }
8822+ if (ares == DW_DLV_ERROR ) {
8823+ /* leave no trace, caught elsewhere. */
8824+ dwarf_dealloc_error (dbg ,attrerr );
8825+ }
87958826 }
87968827 break ;
8797- case DW_FORM_udata :
8798- wres = dwarf_formudata (attrib , & tempud , err );
8799- if (wres == DW_DLV_OK ) {
8800- Dwarf_Bool hex_format = TRUE;
8801- formx_unsigned (tempud ,esbp ,hex_format );
8802- } else if (wres == DW_DLV_NO_ENTRY ) {
8803- /* nothing? */
8804- } else {
8805- print_error_and_continue (
8806- "Cannot get DW_FORM_udata value.." ,
8807- wres , * err );
8808- return wres ;
8828+ case DW_FORM_udata : {
8829+ Dwarf_Half attru = 0 ;
8830+ int ares = 0 ;
8831+ Dwarf_Error attrerr = 0 ;
8832+
8833+ ares = dwarf_whatattr (attrib , & attru , err );
8834+ { /* Do regardless of ares value! */
8835+ wres = dwarf_formudata (attrib , & tempud , err );
8836+ if (wres == DW_DLV_OK ) {
8837+ Dwarf_Bool hex_format = TRUE;
8838+ if (attru == DW_AT_language_version ) {
8839+ hex_format = FALSE;
8840+ formx_unsigned (tempud ,esbp ,hex_format );
8841+ esb_append (esbp ," (" );
8842+ hex_format = TRUE;
8843+ formx_unsigned (tempud ,esbp ,hex_format );
8844+ esb_append (esbp ,")" );
8845+ } else {
8846+ formx_unsigned (tempud ,esbp ,hex_format );
8847+ }
8848+ } else if (wres == DW_DLV_NO_ENTRY ) {
8849+ /* nothing? */
8850+ } else {
8851+ print_error_and_continue (
8852+ "Cannot get DW_FORM_udata value.." ,
8853+ wres , * err );
8854+ return wres ;
8855+ }
8856+ }
8857+ if (ares == DW_DLV_ERROR ) {
8858+ /* leave no trace, caught elsewhere. */
8859+ dwarf_dealloc_error (dbg ,attrerr );
8860+ }
88098861 }
88108862 break ;
88118863 /* various forms for strings. */
0 commit comments