Home | Syllabus | Assignments | Resources | Piazza |
In addition to the tools that come pre-installed on the VM, you'll need some CS161-specific tools. We have packaged these tools up in a Personal Package Archive (PPA), which you can easily install. In a terminal window, at the command-line prompt, type this . . .
% sudo apt-get install -y git. . . to install the git tools that you'll use to manage your source code. Then, type this:
% sudo add-apt-repository ppa:cs161/sp2017 % sudo apt-get update % sudo apt-get install os161-toolchain
You may be wondering what the last three commands installed. We're glad you asked!
It should come as no surprise to you that we expect that you will need to use a debugger to complete assignments in this course. The good news is that just about everything you've learned about using gdb will apply to debugging OS/161. However, you may be wondering exactly how this is going to work since you will be building an operating system for something resembling a MIPS processor and you will be running on an Intel-based system.
We use a specially compiled version of gcc (and its associated tools) designed to produce code runnable on System/161. Thus, we have our own version of gcc (available as os161-gcc) and, among other things, our own version of gdb (available as os161-gdb).
For the most part, debugging your kernel will be no different from debugging any other program with gdb. There is a small caveat, however. Consider the following: the program that is actually running on your virtual machine will be System/161 (the executable will be called sys161). You don't want to debug System/161. You want to debug what is being run on System/161. Thus, a little cleverness is required.
You will have gdb communicate with System/161 through a Unix socket in order to send and receive debugging information. Thus, debugging your kernel generally takes three steps (after you've built your kernel (which we will do in class on Thursday), give this a try):
% sys161 -w kernel
% os161-gdb kernel
(gdb) target remote unix:.sockets/gdb
The handout Debugging with GDB provides a brief introduction to gdb and detailed instructions on how to debug your operating system with it.