Skip to content

Commit af797d5

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

2 files changed

Lines changed: 64 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: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Troubleshooting badly behaving apps
2+
3+
Despite the best efforts of Void Linux maintainers, it is possible that you will have issues
4+
with packages from the official repositories. On such cases, there are some
5+
steps to follow in order to provide as complete a bug report as possible.
6+
7+
Some of these steps can even help you find the cause of the issue yourself!
8+
9+
## Look at error messages attentively THIS NEEDS WORK
10+
11+
Python programs, for example, complain loudly about missing modules and other
12+
issues like that. If you're using a compiled binary, and it's missing libraries
13+
for some reason, your dynamic linker should tell you as well.
14+
15+
## Check for issues in the package database
16+
17+
You can use the `-a` flag for
18+
[xbps-pkgdb(1)](https://man.voidlinux.org/xbps-pkgdb.1) to run a complete check
19+
on all systems packages, which can detect any files that may have been altered
20+
when they shouldn't have been. For any of the files listed in this step, you
21+
should attempt to reinstall them with the `-f` flag for
22+
[xbps-install(1)](https://man.voidlinux.org/xbps-install.1). An example can be
23+
seen below:
24+
25+
```
26+
# xbps-pkgdb -a
27+
ERROR: p7zip: hash mismatch for /usr/bin/7z.
28+
ERROR: p7zip: files check FAILED.
29+
# xbps-install -f p7zip
30+
```
31+
32+
After this is done, check if the issue persists. It should be noted that issues
33+
like this can indicate hardware issues in your storage media or RAM.
34+
35+
## Strace the program
36+
37+
If the issue is caused by a program, you can run it under the
38+
[strace(1)](https://man.voidlinux.org/strace.1) utility to check if it's
39+
trying, for example, to access files that don't exist, and their programmer
40+
didn't implement a proper fallback or error message.
41+
42+
## Debug the program NEEDS WORK
43+
44+
If a look at `strace` wasn't enough, it may be possible to use the GNU
45+
debugger, [gdb(1)](https://man.voidlinux.org/gdb.1), to step through the
46+
program's execution. You can [install debug
47+
packages](../xbps/repositories/index.md) or use Void's
48+
[Debuginfod](https://sourceware.org/elfutils/Debuginfod.html) server. GDB is
49+
especially useful when an application crashes with `SIGABRT` or `SIGSEGV` (see
50+
[signal(7)](https://man.voidlinux.org/signal.7), since it will stop execution
51+
at that point and you can print a backtrace showing all the function calls that
52+
lead to that place. An example using the Debuginfod server is show below:
53+
54+
```
55+
$ DEBUGINFOD_URLS="https://debugingod.s.voidlinux.org" gdb --args <program> [arguments]
56+
```
57+
58+
Inside GDB, some useful commands are:
59+
60+
- `set logging on`, which creates a `gdb.txt` file which can be shared easily;
61+
- `backtrace`, which shows the function calls made until the application got to that place;
62+
- `info threads`, which shows information about threads in the program;
63+
- `break <function>`, which puts a breakpoint in a function that you may think is suspect.

0 commit comments

Comments
 (0)