Description
OSv executables are normally demand-paged, i.e., parts of the executable are only loaded from disk to memory when first accessed. This can be annoying when debugging an application on OSv, and code that hasn't run yet is not yet found in memory (and prevents, for example, hbreak, from working correctly on functions which haven't run yet).
We have one trick we can use - if we add the following code to the shared object
asm(".pushsection .note.osv-mlock, \"a\"; .long 0, 0, 0; .popsection")
The shared object gets loaded from disk in its entirety when opened. But this trick has another side-effect, which is to enable up-front symbol resolution instead of lazy binding (on first use), which can cause annoying "missing symbol" false alarms with functions that are never actually used.
We could invent a second section name which only effects loading, but not binding.
But perhaps a more useful feature could be a kernel option (that you add to the kernel command line at run time) to make all shared objects being loaded entirely (not demand paged). Such an option would mean the the user would not need to modify these shared objects (like adding a special section) just for the sake of debugging.