Once you've got something that runs, you can put a debugger on it. We recommend use of the GNU debugger
And many developers use the graphical debugger tool DDD - Data Display Debugger
These are free and common, they're probably on your Linux system already.
There are debuggers for Windows and other operating systems, of course don't feel left out just because we're mentioning a Linux tool name! But it happens that we do a lot of things with Linux ourselves, so we happen to know what to say. To debug the mysqld server, say:
ddd --gdb --args \ $HOME/mysql-bin/libexec/mysqld \ --basedir=$HOME/mysql-bin \ --datadir=$HOME/mysql-bin/var\ --skip-networking
From this point on, it may be tempting to follow along through the rest of the "guided tour" by setting breakpoints, displaying the contents of variables, and watching what happens after starting a client from another shell. That would be more fun. But it would require a detour, to discuss how to use the debugger. So we'll plow forward, the dull way, noting what's in the directories and using a text editor to note what's in the individual files.