PDA

View Full Version : How to compile a portion of FreeBSD code with debugging (Sysinstall for example)


rhyous
January 3rd, 2010, 03:03
Well, here is what I wrote for this week.

How to compile a portion of FreeBSD code with debugging? (Sysinstall for example) (http://rhyous.com/2010/01/01/how-to-compile-a-portion-of-freebsd-code-sysinstall-for-this-example-with-debugging/)

Ok, so maybe you want to work on fixing something in a portion of FreeBSD code, but you lack the knowledge to get started. That is what this document is for, to get you started.

For this example, I am going to use Sysinstall...

So lets get started.

Step 1 – Install FreeBSD
...
Step 2 – Download the FreeBSD Source
...
Step 3 – Find the location of the portion of source you wish to compile (Sysinstall in this example)
...
Step 4 - Compile with debugging.

Read the full "How to" here... (http://rhyous.com/2010/01/01/how-to-compile-a-portion-of-freebsd-code-sysinstall-for-this-example-with-debugging/)

graudeejs
January 3rd, 2010, 09:23
I'd add to /etc/make.conf

CFLAGS+=-g
CXXFLAGS+=-g

and then rebuild everything

Note that FreeBSD will be slower.
also read GENERIC kernel configuration file if you need to debug kernel....

P.S.
This is what I would try.... I haven't done this...

danger@
January 3rd, 2010, 10:59
I havent done any benchmarking, but I was in the impression that -g only makes the binaries bigger in the size and does not affect the performance.

graudeejs
January 3rd, 2010, 11:18
maybe.... dunno

MG
January 4th, 2010, 10:05
When your FreeBSD src.tar.gz is installed and CFLAGS has the -g option in /ec/make.conf:


cd /usr/src/usr.sbin/sysinstall
make && make install (or grab the files yourself in /usr/obj/usr/src/usr.sbin)

dennylin93
January 4th, 2010, 12:51
I havent done any benchmarking, but I was in the impression that -g only makes the binaries bigger in the size and does not affect the performance.

More info here: 6.0R GENERIC makeoptions DEBUG=-g (http://lists.freebsd.org/pipermail/freebsd-questions/2005-November/104395.html).