Skip to content

Commit 7055019

Browse files
committed
contributing/debug: new page.
1 parent dcfe571 commit 7055019

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,4 @@
7777
- [Static XBPS](./xbps/troubleshooting/static.md)
7878
- [Contributing](./contributing/index.md)
7979
- [Contributing To void-docs](./contributing/void-docs.md)
80+
- [Troubleshooting Packages](./contributing/debug.md)

src/contributing/debug.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Troubleshooting badly behaving apps
2+
3+
Despite the best efforts of Void Linux maintainers, it is possible that you will
4+
have issues with packages from the official repositories. On such cases, there
5+
are some steps you can follow in order to provide as complete a bug report as
6+
possible.
7+
8+
Some of these steps can even help you find the cause of the issue yourself!
9+
10+
## Look at error messages attentively
11+
12+
It is possible the program's output tells you why it errors out, so you can try
13+
to run it in a terminal. For example:
14+
15+
- Python programs complain loudly about missing modules or resources.
16+
- If you're using a compiled binary, and it can't find the libraries it depends
17+
on, your dynamic linker will tell you about it.
18+
19+
## Check for issues in the package database
20+
21+
You can use the `-a` flag for
22+
[xbps-pkgdb(1)](https://man.voidlinux.org/xbps-pkgdb.1) to run a complete check
23+
on all systems packages, which can detect any files that may have been altered
24+
when they shouldn't have been. You should attempt to reinstall all the packages
25+
listed in this step, using the `-f` flag for
26+
[xbps-install(1)](https://man.voidlinux.org/xbps-install.1). For example:
27+
28+
```
29+
# xbps-pkgdb -a
30+
ERROR: p7zip: hash mismatch for /usr/bin/7z.
31+
ERROR: p7zip: files check FAILED.
32+
# xbps-install -f p7zip
33+
```
34+
35+
After this is done, you should check if the issue persists.
36+
37+
## Strace the program
38+
39+
If the issue is caused by a program, you can run it under the
40+
[strace(1)](https://man.voidlinux.org/strace.1) utility to check if it's trying,
41+
for example, to access files that don't exist but that it expects to exist.
42+
43+
## Debug the program NEEDS WORK
44+
45+
If a look at `strace` wasn't enough, it is possible to use a debugger like
46+
[gdb(1)](https://man.voidlinux.org/gdb.1) to step through the program's
47+
execution. You can [install debug packages](../xbps/repositories/index.md) or
48+
use Void's [Debuginfod](https://sourceware.org/elfutils/Debuginfod.html) server.
49+
To use the Debuginfod server, you need to export the `DEBUGINFOD_URLS`
50+
environment variable with a value of `https://debugingod.s.voidlinux.org` or
51+
`https://debuginfod.elfutils.org/`.
52+
53+
GDB is especially useful when an application crashes abnormally, since it will
54+
stop execution at that point, and you can gather relevant information there. The
55+
syntax for using `gdb` is shown below, including the Debuginfod variable:
56+
57+
```
58+
$ DEBUGINFOD_URLS="https://debugingod.s.voidlinux.org" gdb --args <program> [arguments]
59+
```
60+
61+
Inside GDB, a usual session will run the following commands:
62+
63+
- `run` to start the application;
64+
- `set logging on`, to create a `gdb.txt` file which can be shared easily;
65+
- `backtrace`, to show the function calls made until the application got to that
66+
place;
67+
- `quit`, to close `gdb`.

0 commit comments

Comments
 (0)