Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp =================================================================== --- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -790,13 +790,15 @@ if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - SectionSP image_sp = std::make_shared
( - module_sp, this, ~user_id_t(0), ConstString(), eSectionTypeContainer, - m_coff_header_opt.image_base, m_coff_header_opt.image_size, - /*file_offset*/ 0, /*file_size*/ 0, m_coff_header_opt.sect_alignment, + SectionSP header_sp = std::make_shared
( + module_sp, this, ~user_id_t(0), ConstString("PECOFF header"), + eSectionTypeOther, m_coff_header_opt.image_base, + m_coff_header_opt.header_size, + /*file_offset*/ 0, m_coff_header_opt.header_size, + m_coff_header_opt.sect_alignment, /*flags*/ 0); - m_sections_up->AddSection(image_sp); - unified_section_list.AddSection(image_sp); + m_sections_up->AddSection(header_sp); + unified_section_list.AddSection(header_sp); const uint32_t nsects = m_sect_headers.size(); ModuleSP module_sp(GetModule()); @@ -901,15 +903,15 @@ } SectionSP section_sp(new Section( - image_sp, // Parent section module_sp, // Module to which this section belongs this, // Object file to which this section belongs idx + 1, // Section ID is the 1 based section index. const_sect_name, // Name of this section section_type, - m_sect_headers[idx].vmaddr, // File VM address == addresses as - // they are found in the object file - m_sect_headers[idx].vmsize, // VM size in bytes of this section + m_coff_header_opt.image_base + + m_sect_headers[idx].vmaddr, // File VM address == addresses as + // they are found in the object file + m_sect_headers[idx].vmsize, // VM size in bytes of this section m_sect_headers[idx] .offset, // Offset to the data for this section in the file m_sect_headers[idx] @@ -917,7 +919,8 @@ m_coff_header_opt.sect_alignment, // Section alignment m_sect_headers[idx].flags)); // Flags for this section - image_sp->GetChildren().AddSection(std::move(section_sp)); + m_sections_up->AddSection(section_sp); + unified_section_list.AddSection(section_sp); } } } Index: test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml =================================================================== --- test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml +++ test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml @@ -11,20 +11,24 @@ # UUID should not be empty if the module is built with debug info. # BASIC-CHECK-DAG: UUID: {{[0-9A-F]{7,}[0-9A-F]}}-{{.*}} -# BASIC-CHECK: Showing 3 subsections +# BASIC-CHECK: Showing 4 sections +# # BASIC-CHECK: Index: 0 +# BASIC-CHECK: Name: PECOFF header +# +# BASIC-CHECK: Index: 1 # BASIC-CHECK: Name: .text # BASIC-CHECK: Type: code # BASIC-CHECK: VM size: 22 # BASIC-CHECK: File size: 512 # -# BASIC-CHECK: Index: 1 +# BASIC-CHECK: Index: 2 # BASIC-CHECK: Name: .rdata # BASIC-CHECK: Type: data # BASIC-CHECK: VM size: {{.}} # BASIC-CHECK: File size: 512 # -# BASIC-CHECK: Index: 2 +# BASIC-CHECK: Index: 3 # BASIC-CHECK: Name: .pdata # BASIC-CHECK: Type: data # BASIC-CHECK: VM size: 12 Index: test/Shell/ObjectFile/PECOFF/sections.yaml =================================================================== --- test/Shell/ObjectFile/PECOFF/sections.yaml +++ test/Shell/ObjectFile/PECOFF/sections.yaml @@ -2,36 +2,36 @@ # RUN: lldb-test object-file %t | FileCheck %s -# CHECK: Showing 1 sections +# CHECK: Showing 3 sections # CHECK-NEXT: Index: 0 # CHECK-NEXT: ID: 0xffffffffffffffff -# CHECK-NEXT: Name: -# CHECK-NEXT: Type: container +# CHECK-NEXT: Name: PECOFF header +# CHECK-NEXT: Type: regular # CHECK-NEXT: Permissions: --- # CHECK-NEXT: Thread specific: no # CHECK-NEXT: VM address: 0x40000000 -# CHECK-NEXT: VM size: 12288 -# CHECK-NEXT: File size: 0 -# CHECK-NEXT: Showing 2 subsections -# CHECK-NEXT: Index: 0 -# CHECK-NEXT: ID: 0x1 -# CHECK-NEXT: Name: .text -# CHECK-NEXT: Type: code -# CHECK-NEXT: Permissions: --- -# CHECK-NEXT: Thread specific: no -# CHECK-NEXT: VM address: 0x40001000 -# CHECK-NEXT: VM size: 64 -# CHECK-NEXT: File size: 512 +# CHECK-NEXT: VM size: 512 +# CHECK-NEXT: File size: 512 # CHECK-EMPTY: -# CHECK-NEXT: Index: 1 -# CHECK-NEXT: ID: 0x2 -# CHECK-NEXT: Name: .data -# CHECK-NEXT: Type: data -# CHECK-NEXT: Permissions: --- -# CHECK-NEXT: Thread specific: no -# CHECK-NEXT: VM address: 0x40002000 -# CHECK-NEXT: VM size: 64 -# CHECK-NEXT: File size: 512 +# CHECK-NEXT: Index: 1 +# CHECK-NEXT: ID: 0x1 +# CHECK-NEXT: Name: .text +# CHECK-NEXT: Type: code +# CHECK-NEXT: Permissions: --- +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x40001000 +# CHECK-NEXT: VM size: 64 +# CHECK-NEXT: File size: 512 +# CHECK-EMPTY: +# CHECK-NEXT: Index: 2 +# CHECK-NEXT: ID: 0x2 +# CHECK-NEXT: Name: .data +# CHECK-NEXT: Type: data +# CHECK-NEXT: Permissions: --- +# CHECK-NEXT: Thread specific: no +# CHECK-NEXT: VM address: 0x40002000 +# CHECK-NEXT: VM size: 64 +# CHECK-NEXT: File size: 512 --- !COFF