# Re-compile /usr/bin/Xorg for debugging with gdb

## rlx

I'm trying to get some use out of my old Thinkpad 770Z with gentoo, however I keep getting a signal error in X.

What incantations do I have to use to get a suitably compiled /usr/bin/Xorg for debugging with gdb?

----------

## Sadako

I'm not a dev, but I think what you need is -ggdb appended to CFLAGS and nostrip appended to FEATURES.

I have the following in make.conf, which makes things easier;

```
CFLAGS='-O2 -march=k8-sse3 -fforce-addr -pipe'

#CFLAGS="${CFLAGS} -ggdb"

CXXFLAGS="${CFLAGS}"

FEATURES='strict sandbox userfetch usersandbox parallel-fetch sfperms'

FEATURES="${FEATURES} collision-protect"

FEATURES="${FEATURES} userpriv"

#FEATURES="${FEATURES} nostrip"
```

I can easily enable and disable what I want simply by commenting/uncommenting the related entries.

----------

## rlx

Thanks for the input.

I've actually got that far.  I guess the real question is "what commands will build /usr/bin/Xorg and as few other things as possible".

I tried re-building the packages I thought were the right ones but (on my old TP) the emerge ran for about 5 days and rebuilt a huge chunk of x-related stuff but not Xorg...

----------

## Sadako

emerge --oneshot xorg-server

If you have app-portage/gentoolkit installed, you could have run `equery b /usr/bin/Xorg` to find out which package that file belongs to.

----------

## Hu

Using FEATURES=nostrip is a valid way of obtaining the debugging information, but if you do not intend to do debugging long term, you may be better served by instead using FEATURES=splitdebug.  This will place the debugging information in separate files that you can delete or compress when you no longer need the debugging information.  When using FEATURES=nostrip, the debug symbols are embedded in the main files, and eliminating just the debug symbols without hurting the main file is a bit more trouble.

----------

## rlx

Thanks everyone, that worked.

Now to get to grips with the X segfault...

----------

