|
| 1 | +Libunwind with Patches for Xen Unikernel Unwinding |
| 2 | +================================================== |
| 3 | + |
| 4 | +(Note: the original, upstream readme can be found in README.) |
| 5 | + |
| 6 | +This is a fork of libunwind (http://www.nongnu.org/libunwind/), a library to |
| 7 | +unwind the stack and create a callchain. This fork is extended by support for |
| 8 | +Xen virtual machines. This is especially useful for Unikernels, in which the |
| 9 | +kernel and application form a single binary sharing a common address space. By |
| 10 | +using libunwind-xen, a unikernel's (or, in theory, any other VM's) stack can |
| 11 | +be unwound from the outside. One of the main uses for this is the sampling of |
| 12 | +call chains at runtime as a profiling tool. |
| 13 | + |
| 14 | +The way libunwind does this is by using the `.eh_frame information` created by a |
| 15 | +compiler at compile time. By comparing the stack addresses in the running VM |
| 16 | +to those in the ELF's `.eh_frame section`, it can assess the size of the |
| 17 | +currently running function's frame on the stack, unroll it to retrieve the |
| 18 | +prveious instruction pointer, and iterate over this until the end of the stack |
| 19 | +is reached. This means that you need compiler support to create an `.eh_frame`, |
| 20 | +but the good news is that this is almost universally supported out-of-the-box |
| 21 | +and by default. It also means that you do not need a frame pointer, so you can |
| 22 | +produce stack traces on binaries compiles with `-fomit-frame-pointer` for higher |
| 23 | +performance, or on architectures that do not provide a frame pointer register. |
| 24 | + |
| 25 | +This current implementation is quite bare-bones and does not support |
| 26 | +functionality that isn't required for stack walking. For example, there is no |
| 27 | +support for writing memory or registers, only reading. It currently also only |
| 28 | +supports the x86 version of Xen. Extensions of this starting point should be |
| 29 | +easy though, if more is required at any point in the future. |
| 30 | + |
| 31 | + |
| 32 | +# Build and Install |
| 33 | + |
| 34 | +1. ./autogen.sh |
| 35 | +2. ./configure |
| 36 | +3. make |
| 37 | +4. make install |
| 38 | + |
| 39 | + |
| 40 | +# Use |
| 41 | + |
| 42 | +For tracing Xen virtual machines, link your application against |
| 43 | +libunwind-generic and libunwind-xen. |
0 commit comments