winecodebase

Understanding a Large, Undocumented Set of Source Code?


I have always been astonished by Wine. Sometimes I want to hack on it, fix little things and generally understand how it works. So, I download the Wine source code and right after that I feel overwhelmed. The codebase is huge and - unlike the Linux Kernel - there are almost no guides about the code.

What are the best-practices for understanding such a huge codebase?


Solution

  • With a complex code base the biggest mistake you can make is trying to be a computer. Get the computer to run the code, and use a debugger to help find out what is going on.

    1. Figure out how to compile, install and run your own version of Wine from the existing source code.

    2. Learn how debug (e.g. use gdb) on a running instance of your version of Wine.

    3. Run Wine under the debugger and make cause it to demonstrate the undesired behaviour.

    4. The fun part: find where the code execution path goes and start learning how it all goes together.

    Yes, reading lots and lots of code will help, but the compiler/debugger/computer can run code a lot faster than you.