diff --git a/.gitignore b/.gitignore index 78a67df750016a83d96c48461be93587e1f02212..e7d1732e285a5f916d85c77e4f6563df424f4572 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ assignments +logs diff --git a/README.md b/README.md index 4113f208537337bfd0851e2b01a6dc1a3ef9ee4c..54b4d2303137790756a9dbc0364740ddc3a8155c 100644 --- a/README.md +++ b/README.md @@ -49,16 +49,43 @@ assignment number. Within the container you may run within the shell (these functions are preloaded in your shell): ``` -build_kernel ASST0 -test_kernel ASST0 +# build_kernel ASST0 +# test_kernel ASST0 ``` To build and run within the context of ASST0. Finally you may evaluate your assignment based off public test cases (there could be hidden ones not found within the repo) ``` -/evalaute /logs/test_public.log /assignments/ASST0 +# /evalaute /logs/test_public.log /assignments/ASST0 ``` +## Running GDB + +To run GDB, in a window with the container running and having built the kernel using the `build_kernel ASST0`: +``` +# cd /os-compile/ +# sys161 -w kernel +``` + +Now in another terminal, move to this project directory and use the `./connect.sh` script to connect to the running container: +``` +# cd /os-compile/ +# cs350-gdb kernel +# cd os-compile/ +# cs350-gdb kernel + +GNU gdb 6.6 +Copyright (C) 2006 Free Software Foundation, Inc. +... +(gdb) dir /kernel/kern/compile/ASST0 +... +``` +You will need to use the command `dir /kernel/kern/compile/ASST#` where `#` is the assignment number. This will make sure to load the symbols +of the kernel. Symbols are the names we have given functions and variables, this allows gdb to convey what you are looking at (this is because +the kernel has been compiled WITH these symbols in mind), otherwise gdb will show just bare assembly! + +Note: If `./connect.sh` does not work it may be because you have multiple running containers of os161-runner. Use `docker ps` to figure this out. +This script is not a smart script just an ease of use script. ## Running other assignments You may point the `run.sh` to any directory as all this does is makes sure that the directory is shared between the container and you. Allowing you to @@ -72,6 +99,7 @@ When mounting other directories that are not os161 note that the `build_kernel` There are some noted directories within the container * `/kernel` holds YOUR assignment code * `/os161-1.99` holds unchanged os161 kernel code +* `/os-compile` holds the compiled version of the code * `/assignments` holds testing and evaluation scripts used for each assignment Within the `/assignments` directory there are subdirectories for each assignment, to see the test cases we pass and use, looks to the `public` file, diff --git a/connect.sh b/connect.sh new file mode 100755 index 0000000000000000000000000000000000000000..13addbb7be847e0645e5943bb7e3007a16db6bcd --- /dev/null +++ b/connect.sh @@ -0,0 +1,3 @@ +#/usr/bin/env bash +ID=`docker ps -aqf "ancestor=os161-runner"` +docker exec -it $ID /bin/bash diff --git a/os161-container/Dockerfile b/os161-container/Dockerfile index 1514ba65124974f9bf7c7163de7fb3aeaf22d1ff..5859bcf2e9c8de3310a74d4a16dbec60e42579da 100644 --- a/os161-container/Dockerfile +++ b/os161-container/Dockerfile @@ -1,9 +1,8 @@ FROM ubuntu:18.04 - # Update gcc - ubuntu is used cause seems alpine gets upset RUN apt-get update && \ - apt-get install --no-install-recommends -y gcc make wget g++ python3 libncurses-dev python3-pip && \ + apt-get install --no-install-recommends -y gcc make wget g++ python3 libncurses-dev python3-pip git && \ rm -rf /var/lib/apt/lists/* # Setup directories diff --git a/os161-container/helpers.sh b/os161-container/helpers.sh index f6e7a16b3fe2d168645849fdd227ae9538e6b213..a5174c77d199b961d61f49f8e4fef26023d8c1d3 100755 --- a/os161-container/helpers.sh +++ b/os161-container/helpers.sh @@ -6,12 +6,12 @@ export PATH=$PATH:/os161/tools/bin unpack_kernel() { mkdir /kernel tar -xf /assignment.tgz -C /kernel --strip-components 1 - cp -r /kernel/kern/* $OS161_DIR/kern/ } build_k_helper() { cd $OS161_DIR mkdir /os-compile + cp -r /kernel/kern/* $OS161_DIR/kern/ set -e # Configure - step 1 echo "[CS350] $1 Configuring Kernel..."