@@ -29,7 +29,7 @@ public void TestLEB128(ulong value)
2929 var stream = new MemoryStream ( ) ;
3030
3131 stream . WriteULEB128 ( value ) ;
32-
32+
3333 Assert . AreEqual ( ( uint ) stream . Position , DwarfHelper . SizeOfULEB128 ( value ) ) ;
3434
3535 stream . Position = 0 ;
@@ -85,11 +85,11 @@ public void TestDebugLineHelloWorld()
8585 var cppExe = $ "{ cppName } _debug";
8686 LinuxUtil . RunLinuxExe ( "gcc" , $ "{ cppName } .cpp -gdwarf-4 -o { cppExe } ") ;
8787
88- ElfObjectFile elf ;
88+ ElfFile elf ;
8989 using ( var inStream = File . OpenRead ( cppExe ) )
9090 {
9191 Console . WriteLine ( $ "ReadBack from { cppExe } ") ;
92- elf = ElfObjectFile . Read ( inStream ) ;
92+ elf = ElfFile . Read ( inStream ) ;
9393 elf . Print ( Console . Out ) ;
9494 }
9595
@@ -144,11 +144,11 @@ public void TestDebugLineLibMultipleObjs()
144144 var libShared = $ "{ cppName } _debug.so";
145145 LinuxUtil . RunLinuxExe ( "gcc" , $ "{ cppName } _a.cpp { cppName } _b.cpp -gdwarf-4 -shared -o { libShared } ") ;
146146
147- ElfObjectFile elf ;
147+ ElfFile elf ;
148148 using ( var inStream = File . OpenRead ( libShared ) )
149149 {
150150 Console . WriteLine ( $ "ReadBack from { libShared } ") ;
151- elf = ElfObjectFile . Read ( inStream ) ;
151+ elf = ElfFile . Read ( inStream ) ;
152152 elf . Print ( Console . Out ) ;
153153 }
154154
@@ -202,11 +202,11 @@ public void TestDebugLineSmall()
202202 var cppName = "small" ;
203203 var cppObj = $ "{ cppName } _debug.o";
204204 LinuxUtil . RunLinuxExe ( "gcc" , $ "{ cppName } .cpp -gdwarf-4 -c -o { cppObj } ") ;
205- ElfObjectFile elf ;
205+ ElfFile elf ;
206206 using ( var inStream = File . OpenRead ( cppObj ) )
207207 {
208208 Console . WriteLine ( $ "ReadBack from { cppObj } ") ;
209- elf = ElfObjectFile . Read ( inStream ) ;
209+ elf = ElfFile . Read ( inStream ) ;
210210 elf . Print ( Console . Out ) ;
211211 }
212212
@@ -261,11 +261,11 @@ public void TestDebugLineMultipleFunctions()
261261 var cppObj = $ "{ cppName } _debug.o";
262262 LinuxUtil . RunLinuxExe ( "gcc" , $ "{ cppName } .cpp -gdwarf-4 -c -o { cppObj } ") ;
263263
264- ElfObjectFile elf ;
264+ ElfFile elf ;
265265 using ( var inStream = File . OpenRead ( cppObj ) )
266266 {
267267 Console . WriteLine ( $ "ReadBack from { cppObj } ") ;
268- elf = ElfObjectFile . Read ( inStream ) ;
268+ elf = ElfFile . Read ( inStream ) ;
269269 elf . Print ( Console . Out ) ;
270270 }
271271
@@ -319,10 +319,10 @@ public void TestDebugInfoSmall()
319319 var cppObj = $ "{ cppName } _debug.o";
320320 LinuxUtil . RunLinuxExe ( "gcc" , $ "{ cppName } .cpp -gdwarf-4 -c -o { cppObj } ") ;
321321
322- ElfObjectFile elf ;
322+ ElfFile elf ;
323323 using ( var inStream = File . OpenRead ( cppObj ) )
324324 {
325- elf = ElfObjectFile . Read ( inStream ) ;
325+ elf = ElfFile . Read ( inStream ) ;
326326 elf . Print ( Console . Out ) ;
327327 }
328328
@@ -375,22 +375,23 @@ public void TestDebugInfoSmall()
375375 public void CreateDwarf ( )
376376 {
377377 // Create ELF object
378- var elf = new ElfObjectFile ( ElfArch . X86_64 ) ;
378+ var elf = new ElfFile ( ElfArch . X86_64 ) ;
379379
380- var codeSection = new ElfBinarySection ( new MemoryStream ( new byte [ 0x64 ] ) ) . ConfigureAs ( ElfSectionSpecialType . Text ) ;
381- elf . AddSection ( codeSection ) ;
380+ var codeSection = new ElfStreamSection ( ElfSectionSpecialType . Text , new MemoryStream ( new byte [ 0x64 ] ) ) ;
381+ elf . Content . Add ( codeSection ) ;
382382 var stringSection = new ElfStringTable ( ) ;
383- elf . AddSection ( stringSection ) ;
384- elf . AddSection ( new ElfSymbolTable ( ) { Link = stringSection } ) ;
385- elf . AddSection ( new ElfSectionHeaderStringTable ( ) ) ;
383+ elf . Content . Add ( stringSection ) ;
384+ elf . Content . Add ( new ElfSymbolTable ( ) { Link = stringSection } ) ;
385+ elf . Content . Add ( new ElfSectionHeaderStringTable ( ) ) ;
386+ elf . Content . Add ( new ElfSectionHeaderTable ( ) ) ;
386387
387388 var elfDiagnostics = new DiagnosticBag ( ) ;
388389 elf . UpdateLayout ( elfDiagnostics ) ;
389390 Assert . IsFalse ( elfDiagnostics . HasErrors ) ;
390391
391392 // Create DWARF Object
392393 var dwarfFile = new DwarfFile ( ) ;
393-
394+
394395 // Create .debug_line information
395396 var fileName = new DwarfFileName ( "check1.cpp" )
396397 {
@@ -462,9 +463,9 @@ public void CreateDwarf()
462463
463464 var locationList = new DwarfLocationList ( ) ;
464465 var regExpression = new DwarfExpression ( ) ;
465- regExpression . Operations . Add ( new DwarfOperation { Kind = DwarfOperationKindEx . Reg0 } ) ;
466+ regExpression . Operations . Add ( new DwarfOperation { Kind = DwarfOperationKindEx . Reg0 } ) ;
466467 var regExpression2 = new DwarfExpression ( ) ;
467- regExpression2 . Operations . Add ( new DwarfOperation { Kind = DwarfOperationKindEx . Reg2 } ) ;
468+ regExpression2 . Operations . Add ( new DwarfOperation { Kind = DwarfOperationKindEx . Reg2 } ) ;
468469 locationList . LocationListEntries . Add ( new DwarfLocationListEntry
469470 {
470471 Start = 0 ,
@@ -491,12 +492,12 @@ public void CreateDwarf()
491492 Root = rootDIE
492493 } ;
493494 dwarfFile . InfoSection . Units . Add ( cu ) ;
494-
495+
495496 // AddressRange table
496497 dwarfFile . AddressRangeTable . AddressSize = DwarfAddressSize . Bit64 ;
497498 dwarfFile . AddressRangeTable . Unit = cu ;
498499 dwarfFile . AddressRangeTable . Ranges . Add ( new DwarfAddressRange ( 0 , 0 , codeSection . Size ) ) ;
499-
500+
500501 // Transfer DWARF To ELF
501502 var dwarfElfContext = new DwarfElfContext ( elf ) ;
502503 dwarfFile . WriteToElf ( dwarfElfContext ) ;
0 commit comments