summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp25
-rw-r--r--lldb/test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml10
-rw-r--r--lldb/test/Shell/ObjectFile/PECOFF/sections.yaml (renamed from lldb/test/Shell/ObjectFile/PECOFF/subsections.yaml)48
3 files changed, 45 insertions, 38 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 742b28d0aaf..7e8bcb38e6f 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -790,13 +790,15 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
- SectionSP image_sp = std::make_shared<Section>(
- 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<Section>(
+ 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 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
}
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 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
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);
}
}
}
diff --git a/lldb/test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml b/lldb/test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml
index 1f858d735ec..c1ada73046d 100644
--- a/lldb/test/Shell/ObjectFile/PECOFF/export-dllfunc.yaml
+++ b/lldb/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
diff --git a/lldb/test/Shell/ObjectFile/PECOFF/subsections.yaml b/lldb/test/Shell/ObjectFile/PECOFF/sections.yaml
index d7ecf68e84a..715ef523c13 100644
--- a/lldb/test/Shell/ObjectFile/PECOFF/subsections.yaml
+++ b/lldb/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
OpenPOWER on IntegriCloud