This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setting a shared library static


The test program via the macros in sdt.h, and help from stap, save away dwfl_module_relocate_address(&static variable). When stap runs it relocates &static_variable and when the writeable segment of the .so is mmapped it increments it via __access_process_vm and decrements it via __access_process_vm. If static_variable is not in a .so then it works as expected. Otherwise static_variable gets set in stap_uprobe_mmap_found via task_finder.c::__stp_call_mmap_callbacks. The value of &static_variable is checked at the mmap and munmap callbacks. The behavior I'm noticing is that at the first callback for munmap the value of &static_variable has become unavailable.

eu-readelf -lS libsdt-uprobe.so
There are 36 section headers, starting at offset 0x2518:

Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[ 0] NULL 0000000000000000 00000000 00000000 0 0 0 0
[ 1] .note.gnu.build-id NOTE 0000000000000190 00000190 00000024 0 A 0 0 4
[ 2] .gnu.hash GNU_HASH 00000000000001b8 000001b8 00000064 0 A 3 0 8
[ 3] .dynsym DYNSYM 0000000000000220 00000220 000001f8 24 A 4 2 8
[ 4] .dynstr STRTAB 0000000000000418 00000418 00000119 0 A 0 0 1
[ 5] .gnu.version GNU_versym 0000000000000532 00000532 0000002a 2 A 3 0 2
[ 6] .gnu.version_r GNU_verneed 0000000000000560 00000560 00000020 0 A 4 1 8
[ 7] .rela.dyn RELA 0000000000000580 00000580 00000258 24 A 3 0 8
[ 8] .rela.plt RELA 00000000000007d8 000007d8 00000048 24 A 3 10 8
[ 9] .init PROGBITS 0000000000000820 00000820 00000018 0 AX 0 0 4
[10] .plt PROGBITS 0000000000000838 00000838 00000040 16 AX 0 0 4
[11] .text PROGBITS 0000000000000880 00000880 00000718 0 AX 0 0 16
[12] .fini PROGBITS 0000000000000f98 00000f98 0000000e 0 AX 0 0 4
[13] .rodata PROGBITS 0000000000000fa8 00000fa8 00000119 0 A 0 0 8
[14] .eh_frame_hdr PROGBITS 00000000000010c4 000010c4 0000001c 0 A 0 0 4
[15] .eh_frame PROGBITS 00000000000010e0 000010e0 0000005c 0 A 0 0 8
[16] .ctors PROGBITS 0000000000201140 00001140 00000010 0 WA 0 0 8
[17] .dtors PROGBITS 0000000000201150 00001150 00000010 0 WA 0 0 8
[18] .jcr PROGBITS 0000000000201160 00001160 00000008 0 WA 0 0 8
[19] .data.rel.ro PROGBITS 0000000000201168 00001168 00000008 0 WA 0 0 8
[20] .dynamic DYNAMIC 0000000000201170 00001170 00000190 16 WA 4 0 8
[21] .got PROGBITS 0000000000201300 00001300 00000050 8 WA 0 0 8
[22] .got.plt PROGBITS 0000000000201350 00001350 00000030 8 WA 0 0 8
[23] .probes PROGBITS 0000000000201380 00001380 00000122 0 WA 0 0 8
[24] .bss NOBITS 00000000002014a8 000014a2 00000018 0 WA 0 0 8
[25] .comment PROGBITS 0000000000000000 000014a2 0000010e 0 0 0 1
[26] .debug_aranges PROGBITS 0000000000000000 000015b0 00000060 0 0 0 1
[27] .debug_pubnames PROGBITS 0000000000000000 00001610 000000e5 0 0 0 1
[28] .debug_info PROGBITS 0000000000000000 000016f5 000007e2 0 0 0 1
[29] .debug_abbrev PROGBITS 0000000000000000 00001ed7 0000017e 0 0 0 1
[30] .debug_line PROGBITS 0000000000000000 00002055 0000010b 0 0 0 1
[31] .debug_str PROGBITS 0000000000000000 00002160 000001cc 1 MS 0 0 1
[32] .debug_loc PROGBITS 0000000000000000 0000232c 00000098 0 0 0 1
[33] .shstrtab STRTAB 0000000000000000 000023c4 00000152 0 0 0 1
[34] .symtab SYMTAB 0000000000000000 00002e18 000006d8 24 35 54 8
[35] .strtab STRTAB 0000000000000000 000034f0 0000024a 0 0 0 1


Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x00113c 0x00113c R E 0x200000
LOAD 0x001140 0x0000000000201140 0x0000000000201140 0x000362 0x000380 RW 0x200000
DYNAMIC 0x001170 0x0000000000201170 0x0000000000201170 0x000190 0x000190 RW 0x8
NOTE 0x000190 0x0000000000000190 0x0000000000000190 0x000024 0x000024 R 0x4
GNU_EH_FRAME 0x0010c4 0x00000000000010c4 0x00000000000010c4 0x00001c 0x00001c R 0x4
GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x8


Section to Segment mapping:
Segment Sections...
00 [RO: .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame]
01 .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .probes .bss
02 .dynamic
03 [RO: .note.gnu.build-id]
04 [RO: .eh_frame_hdr]
05



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]