Document how to run gdb debugger

This commit is contained in:
Chocobo1 2023-01-17 02:58:26 +08:00
parent afa770fc2c
commit 03ac3722c3
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
5 changed files with 41 additions and 2 deletions

View File

@ -116,7 +116,6 @@ RUN \
bash \
curl \
doas \
musl-dbg \
python3 \
qt6-qtbase \
tini \

View File

@ -132,3 +132,38 @@ https://github.com/qbittorrent/qBittorrent/issues
## Build image manually
Refer to [manual_build](https://github.com/qbittorrent/docker-qbittorrent-nox/tree/main/manual_build) folder.
## Debugging
To attach gdb to the running qbittorent-nox process, follow the steps below:
1. Before you start the container
* Remove `--read-only` as it will need additional packages within the container. \
Or disable the respective attributes in docker-compose.yml.
* Add `--cap-add=SYS_PTRACE` to `docker run` argument list. \
Or enable the respective attributes in docker-compose.yml.
2. Start the container
3. Drop into container
```shell
# to find container id
docker ps
# drop into container
docker exec -it <container_id> /bin/sh
```
4. Install packages
```shell
apk add \
gdb \
musl-dbg
```
5. Attach gdb to the running process
```shell
# to find PID of qbittorrent-nox
ps -a
# attach debugger
gdb -p <PID>
```

View File

@ -2,6 +2,9 @@ version: "3.9"
services:
qbittorrent-nox:
# for debugging
#cap_add:
#- SYS_PTRACE
container_name: qbittorrent-nox
environment:
#- PGID=1000

View File

@ -116,7 +116,6 @@ RUN \
bash \
curl \
doas \
musl-dbg \
python3 \
qt6-qtbase \
tini \

View File

@ -3,6 +3,9 @@ version: "3.9"
services:
qbittorrent-nox:
build: .
# for debugging
#cap_add:
#- SYS_PTRACE
container_name: qbittorrent-nox
environment:
#- PGID=1000