-
David Johnson authored
After all these years, finally we have something reasonable as a debugserver. The point of a debugserver is to load (in advance) a debuginfo file into shared memory, so that dwdebug consumers (like the target library) can just mmap the data structures pre-allocated in shared mem. This is surprisingly hard. I've looked many times for malloc replacements that would let me restrict the heap to a fixed base address, which I have to choose at a "good" location so that it has high probability of being able to be mmap'd into client processes. But I never found any that naturally supported it in the API. Well, silly me, I just hadn't ever read dlmalloc. That gives me everything I need. So my strategy is the usual POSIX shm thing: shm_open + ftruncate + mmap; then I have ftruncate + mremap to allocate more core mem to the heap. Then I create a DL mspace at a fixed base addr of my choosing, and basically switch heaps to that one. Then any future allocations are all done there. That means, of course, that all the pointers are right in the structs in the shm, which was the goal. There's still some work to be done before clients can use this, but this is the core.
84a5f4b4