mdb should support embedded dmods in core dumps
When working with other pieces of software that want dmods there is a challenge of making sure that we always have the right version of the dmod to debug the resulting application. There is tension between shipping it in illumos, having the most recent version, and making sure that you have that around when you're debugging disparate versions. In these cases one solution is to have the dmod itself embedded in the library or executable that we care about in such a way that when the binary core dumps it will be in the dump. A simple solution to this is using elfwrap(1) to create a .o of the mdb so which can then be linked into the resulting application.
We construct a contract that if there is a symbol like mdb_<module>_start then mdb will notice it on startup and write it out to a temporary file and load it up. Similarly if someone issues a ::load we'll iterate over the symbol table of the target and use this same method. If a ::load is executed with the full path to a module, then this will be bypassed and the file will be loaded from the file system. Similarly if we fail to load it from the binary then it will be found in the program itself.