dockerなxv6でdebugする

dockerなxv6でdebugする

docker for macを用います

# お手軽

これを使う

$git clone git@github.com:matac42/xv6-riscv.git

$cd xv6-riscv

$docker-compose build --no-cache

$docker-compose run --name xv6 xv6

別端末にて

$docker exec -it xv6 /bin/sh

#gdb-multiarch

# 詳細

# xv6をcloneする

$git clone git@github.com:mit-pdos/xv6-riscv.git

$cd xv6-riscv

# Dockerfile, docker-compose.yml, root-gdbinitを作成する

Dockerfile

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
FROM debian:10.3

COPY root-gdbinit /root/.gdbinit

RUN apt-get update && apt-get install -y \
  git \
  zsh \
  build-essential \
  gdb-multiarch \
  qemu-system-misc \
  gcc-riscv64-linux-gnu \
  binutils-riscv64-linux-gnu

WORKDIR /xv6

# for running
#CMD [ "make", "qemu" ]
# for debug
CMD [ "make", "qemu-gdb" ]

docker-compose.yml

1
2
3
4
5
6
7
8
version: "3.8"
services:
  xv6:
    build: .
    container_name: xv6
    volumes:
      - .:/xv6
    working_dir: /xv6

root-gdbinit

1
2
add-auto-load-safe-path /xv6/.gdbinit
set auto-load safe-path /

# build & run

$docker-compose build

$docker-compose run --name xv6 xv6

# debug

別端末にて

$docker exec -it xv6 /bin/zsh

#gdb-multiarch

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy