- An "auto-load safe-path" should be set in ~/.gdbinit, either / or a path to this directory:
echo "set auto-load safe-path /" >> ~/.gdbinit- Install libraries required for Qemu and Buildroot:
# Fedora
sudo dnf install \
ncurses-devel perl-ExtUtils-MakeMaker ninja-build \
glib2-devel pixman-devel libslirp-devel \
perl-IPC-Cmd perl-open lz4 gawk make gcc \
libmpc-devel gmp-devel
# Ubuntu
sudo apt install \
libncurses-dev libextutils-makemaker-cpanfile-perl ninja-build \
libglib2.0-dev libpixman-1-dev libslirp-dev
libipc-run-perl lz4 gawk make gcc \
libmpc-dev libgmp-dev- Build everything:
./init_build.sh- Start Qemu
./8_run.sh- Enter login
root(without password) - Run the compiler barriers demo
/opt/compiler_opts- Run the CPU barriers demo
/opt/cpu_opts- Read and edit the code
$EDITOR demo_races/compiler_opts.c
$EDITOR demo_races/cpu_opts.c- Rebuild and re-run
./rebuild_rerun.sh-
Exit Qemu with key combination
Ctrl + A, Xorpoweroff -
Run on a local machine:
% ./output/cpu_opts
without barriers: !A!B 942, !AB 24, A!B 33, AB 0
with barriers: !A!B 0, !AB 2, A!B 4, AB 993
%