@@ -244,9 +244,9 @@ int64_t readSLEB(std::string_view & sp)
244244}
245245
246246// Read a value of "section offset" type, which may be 4 or 8 bytes
247- uint64_t readOffset (std::string_view & sp, bool is64Bit )
247+ uint64_t readOffset (std::string_view & sp, bool is64_bit )
248248{
249- return is64Bit ? read<uint64_t >(sp) : read<uint32_t >(sp);
249+ return is64_bit ? read<uint64_t >(sp) : read<uint32_t >(sp);
250250}
251251
252252// Read "len" bytes
@@ -561,7 +561,7 @@ Dwarf::Attribute Dwarf::readAttribute(const CompilationUnit & cu,
561561 // The DW_AT_*_base attrs are CU specific; so we read them just after
562562 // reading the CU header. During this first pass return empty values
563563 // when encountering a FORM that depends on DW_AT_*_base.
564- auto getStringUsingOffsetTable = [&](uint64_t index)
564+ auto get_string_using_offset_table = [&](uint64_t index)
565565 {
566566 if (!cu.str_offsets_base .has_value ())
567567 {
@@ -572,11 +572,11 @@ Dwarf::Attribute Dwarf::readAttribute(const CompilationUnit & cu,
572572 // the header. The entries are indexed sequentially from this base entry,
573573 // starting from 0.
574574 auto sp = str_offsets_.substr (*cu.str_offsets_base + index * (cu.is64Bit ? sizeof (uint64_t ) : sizeof (uint32_t )));
575- uint64_t strOffset = readOffset (sp, cu.is64Bit );
576- return getStringFromStringSection (str_, strOffset );
575+ uint64_t str_offset = readOffset (sp, cu.is64Bit );
576+ return getStringFromStringSection (str_, str_offset );
577577 };
578578
579- auto readDebugAddr = [&](uint64_t index)
579+ auto read_debug_addr = [&](uint64_t index)
580580 {
581581 if (!cu.addr_base .has_value ())
582582 {
@@ -654,38 +654,38 @@ Dwarf::Attribute Dwarf::readAttribute(const CompilationUnit & cu,
654654 return {spec, die, static_cast <uint64_t >(spec.implicitConst )};
655655
656656 case DW_FORM_addrx:
657- return {spec, die, readDebugAddr (readULEB (info))};
657+ return {spec, die, read_debug_addr (readULEB (info))};
658658 case DW_FORM_addrx1:
659- return {spec, die, readDebugAddr (readU64<1 >(info))};
659+ return {spec, die, read_debug_addr (readU64<1 >(info))};
660660 case DW_FORM_addrx2:
661- return {spec, die, readDebugAddr (readU64<2 >(info))};
661+ return {spec, die, read_debug_addr (readU64<2 >(info))};
662662 case DW_FORM_addrx3:
663- return {spec, die, readDebugAddr (readU64<3 >(info))};
663+ return {spec, die, read_debug_addr (readU64<3 >(info))};
664664 case DW_FORM_addrx4:
665- return {spec, die, readDebugAddr (readU64<4 >(info))};
665+ return {spec, die, read_debug_addr (readU64<4 >(info))};
666666
667667 case DW_FORM_line_strp:
668668 return {spec, die, getStringFromStringSection (line_str_, readOffset (info, die.is64Bit ))};
669669
670670 case DW_FORM_strx:
671- return {spec, die, getStringUsingOffsetTable (readULEB (info))};
671+ return {spec, die, get_string_using_offset_table (readULEB (info))};
672672 case DW_FORM_strx1:
673- return {spec, die, getStringUsingOffsetTable (readU64<1 >(info))};
673+ return {spec, die, get_string_using_offset_table (readU64<1 >(info))};
674674 case DW_FORM_strx2:
675- return {spec, die, getStringUsingOffsetTable (readU64<2 >(info))};
675+ return {spec, die, get_string_using_offset_table (readU64<2 >(info))};
676676 case DW_FORM_strx3:
677- return {spec, die, getStringUsingOffsetTable (readU64<3 >(info))};
677+ return {spec, die, get_string_using_offset_table (readU64<3 >(info))};
678678 case DW_FORM_strx4:
679- return {spec, die, getStringUsingOffsetTable (readU64<4 >(info))};
679+ return {spec, die, get_string_using_offset_table (readU64<4 >(info))};
680680
681681 case DW_FORM_rnglistx: {
682682 auto index = readULEB (info);
683683 if (!cu.rnglists_base .has_value ())
684684 {
685685 return {spec, die, 0ULL };
686686 }
687- const uint64_t offsetSize = cu.is64Bit ? sizeof (uint64_t ) : sizeof (uint32_t );
688- auto sp = rnglists_.substr (*cu.rnglists_base + index * offsetSize );
687+ const uint64_t offset_size = cu.is64Bit ? sizeof (uint64_t ) : sizeof (uint32_t );
688+ auto sp = rnglists_.substr (*cu.rnglists_base + index * offset_size );
689689 auto offset = readOffset (sp, cu.is64Bit );
690690 return {spec, die, *cu.rnglists_base + offset};
691691 }
@@ -696,8 +696,8 @@ Dwarf::Attribute Dwarf::readAttribute(const CompilationUnit & cu,
696696 {
697697 return {spec, die, 0ULL };
698698 }
699- const uint64_t offsetSize = cu.is64Bit ? sizeof (uint64_t ) : sizeof (uint32_t );
700- auto sp = loclists_.substr (*cu.loclists_base + index * offsetSize );
699+ const uint64_t offset_size = cu.is64Bit ? sizeof (uint64_t ) : sizeof (uint32_t );
700+ auto sp = loclists_.substr (*cu.loclists_base + index * offset_size );
701701 auto offset = readOffset (sp, cu.is64Bit );
702702 return {spec, die, *cu.loclists_base + offset};
703703 }
@@ -738,9 +738,9 @@ Dwarf::CompilationUnit Dwarf::getCompilationUnit(uint64_t offset) const
738738 chunk.remove_prefix (offset);
739739
740740 // 1) unit_length
741- auto initialLength = read<uint32_t >(chunk);
742- cu.is64Bit = (initialLength == uint32_t (-1 ));
743- cu.size = cu.is64Bit ? read<uint64_t >(chunk) : initialLength ;
741+ auto initial_length = read<uint32_t >(chunk);
742+ cu.is64Bit = (initial_length == uint32_t (-1 ));
743+ cu.size = cu.is64Bit ? read<uint64_t >(chunk) : initial_length ;
744744 SAFE_CHECK (cu.size <= chunk.size (), " invalid chunk size" );
745745 cu.size += cu.is64Bit ? 12 : 4 ;
746746
@@ -832,11 +832,11 @@ Dwarf::CompilationUnit Dwarf::findCompilationUnit(uint64_t targetOffset) const
832832 std::string_view chunk (info_);
833833 chunk.remove_prefix (offset);
834834
835- auto initialLength = read<uint32_t >(chunk);
836- auto is64Bit = (initialLength == static_cast <uint32_t >(-1 ));
837- auto size = is64Bit ? read<uint64_t >(chunk) : initialLength ;
835+ auto initial_length = read<uint32_t >(chunk);
836+ auto is64_bit = (initial_length == static_cast <uint32_t >(-1 ));
837+ auto size = is64_bit ? read<uint64_t >(chunk) : initial_length ;
838838 SAFE_CHECK (size <= chunk.size (), " invalid chunk size" );
839- size += is64Bit ? 12 : 4 ;
839+ size += is64_bit ? 12 : 4 ;
840840
841841 if (offset + size > targetOffset)
842842 {
@@ -862,7 +862,7 @@ Dwarf::DIEAbbreviation Dwarf::getAbbreviation(uint64_t code, uint64_t offset) co
862862 SAFE_CHECK (false , " could not find abbreviation code" );
863863}
864864
865- Dwarf::AttributeValue Dwarf::readAttributeValue (std::string_view & sp, uint64_t form, bool is64Bit ) const
865+ Dwarf::AttributeValue Dwarf::readAttributeValue (std::string_view & sp, uint64_t form, bool is64_bit ) const
866866{
867867 switch (form)
868868 {
@@ -900,13 +900,13 @@ Dwarf::AttributeValue Dwarf::readAttributeValue(std::string_view & sp, uint64_t
900900 return uint64_t (1 );
901901 case DW_FORM_sec_offset: [[fallthrough]];
902902 case DW_FORM_ref_addr:
903- return readOffset (sp, is64Bit );
903+ return readOffset (sp, is64_bit );
904904 case DW_FORM_string:
905905 return readNullTerminated (sp);
906906 case DW_FORM_strp:
907- return getStringFromStringSection (str_, readOffset (sp, is64Bit ));
907+ return getStringFromStringSection (str_, readOffset (sp, is64_bit ));
908908 case DW_FORM_indirect: // form is explicitly specified
909- return readAttributeValue (sp, readULEB (sp), is64Bit );
909+ return readAttributeValue (sp, readULEB (sp), is64_bit );
910910 default :
911911 SAFE_CHECK (false , " invalid attribute form" );
912912 }
@@ -1470,16 +1470,16 @@ bool Dwarf::isAddrInRangeList(const CompilationUnit & cu,
14701470 SAFE_CHECK (addr_size == 4 || addr_size == 8 , " wrong address size" );
14711471 if (cu.version <= 4 && !ranges_.empty ())
14721472 {
1473- const bool is64BitAddr = addr_size == 8 ;
1473+ const bool is64_bit_addr = addr_size == 8 ;
14741474 std::string_view sp = ranges_;
14751475 sp.remove_prefix (offset);
1476- const uint64_t maxAddr = is64BitAddr ? std::numeric_limits<uint64_t >::max () : std::numeric_limits<uint32_t >::max ();
1476+ const uint64_t max_addr = is64_bit_addr ? std::numeric_limits<uint64_t >::max () : std::numeric_limits<uint32_t >::max ();
14771477 while (!sp.empty ())
14781478 {
1479- uint64_t begin = readOffset (sp, is64BitAddr );
1480- uint64_t end = readOffset (sp, is64BitAddr );
1479+ uint64_t begin = readOffset (sp, is64_bit_addr );
1480+ uint64_t end = readOffset (sp, is64_bit_addr );
14811481 // The range list entry is a base address selection entry.
1482- if (begin == maxAddr )
1482+ if (begin == max_addr )
14831483 {
14841484 base_addr = end;
14851485 continue ;
@@ -1523,13 +1523,13 @@ bool Dwarf::isAddrInRangeList(const CompilationUnit & cu,
15231523 break ;
15241524
15251525 case DW_RLE_startx_endx: {
1526- auto indexStart = readULEB (rnglists);
1527- auto indexEnd = readULEB (rnglists);
1528- auto spStart = addr_.substr (*cu.addr_base + indexStart * sizeof (uint64_t ));
1529- auto start = read<uint64_t >(spStart );
1526+ auto index_start = readULEB (rnglists);
1527+ auto index_end = readULEB (rnglists);
1528+ auto sp_start = addr_.substr (*cu.addr_base + index_start * sizeof (uint64_t ));
1529+ auto start = read<uint64_t >(sp_start );
15301530
1531- auto spEnd = addr_.substr (*cu.addr_base + indexEnd * sizeof (uint64_t ));
1532- auto end = read<uint64_t >(spEnd );
1531+ auto sp_end = addr_.substr (*cu.addr_base + index_end * sizeof (uint64_t ));
1532+ auto end = read<uint64_t >(sp_end );
15331533 if (address >= start && address < end)
15341534 {
15351535 return true ;
@@ -1538,13 +1538,13 @@ bool Dwarf::isAddrInRangeList(const CompilationUnit & cu,
15381538 break ;
15391539
15401540 case DW_RLE_startx_length: {
1541- auto indexStart = readULEB (rnglists);
1541+ auto index_start = readULEB (rnglists);
15421542 auto length = readULEB (rnglists);
1543- auto spStart = addr_.substr (*cu.addr_base + indexStart * sizeof (uint64_t ));
1544- auto start = read<uint64_t >(spStart );
1543+ auto sp_start = addr_.substr (*cu.addr_base + index_start * sizeof (uint64_t ));
1544+ auto start = read<uint64_t >(sp_start );
15451545
1546- auto spEnd = addr_.substr (*cu.addr_base + indexStart * sizeof (uint64_t ) + length);
1547- auto end = read<uint64_t >(spEnd );
1546+ auto sp_end = addr_.substr (*cu.addr_base + index_start * sizeof (uint64_t ) + length);
1547+ auto end = read<uint64_t >(sp_end );
15481548 if (start != end && address >= start && address < end)
15491549 {
15501550 return true ;
@@ -1553,9 +1553,9 @@ bool Dwarf::isAddrInRangeList(const CompilationUnit & cu,
15531553 break ;
15541554
15551555 case DW_RLE_offset_pair: {
1556- auto offsetStart = readULEB (rnglists);
1557- auto offsetEnd = readULEB (rnglists);
1558- if (base_addr && address >= (*base_addr + offsetStart ) && address < (*base_addr + offsetEnd ))
1556+ auto offset_start = readULEB (rnglists);
1557+ auto offset_end = readULEB (rnglists);
1558+ if (base_addr && address >= (*base_addr + offset_start ) && address < (*base_addr + offset_end ))
15591559 {
15601560 return true ;
15611561 }
@@ -1628,33 +1628,33 @@ void Dwarf::LineNumberVM::reset()
16281628
16291629struct LineNumberAttribute
16301630{
1631- uint64_t contentTypeCode ;
1632- uint64_t formCode ;
1631+ uint64_t content_type_code ;
1632+ uint64_t form_code ;
16331633 std::variant<uint64_t , std::string_view> attr_value;
16341634};
16351635
16361636LineNumberAttribute readLineNumberAttribute (
1637- bool is64Bit , std::string_view & format, std::string_view & entries, std::string_view debugStr, std::string_view debugLineStr)
1637+ bool is64_bit , std::string_view & format, std::string_view & entries, std::string_view debugStr, std::string_view debugLineStr)
16381638{
1639- uint64_t contentTypeCode = readULEB (format);
1640- uint64_t formCode = readULEB (format);
1639+ uint64_t content_type_code = readULEB (format);
1640+ uint64_t form_code = readULEB (format);
16411641 std::variant<uint64_t , std::string_view> attr_value;
16421642
1643- switch (contentTypeCode )
1643+ switch (content_type_code )
16441644 {
16451645 case DW_LNCT_path: {
1646- switch (formCode )
1646+ switch (form_code )
16471647 {
16481648 case DW_FORM_string:
16491649 attr_value = readNullTerminated (entries);
16501650 break ;
16511651 case DW_FORM_line_strp: {
1652- auto off = readOffset (entries, is64Bit );
1652+ auto off = readOffset (entries, is64_bit );
16531653 attr_value = getStringFromStringSection (debugLineStr, off);
16541654 }
16551655 break ;
16561656 case DW_FORM_strp:
1657- attr_value = getStringFromStringSection (debugStr, readOffset (entries, is64Bit ));
1657+ attr_value = getStringFromStringSection (debugStr, readOffset (entries, is64_bit ));
16581658 break ;
16591659 case DW_FORM_strp_sup:
16601660 SAFE_CHECK (false , " Unexpected DW_FORM_strp_sup" );
@@ -1667,7 +1667,7 @@ LineNumberAttribute readLineNumberAttribute(
16671667 break ;
16681668
16691669 case DW_LNCT_directory_index: {
1670- switch (formCode )
1670+ switch (form_code )
16711671 {
16721672 case DW_FORM_data1:
16731673 attr_value = read<uint8_t >(entries);
@@ -1686,7 +1686,7 @@ LineNumberAttribute readLineNumberAttribute(
16861686 break ;
16871687
16881688 case DW_LNCT_timestamp: {
1689- switch (formCode )
1689+ switch (form_code )
16901690 {
16911691 case DW_FORM_udata:
16921692 attr_value = readULEB (entries);
@@ -1707,7 +1707,7 @@ LineNumberAttribute readLineNumberAttribute(
17071707 break ;
17081708
17091709 case DW_LNCT_size: {
1710- switch (formCode )
1710+ switch (form_code )
17111711 {
17121712 case DW_FORM_udata:
17131713 attr_value = readULEB (entries);
@@ -1732,7 +1732,7 @@ LineNumberAttribute readLineNumberAttribute(
17321732 break ;
17331733
17341734 case DW_LNCT_MD5: {
1735- switch (formCode )
1735+ switch (form_code )
17361736 {
17371737 case DW_FORM_data16:
17381738 attr_value = readBytes (entries, 16 );
@@ -1750,8 +1750,8 @@ LineNumberAttribute readLineNumberAttribute(
17501750 break ;
17511751 }
17521752 return {
1753- .contentTypeCode = contentTypeCode ,
1754- .formCode = formCode ,
1753+ .content_type_code = content_type_code ,
1754+ .form_code = form_code ,
17551755 .attr_value = attr_value,
17561756 };
17571757}
@@ -1762,8 +1762,8 @@ void Dwarf::LineNumberVM::init()
17621762 SAFE_CHECK (version_ >= 2 && version_ <= 5 , " invalid version in line number VM: {}" , version_);
17631763 if (version_ == 5 )
17641764 {
1765- auto addressSize = read<uint8_t >(data_);
1766- SAFE_CHECK (addressSize == sizeof (uintptr_t ), " Unexpected Line Number Table address_size" );
1765+ auto address_size = read<uint8_t >(data_);
1766+ SAFE_CHECK (address_size == sizeof (uintptr_t ), " Unexpected Line Number Table address_size" );
17671767 auto segment_selector_size = read<uint8_t >(data_);
17681768 SAFE_CHECK (segment_selector_size == 0 , " Segments not supported" );
17691769 }
@@ -1876,10 +1876,10 @@ Dwarf::LineNumberVM::FileName Dwarf::LineNumberVM::getFileName(uint64_t index) c
18761876 FileName fn;
18771877 if (index <= v4_.fileNameCount )
18781878 {
1879- std::string_view fileNames = v4_.fileNames ;
1879+ std::string_view file_names = v4_.fileNames ;
18801880 for (; index; --index)
18811881 {
1882- if (!readFileName (fileNames , fn))
1882+ if (!readFileName (file_names , fn))
18831883 {
18841884 abort ();
18851885 }
@@ -1901,16 +1901,16 @@ Dwarf::LineNumberVM::FileName Dwarf::LineNumberVM::getFileName(uint64_t index) c
19011901 {
19021902 FileName fn;
19031903 SAFE_CHECK (index < v5_.fileNamesCount , " invalid file index" );
1904- std::string_view fileNames = v5_.fileNames ;
1904+ std::string_view file_names = v5_.fileNames ;
19051905 for (uint64_t i = 0 ; i < v5_.fileNamesCount ; i++)
19061906 {
19071907 std::string_view format = v5_.fileNameEntryFormat ;
19081908 for (uint8_t f = 0 ; f < v5_.fileNameEntryFormatCount ; f++)
19091909 {
1910- auto attr = readLineNumberAttribute (is64Bit_, format, fileNames , debugStr_, debugLineStr_);
1910+ auto attr = readLineNumberAttribute (is64Bit_, format, file_names , debugStr_, debugLineStr_);
19111911 if (i == index)
19121912 {
1913- switch (attr.contentTypeCode )
1913+ switch (attr.content_type_code )
19141914 {
19151915 case DW_LNCT_path:
19161916 fn.relativeName = std::get<std::string_view>(attr.attr_value );
@@ -1941,11 +1941,11 @@ std::string_view Dwarf::LineNumberVM::getIncludeDirectory(uint64_t index) const
19411941
19421942 SAFE_CHECK (index <= v4_.includeDirectoryCount , " invalid include directory" );
19431943
1944- std::string_view includeDirectories = v4_.includeDirectories ;
1944+ std::string_view include_directories = v4_.includeDirectories ;
19451945 std::string_view dir;
19461946 for (; index; --index)
19471947 {
1948- dir = readNullTerminated (includeDirectories );
1948+ dir = readNullTerminated (include_directories );
19491949 if (dir.empty ())
19501950 {
19511951 abort (); // BUG
@@ -1964,7 +1964,7 @@ std::string_view Dwarf::LineNumberVM::getIncludeDirectory(uint64_t index) const
19641964 for (uint8_t f = 0 ; f < v5_.directoryEntryFormatCount ; f++)
19651965 {
19661966 auto attr = readLineNumberAttribute (is64Bit_, format, directories, debugStr_, debugLineStr_);
1967- if (i == index && attr.contentTypeCode == DW_LNCT_path)
1967+ if (i == index && attr.content_type_code == DW_LNCT_path)
19681968 {
19691969 return std::get<std::string_view>(attr.attr_value );
19701970 }
0 commit comments