Changes the drmodtrack_add_custom_data() and drmemtrace_custom_module_data() interfaces to call each load and free callback separately for each module segment, adding a new parameter with the segment index to the load callback.
This eliminates a superfluous vdso map when the vdso is split into two segments (#3900 (closed)), and properly handles a gap between segments with custom data.
Updates the documentation to indicate the compatibility break. Since this is isolated to rarely used extension libraries and drcachesim interfaces, we do not bump DR's own release major or minor numbers. Compatibility is maintained for drcachesim offline traces, so the offline trace and custom module versions are not changed.
Tested by running opcode_mix with -verbose 1. Before we mapped 8K twice and never used the 2nd:
--------------------------------------------------
11, 11, 0x00007fffec594000, 0x00007fffec595000, 0x00007fffec594680, 0000000000000000, v#1,8192,^?ELF^
12, 12, 0x00007fffec595000, 0x00007fffec596000, 0x00007fffec594680, 0000000000001000, v#1,8192,^?ELF^
[drmemtrace]: Using module 11 [vdso] stored 8192-byte contents @0x55d569b449ef
[drmemtrace]: Using module 12 [vdso] stored 8192-byte contents @0x55d569b46a58
Mapped vdso1+0x10 to 55d569b449ff; range 55d569b449ef size 2000
Mapped vdso2+0x10 to 55d569b459ff; range 55d569b449ef size 2000
--------------------------------------------------
After, we map 4K separately and use each:
--------------------------------------------------
11, 11, 0x00007ffc41350000, 0x00007ffc41351000, 0x00007ffc41350680, 0000000000000000, v#2,4096,^?ELF<...>
12, 11, 0x00007ffc41351000, 0x00007ffc41352000, 0x00007ffc41350680, 0000000000001000, v#2,4096, ^A<...>
[drmemtrace]: Using module 11 [vdso] stored 4096-byte contents @0x557fbaec09ef
[drmemtrace]: Using module 12 [vdso] stored 4096-byte contents @0x557fbaec1a58
Mapped vdso1+0x10 to 557fbaec09ff; range 557fbaec09ef size 1000
Mapped vdso2+0x10 to 557fbaec1a68; range 557fbaec1a58 size 1000
--------------------------------------------------
Fixes #4741 (closed)