brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 170dc76 Raw
56 lines · plain
1// REQUIRES: system-linux, native, python2 3// This test verifies that loading an ELF file from memory works and the new4// features that were added when loading from memory work like:5// - Loading the .dynamic section from the PT_DYNAMIC since ELF files loaded6//   from memory don't have the section headers available.7// This test will make a simple executable that:8//   - links against libc9//   - runs and stops at a breakpoint10//   - create a memory ELF file11//   - verify that "image dump objfile" will dump the dynamic section of the12//     memory elf file and find the .dynamic string table.13 14// RUN: %clangxx_host %p/Inputs/memory-elf.cpp -g -O0 -o %t15 16// RUN: %lldb %t -b \17// RUN:   -o "b main" \18// RUN:   -o "run" \19// RUN:   -o "script real_module = lldb.target.module[0]" \20// RUN:   -o "script base_addr = real_module.GetObjectFileHeaderAddress().GetLoadAddress(lldb.target)" \21// RUN:   -o "script mem_module = lldb.SBModule(lldb.process, base_addr)" \22// RUN:   -o "script target2 = lldb.debugger.CreateTarget('')" \23// RUN:   -o "script target2.AddModule(mem_module)" \24// RUN:   -o "target select 1" \25// RUN:   -o "image dump objfile" \26// RUN:   | FileCheck %s --check-prefix=MAIN --dump-input=always27// MAIN: (lldb) image dump objfile28// MAIN: Dumping headers for 1 module(s).29// MAIN: ObjectFileELF, file = '', arch = {{.*, addr = 0x[0-9a-f]+}}30// MAIN: ELF Header31 32// Make sure we find the program headers and see a PT_DYNAMIC entry.33// MAIN: Program Headers34// MAIN: ] PT_DYNAMIC35 36// Make sure we see some sections created from the program headers37// MAIN: SectID38// MAIN: PT_LOAD[0]39 40// Ensure we find some dependent modules as won't find these if we aren't able41// to load the .dynamic section from the PT_DYNAMIC program header.42// MAIN: Dependent Modules:43 44// Check for the .dynamic dump and ensure we find all dynamic entries that are45// required to be there and needed to get the .dynstr section and the symbol46// table, and the DT_DEBUG entry to find the list of shared libraries.47// MAIN: .dynamic:48// Make sure we found the .dynstr section by checking for valid strings after NEEDED49// MAIN-DAG: NEEDED {{0x[0-9a-f]+ ".*libc.*"}}50// MAIN-DAG: STRTAB {{0x[0-9a-f]+}}51// MAIN-DAG: SYMTAB {{0x[0-9a-f]+}}52// MAIN-DAG: STRSZ {{0x[0-9a-f]+}}53// MAIN-DAG: SYMENT {{0x[0-9a-f]+}}54// MAIN-DAG: DEBUG {{0x[0-9a-f]+}}55// MAIN:     NULL {{0x[0-9a-f]+}}56