Skip to content

Commit

Permalink
docs: update gdb commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nic11 authored Dec 1, 2024
1 parent 5b3dc82 commit cdf468f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions docs/docs_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ Several actions are available:

## Debugging crashes

tl;dr These are the commands that you would probably be interested in the most:
```sh
# To attach to the running server
docker exec -it -u 0:0 skymp-server-indev sh -c 'gdb -p "`pgrep node`" -ex c'

# To debug a crash (needs some configuration, see below for details)
ls -lh /var/crash
docker exec -it skymp-server-indev gdb /usr/bin/node /var/crash/...
```

Deployed server might crash under some circumstances. It's important to be able
to be able to debug it in case something goes wrong.

Expand All @@ -124,13 +134,20 @@ Prerequisites:

To attach to the server, run:
```
$ docker exec -it -u 0:0 skymp-server-indev sh -c 'gdb -p "`pgrep node`"'
$ docker exec -it -u 0:0 skymp-server-indev sh -c 'gdb -p "`pgrep node`" -ex c'
<...>
(gdb) c
Continuing.
```

Note that gdb needs a couple of seconds to load everything. Server is going to be paused
during that period. Normally gdb would keep the execution paused until it receives some
user input, but in this case `-ex c` tells gdb to continue the execution right after
attaching (i.e. run `c` once attached). This will help us minimise the pause time.
A simple Ctrl-C would pause the execution again and return us to the gdb prompt.
Please be careful running that on a server with active players.

All typical gdb commands should be available now. Set breakpoints or just type
`c` to contrinue execution right away.
`c` to continue the execution.

### Collecting core dumps

Expand Down

0 comments on commit cdf468f

Please sign in to comment.