2012-12-19 12:57:02 +01:00
## Requirements
You must be comfortable with [C][1], [XCB][2] and [Git][3].
## Coding Style
2015-11-09 15:00:47 +01:00
I follow the [Linux Coding Style][4] with the following variations:
2015-11-16 20:36:04 -05:00
- [Indent with tabs, align with spaces][5].
2015-11-09 15:00:47 +01:00
- Always use braces with if/else.
2012-12-19 12:57:02 +01:00
## Browsing the Code
If you use `vim` :
- Hitting *K* will lead you to the manual page of the function under the cursor (works with most `xcb_*` functions), sometimes you'll have to explicitly specify the section of the manual you're interested in with *3K* (e.g.: `open` ).
2012-12-19 17:51:43 +01:00
- Install `ctags` and run `ctags *.{c,h}` in the directory holding the source. Then, hitting *Ctrl-]* will lead you to the definition of the function/variable/structure under the cursor (to go back: *Ctrl-T* ).
2012-12-19 12:57:02 +01:00
- You can run `make` from `vim` with `:make` and then navigate to the next and the previous error with `:cn` and `:cp` .
## Debugging
2015-02-05 10:42:28 +01:00
To install debug executables:
2012-12-21 10:55:13 +01:00
```
2015-02-05 10:42:28 +01:00
make clean debug & & make install
2012-12-21 10:55:13 +01:00
```
2012-12-19 12:57:02 +01:00
2015-02-05 10:42:28 +01:00
You can attach to a running *bspwm* process with:
2012-12-19 12:57:02 +01:00
```
gdb bspwm $(pgrep -x bspwm)
2015-02-05 10:42:28 +01:00
c
2012-12-19 12:57:02 +01:00
```
2015-02-05 10:42:28 +01:00
Or if you just want to generate a backtrace (saved in `gdb.txt` ):
2015-02-05 10:44:07 +01:00
```
2015-02-05 10:42:28 +01:00
ulimit -c unlimited
startx
sudo systemd-coredumpctl gdb bspwm
set logging on
bt full
q
2015-02-05 10:44:07 +01:00
```
2012-12-19 14:42:19 +01:00
2012-12-19 12:57:02 +01:00
[1]: http://cm.bell-labs.com/cm/cs/cbook/
[2]: http://www.x.org/releases/X11R7.5/doc/libxcb/tutorial/
[3]: http://git-scm.com/documentation
[4]: http://www.kernel.org/doc/Documentation/CodingStyle
2015-11-09 15:00:47 +01:00
[5]: http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/