@@ -4,7 +4,7 @@ use alloc::sync::Arc;
44use crate :: common:: {
55 DebugAddrBase , DebugAddrIndex , DebugInfoOffset , DebugLineStrOffset , DebugLocListsBase ,
66 DebugLocListsIndex , DebugRngListsBase , DebugRngListsIndex , DebugStrOffset , DebugStrOffsetsBase ,
7- DebugStrOffsetsIndex , DebugTypesOffset , DwarfFileType , Encoding , LocationListsOffset ,
7+ DebugStrOffsetsIndex , DebugTypesOffset , DwarfFileType , DwoId , Encoding , LocationListsOffset ,
88 RangeListsOffset , RawRangeListsOffset , SectionId , UnitSectionOffset ,
99} ;
1010use crate :: constants;
@@ -14,7 +14,7 @@ use crate::read::{
1414 DebugTypesUnitHeadersIter , DebuggingInformationEntry , EntriesCursor , EntriesRaw , EntriesTree ,
1515 Error , IncompleteLineProgram , LocListIter , LocationLists , Range , RangeLists , RawLocListIter ,
1616 RawRngListIter , Reader , ReaderOffset , ReaderOffsetId , Result , RngListIter , Section , UnitHeader ,
17- UnitOffset ,
17+ UnitOffset , UnitType ,
1818} ;
1919
2020/// All of the commonly used DWARF sections, and other common information.
@@ -602,6 +602,9 @@ where
602602
603603 /// The line number program of the unit.
604604 pub line_program : Option < IncompleteLineProgram < R , Offset > > ,
605+
606+ /// The DWO ID of a skeleton unit or split compilation unit.
607+ pub dwo_id : Option < DwoId > ,
605608}
606609
607610impl < R : Reader > Unit < R > {
@@ -629,6 +632,10 @@ impl<R: Reader> Unit<R> {
629632 dwarf. file_type ,
630633 ) ,
631634 line_program : None ,
635+ dwo_id : match header. type_ ( ) {
636+ UnitType :: Skeleton ( dwo_id) | UnitType :: SplitCompilation ( dwo_id) => Some ( dwo_id) ,
637+ _ => None ,
638+ } ,
632639 header,
633640 } ;
634641 let mut name = None ;
@@ -677,6 +684,13 @@ impl<R: Reader> Unit<R> {
677684 unit. rnglists_base = base;
678685 }
679686 }
687+ constants:: DW_AT_GNU_dwo_id => {
688+ if unit. dwo_id . is_none ( ) {
689+ if let AttributeValue :: DwoId ( dwo_id) = attr. value ( ) {
690+ unit. dwo_id = Some ( dwo_id) ;
691+ }
692+ }
693+ }
680694 _ => { }
681695 }
682696 }
0 commit comments