From 986654e9b9e0655434c57c723b61e9fb1ae59bf1 Mon Sep 17 00:00:00 2001 From: Kenneth R Hancock <krhancoc@uwaterloo.ca> Date: Fri, 14 Jan 2022 11:43:09 -0700 Subject: [PATCH] README Clarifications and Fixup * Clarified usage of gdb in README * Addition of connect.sh script to help with gdb * Fixup to move copying of kern directory to os161-1.99 directory to the build_kernel function rather than unpack. * Added git to the container --- .gitignore | 1 + README.md | 34 +++++++++++++++++++++++++++++++--- connect.sh | 3 +++ os161-container/Dockerfile | 3 +-- os161-container/helpers.sh | 2 +- 5 files changed, 37 insertions(+), 6 deletions(-) create mode 100755 connect.sh diff --git a/.gitignore b/.gitignore index 78a67df..e7d1732 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ assignments +logs diff --git a/README.md b/README.md index 4113f20..54b4d23 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 0000000..13addbb --- /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 1514ba6..5859bcf 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 f6e7a16..a5174c7 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..." -- GitLab