Re: Documentation for makeoptions DEBUG="-g" may need improvement

2018-06-16 Thread Jason McIntyre
On Thu, Jun 14, 2018 at 03:33:57AM +0300, IL Ka wrote:
> Hello,
> 
> config(8) says:
> "To debug kernels and their crash dumps with gdb, add ???makeoptions
> DEBUG="-g"??? to the kernel configuration file.  Refer to options(4) for
> further details."
> 
> 1) kernel Makefile has DEBUG?= -g so you do not need to add
> anything to have it: you just need not to overwrite it
> 
> 2) -g otpion is used not only for bsd.gdb: it also adds debug symbols
> to .obj files, which is used by objdump -dlr as covered here:
> https://www.openbsd.org/ddb.html
> 
> options(4) says:
> "makeoptions DEBUG=""
> Do not build the debug kernel bsd.gdb."
> 
> It is true, however it still says -g is used only for bsd.gdb
> 
> /sys/arch//compile/GENRIC/obj/Makefile says:
> "# DEBUG is set to -g by config if debugging is requested (config -g)."
> 
> But config(8) does not have "-g" option
> (I believe it had it many years ago, but it is now controlled by
> options(4)).
> 
> 
> All of that could be confusing.
> Some may think that  "makeoptions DEBUG=""" only disables bsd.gdb,
> but with it you have .obj files with no debug info,
> so https://www.openbsd.org/ddb.html recipe does not work.
> 
> I know that users should not recompile kernels, but I suggest to:
> 
> * Fix config(8) man page:
> It should say that "-g" is default unless you set DEBUG="" explicitly
> * Add paragraph to config(8) and options(4) that says -g is needed
> to have .obj files with debug symbols
> * Add line to "ddb.html" that says you need to build kernel with "-g"
> (do not turn it off) to be able to run objdump -ldr
> * Change comment in Makefile about "-g" option.
> 
> I can prepare diff if you agree.

morning.

i think a diff would be simplest, yes.

jmc



Documentation for makeoptions DEBUG="-g" may need improvement

2018-06-13 Thread IL Ka
Hello,

config(8) says:
"To debug kernels and their crash dumps with gdb, add “makeoptions
DEBUG="-g"” to the kernel configuration file.  Refer to options(4) for
further details."

1) kernel Makefile has DEBUG?= -g so you do not need to add
anything to have it: you just need not to overwrite it

2) -g otpion is used not only for bsd.gdb: it also adds debug symbols
to .obj files, which is used by objdump -dlr as covered here:
https://www.openbsd.org/ddb.html

options(4) says:
"makeoptions DEBUG=""
Do not build the debug kernel bsd.gdb."

It is true, however it still says -g is used only for bsd.gdb

/sys/arch//compile/GENRIC/obj/Makefile says:
"# DEBUG is set to -g by config if debugging is requested (config -g)."

But config(8) does not have "-g" option
(I believe it had it many years ago, but it is now controlled by
options(4)).


All of that could be confusing.
Some may think that  "makeoptions DEBUG=""" only disables bsd.gdb,
but with it you have .obj files with no debug info,
so https://www.openbsd.org/ddb.html recipe does not work.

I know that users should not recompile kernels, but I suggest to:

* Fix config(8) man page:
It should say that "-g" is default unless you set DEBUG="" explicitly
* Add paragraph to config(8) and options(4) that says -g is needed
to have .obj files with debug symbols
* Add line to "ddb.html" that says you need to build kernel with "-g"
(do not turn it off) to be able to run objdump -ldr
* Change comment in Makefile about "-g" option.

I can prepare diff if you agree.