gprofng SIGSEGV when processing unusual dwarf

Vladimir Mezentsev vladimir.mezentsev@oracle.com
Tue Feb 7 22:44:57 GMT 2023


Hi Gilles,



On 2/7/23 01:39, Gilles DUBOSCQ wrote:
> Hi Vladimir,
>
> I saw you posted a patch for this. A few remarks:
> * Regarding the NO_STMT_LIST, i'm not sure what it the correct/portable way of defining uint64_t constants, i used a ULL literal for my tests but maybe UINT64_MAX should be used instead? I'm not sure exactly if this is available in all the environments where gprofng is built.

  I see that we use  ((uint64_t)(-1)).
I made thee similar fix for  NO_STMT_LIST:

#define NO_STMT_LIST ((uint64_t) -1)


> * Regarding the change in DwrCU::parse_cu_header, i think Dwarf_ref will also return 0 when the attribute is not found, what i was trying to achieve in my tests was for stmt_list_offset to be kept at its default NO_STMT_LIST value if the attribute is absent.

You are right.
I made this fix:

   int64_t v;
   if (read_ref_attr(DW_AT_stmt_list, &v) == DW_DLV_OK)
     stmt_list_offset = v;


Thank you for review.
Thank you for contributing to gprofng.
Thank you for using gprofng.

-Vladimir


>
> Best regards,
>   Gilles



More information about the Binutils mailing list