Fix and continue implementation


I’ve implemented part of a fix-and-continue solution for lldb. As of right now, it works if you want to substitute functions from external libraries, by loading an additional copy of that library on the project’s address space.
The library must have a completely new name from the previously loaded libraries (otherwise, dlopen won’t load it).

We can make lldb copy the libraries to a temp folder and assign to them unique names, for example, or make the user responsible for that. At least I don’t know of other ways to load the “same” library twice in the process.

What’s still not there:

  • Dealing with libraries’ variables (global, static, etc), even if it’s just by copying the old values;
  • Aborting if too much has changed (this would require some clang integration), like class/struct layouts, etc;
  • Making it work on ARM (normally we should only need to implement the two ABI functions;
  • Making sure there is enough space for a trampoline (Right now, the ProcessFix command doesn’t check for space);

Other features:

  • Update only some uses of the libraries (like Greg’s idea of only changing the GOT of some of the modules).

Please let me know what you think of this and maybe provide some feedback.



fix-and-continue.patch (16.6 KB)