i#7046: Add loadable segment program headers to memory dump file. #7104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add loadable segment program headers to memory dump file. Set the entry point address in the ELF file header based on the PC value.
Update the unit test to check loadable segment program header.
Here's the output of readelf -l using the unit test output from a X86 machine:
$ readelf -l logs/simple_app.3281609.00000000.elf
Elf file type is CORE (Core file)
Entry point 0x7fcd05936320
There are 47 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000000a88 0x0000000000000000 0x0000000000000000
0x0000000000000378 0x0000000000000378 0x2
LOAD 0x0000000000000e00 0x00007fcac1000000 0x00007fcac1000000
0x0000000000040000 0x0000000000040000 RW 0x1000
LOAD 0x0000000000040e00 0x00007fcac1041000 0x00007fcac1041000
0x0000000000006000 0x0000000000006000 RW 0x1000
LOAD 0x0000000000046e00 0x00007fcac1049000 0x00007fcac1049000
0x0000000000004000 0x0000000000004000 RW 0x1000
LOAD 0x000000000004ae00 0x00007fcac1051000 0x00007fcac1051000
0x0000000000006000 0x0000000000006000 RW 0x1000
LOAD 0x0000000000050e00 0x00007fcac1059000 0x00007fcac1059000
0x0000000000018000 0x0000000000018000 RW 0x1000
LOAD 0x0000000000068e00 0x00007fcac1073000 0x00007fcac1073000
0x000000000000e000 0x000000000000e000 RW 0x1000
LOAD 0x0000000000076e00 0x00007fcac1083000 0x00007fcac1083000
0x0000000000003000 0x0000000000003000 RW 0x1000
LOAD 0x0000000000079e00 0x00007fcac1091000 0x00007fcac1091000
0x000000000000c000 0x000000000000c000 RW 0x1000
LOAD 0x0000000000085e00 0x00007fcac109f000 0x00007fcac109f000
0x0000000000001000 0x0000000000001000 RW 0x1000
LOAD 0x0000000000086e00 0x00007fcac10a2000 0x00007fcac10a2000
0x0000000000002000 0x0000000000002000 RW 0x1000
LOAD 0x0000000000088e00 0x00007fcac10a6000 0x00007fcac10a6000
0x000000000000e000 0x000000000000e000 RW 0x1000
LOAD 0x0000000000096e00 0x00007fcac10b6000 0x00007fcac10b6000
0x0000000000004000 0x0000000000004000 RW 0x1000
LOAD 0x000000000009ae00 0x00007fcac10be000 0x00007fcac10be000
0x0000000000002000 0x0000000000002000 RW 0x1000
LOAD 0x000000000009ce00 0x00007fcac10c3000 0x00007fcac10c3000
0x0000000000001000 0x0000000000001000 RW 0x1000
LOAD 0x000000000009de00 0x00007fcac10c8000 0x00007fcac10c8000
0x0000000000008000 0x0000000000008000 RW 0x1000
LOAD 0x00000000000a5e00 0x00007fcac10d2000 0x00007fcac10d2000
0x0000000000018000 0x0000000000018000 RW 0x1000
LOAD 0x00000000000bde00 0x00007fccc1200000 0x00007fccc1200000
0x0000000000008000 0x0000000000008000 RW 0x1000
LOAD 0x00000000000c5e00 0x00007fccc1208000 0x00007fccc1208000
0x0000000000001000 0x0000000000001000 R 0x1000
LOAD 0x00000000000c6e00 0x00007fccc1209000 0x00007fccc1209000
0x0000000000001000 0x0000000000001000 R E 0x1000
LOAD 0x00000000000c7e00 0x00007fccc120a000 0x00007fccc120a000
0x0000000000001000 0x0000000000001000 R 0x1000
LOAD 0x00000000000c8e00 0x00007fccc120b000 0x00007fccc120b000
0x0000000000002000 0x0000000000002000 RW 0x1000
LOAD 0x00000000000cae00 0x00007fccc120f000 0x00007fccc120f000
0x0000000000001000 0x0000000000001000 RW 0x1000
LOAD 0x00000000000cbe00 0x00007fccc1217000 0x00007fccc1217000
0x0000000000001000 0x0000000000001000 RWE 0x1000
LOAD 0x00000000000cce00 0x00007fccc1218000 0x00007fccc1218000
0x0000000000002000 0x0000000000002000 R E 0x1000
LOAD 0x00000000000cee00 0x00007fccc121a000 0x00007fccc121a000
0x0000000000001000 0x0000000000001000 RWE 0x1000
LOAD 0x00000000000cfe00 0x00007fccc121e000 0x00007fccc121e000
0x0000000000001000 0x0000000000001000 RWE 0x1000
LOAD 0x00000000000d0e00 0x00007fccc122e000 0x00007fccc122e000
0x0000000000001000 0x0000000000001000 RWE 0x1000
LOAD 0x00000000000d1e00 0x00007fccc123e000 0x00007fccc123e000
0x0000000000001000 0x0000000000001000 RWE 0x1000
LOAD 0x00000000000d2e00 0x00007fccc1241000 0x00007fccc1241000
0x0000000000001000 0x0000000000001000 RWE 0x1000
LOAD 0x00000000000d3e00 0x00007fccc1244000 0x00007fccc1244000
0x0000000000001000 0x0000000000001000 RW 0x1000
LOAD 0x00000000000d4e00 0x00007fcd01200000 0x00007fcd01200000
0x0000000000001000 0x0000000000001000 R 0x1000
LOAD 0x00000000000d5e00 0x00007fcd01201000 0x00007fcd01201000
0x0000000000002000 0x0000000000002000 R E 0x1000
LOAD 0x00000000000d7e00 0x00007fcd01203000 0x00007fcd01203000
0x0000000000001000 0x0000000000001000 R 0x1000
LOAD 0x00000000000d8e00 0x00007fcd01204000 0x00007fcd01204000
0x0000000000002000 0x0000000000002000 RW 0x1000
LOAD 0x00000000000dae00 0x00007fcd01207000 0x00007fcd01207000
0x0000000000400000 0x0000000000400000 RW 0x1000
LOAD 0x00000000004dae00 0x00007fcd05400000 0x00007fcd05400000
0x000000000004e000 0x000000000004e000 R 0x1000
LOAD 0x0000000000528e00 0x00007fcd0544e000 0x00007fcd0544e000
0x00000000002e9000 0x00000000002e9000 R E 0x1000
LOAD 0x0000000000811e00 0x00007fcd05737000 0x00007fcd05737000
0x00000000000cb000 0x00000000000cb000 R 0x1000
LOAD 0x00000000008dce00 0x00007fcd05802000 0x00007fcd05802000
0x000000000007f000 0x000000000007f000 RW 0x1000
LOAD 0x000000000095be00 0x00007fcd05881000 0x00007fcd05881000
0x0000000000039000 0x0000000000039000 RW 0x1000
LOAD 0x0000000000994e00 0x00007fcd0591b000 0x00007fcd0591b000
0x0000000000001000 0x0000000000001000 R 0x1000
LOAD 0x0000000000995e00 0x00007fcd0591c000 0x00007fcd0591c000
0x0000000000026000 0x0000000000026000 R E 0x1000
LOAD 0x00000000009bbe00 0x00007fcd05942000 0x00007fcd05942000
0x000000000000b000 0x000000000000b000 R 0x1000
LOAD 0x00000000009c6e00 0x00007fcd0594d000 0x00007fcd0594d000
0x0000000000004000 0x0000000000004000 RW 0x1000
LOAD 0x00000000009cae00 0x00007fcd0595b000 0x00007fcd0595b000
0x0000000000002000 0x0000000000002000 R E 0x1000
LOAD 0x00000000009cce00 0x00007ffe60f10000 0x00007ffe60f10000
0x0000000000022000 0x0000000000022000 RW 0x1000
Section to Segment mapping:
Segment Sections...
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/libclient.memory_dump_test.dll.so
19 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/libclient.memory_dump_test.dll.so
20 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/libclient.memory_dump_test.dll.so
21 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/libclient.memory_dump_test.dll.so
22
23
24
25
26
27
28
29
30
31 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/simple_app
32 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/simple_app
33 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/simple_app
34 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/suite/tests/bin/simple_app
35
36 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/lib64/debug/libdynamorio.so
37 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/lib64/debug/libdynamorio.so
38 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/lib64/debug/libdynamorio.so
39 /usr/local/google/home/kyluk/trace2checkpoint/dynamorio/build/lib64/debug/libdynamorio.so
40
41 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
42 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
43 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
44 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
45 [vdso]
46 [stack]
Issue: #7046