gdb: convert to the package infrastructure
PATCH v2 1/1 gdb: convert to the package infrastructure
This commit converts gdb to the package infrastructure, and therefore moves it from toolchain/gdb to package/gdb.
The target package is now visible in "Package selection for the target" => "Debugging, profiling and benchmark". The main option, "gdb", forcefully selects the "gdbserver" sub-option by default. Another sub-option, "full debugger" allows to install the complete gdb on the target. When this option is enabled, then "gdbserver" is no longer forcefully selected. This ensures that at least gdbserver or the full debugger gets built/installed, so that the package is not a no-op.
The host debugger is still enabled through a configuration option in "Toolchain". It is now visible regardless of the toolchain type (it used to be hidden for External Toolchains). The configuration options relative to the host debugger are now in package/gdb/Config.in.host, similar to how we have package/binutils/Config.in.host.
Since gdb is now a proper package, it is no longer allowed to 'select BR2_PTHREADS_DEBUG' to ensure thread debugging is available when needed. Instead, it now 'depends on BR2_TOOLCHAIN_HAS_THREADS_DEBUG'. This option, in turn, is select by the different toolchain backends when appropriate. The 'BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED' option is removed, since we no longer need to know when it is allowed to 'select BR2_PTHREADS_DEBUG'. Also, the 'BR2_PTHREADS_DEBUG' option is moved to appear right below the thread implementation selection (in the case of the Buildroot toolchain backend).
---
Changes from v1 to v2:
* Fixup the help text of BR2_PACKAGE_GDB to mention in which menu the cross-gdb can be enable, and the fact that external toolchains often provide their own pre-built versions of cross-gdb and gdbserver. Suggested by Arnout.
* No longer 'select BR2_PTHREAD_DEBUG' from the gdb package. As Arnout noticed, now that gdb is a normal package, it should not forcefully select a toolchain configuration option. Instead, it should depend on it being available. This allows to remove the BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED option: we now only have the BR2_TOOLCHAIN_HAS_THREADS_DEBUG, which gets selected by the various toolchain backends when appropriate, and the gdb package depends on it.
* Factorize the definition of GDB_SITE. Suggested by Arnout.
* Add a small comment that explains why we remove /usr/share/gdb from the target. Suggested by Arnout.
---
Config.in.legacy | 11 +
package/Config.in | 1 +
.../gdb/6.6a/100-uclibc-conf.patch | 0
.../gdb/6.6a/600-fix-compile-flag-mismatch.patch | 0
.../gdb/6.6a/gdb-6.6-bfin-gdbserver.patch | 0
.../gdb/7.4.1/00_all_ptrace_setsiginfo.patch | 0
.../gdb/7.4.1/05_all_readline-headers.patch | 0
.../gdb/7.4.1/xtensa-asm-ptrace-h.patch | 0
.../gdb/7.4.1/xtensa-gdb-regsize.patch | 0
package/gdb/Config.in | 40 ++++
package/gdb/Config.in.host | 56 +++++
package/gdb/gdb.mk | 101 +++++++++
toolchain/Config.in | 2 -
toolchain/gdb/Config.in | 99 ---------
toolchain/gdb/gdb.mk | 234 --------------------
toolchain/toolchain-buildroot.mk | 1 -
toolchain/toolchain-buildroot/Config.in.2 | 7 +
toolchain/toolchain-common.in | 7 +-
toolchain/toolchain-crosstool-ng.mk | 1 -
toolchain/toolchain-crosstool-ng/Config.in | 3 +
toolchain/toolchain-external.mk | 1 -
toolchain/toolchain-external/Config.in | 7 +
toolchain/uClibc/Config.in | 6 -
23 files changed, 227 insertions(+), 350 deletions(-)
rename {toolchain => package}/gdb/6.6a/100-uclibc-conf.patch (100%)
rename {toolchain => package}/gdb/6.6a/600-fix-compile-flag-mismatch.patch (100%)
rename {toolchain => package}/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch (100%)
rename {toolchain => package}/gdb/7.4.1/00_all_ptrace_setsiginfo.patch (100%)
rename {toolchain => package}/gdb/7.4.1/05_all_readline-headers.patch (100%)
rename {toolchain => package}/gdb/7.4.1/xtensa-asm-ptrace-h.patch (100%)
rename {toolchain => package}/gdb/7.4.1/xtensa-gdb-regsize.patch (100%)
create mode 100644 package/gdb/Config.in
create mode 100644 package/gdb/Config.in.host
create mode 100644 package/gdb/gdb.mk
delete mode 100644 toolchain/gdb/Config.in
delete mode 100644 toolchain/gdb/gdb.mkConfig.in.legacy +11 -0
@@ -40,6 +40,17 @@ comment "As long as these options stay selected, the build " comment "will fail. " endif +# +# Legacy options since 2013.02 +# +config BR2_PACKAGE_GDB_HOST + bool "gdb for the host option has been renamed" + select BR2_PACKAGE_HOST_GDB + select BR2_LEGACY + help + Due to the conversion of gdb to the package infrastructure, + the BR2_PACKAGE_GDB_HOST option has been renamed + BR2_PACKAGE_HOST_GDB. # # Legacy options since 2012.11
package/Config.in +1 -0
@@ -22,6 +22,7 @@ source "package/cache-calibrator/Config.in" source "package/dhrystone/Config.in" source "package/dstat/Config.in" source "package/dmalloc/Config.in" +source "package/gdb/Config.in" source "package/kexec/Config.in" source "package/latencytop/Config.in" source "package/lmbench/Config.in"
package/gdb/6.6a/100-uclibc-conf.patch renamed from toolchain/gdb/6.6a/100-uclibc-conf.patch +0 -0
package/gdb/6.6a/600-fix-compile-flag-mismatch.patch renamed from toolchain/gdb/6.6a/600-fix-compile-flag-mismatch.patch +0 -0
package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch renamed from toolchain/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch +0 -0
package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch renamed from toolchain/gdb/7.4.1/00_all_ptrace_setsiginfo.patch +0 -0
package/gdb/7.4.1/05_all_readline-headers.patch renamed from toolchain/gdb/7.4.1/05_all_readline-headers.patch +0 -0
package/gdb/7.4.1/xtensa-asm-ptrace-h.patch renamed from toolchain/gdb/7.4.1/xtensa-asm-ptrace-h.patch +0 -0
package/gdb/7.4.1/xtensa-gdb-regsize.patch renamed from toolchain/gdb/7.4.1/xtensa-gdb-regsize.patch +0 -0
package/gdb/Config.in new file +40 -0
@@ -0,0 +1,40 @@ +config BR2_PACKAGE_GDB + bool "gdb" + select BR2_PACKAGE_GDB_SERVER if !BR2_PACKAGE_GDB_DEBUGGER + help + GDB, the GNU Project debugger, allows you to see what is + going on `inside' another program while it executes -- or + what another program was doing at the moment it crashed. + + This option allows to build gdbserver and/or the gdb + debugger for the target. + + For embedded development, the most common solution is to + build only 'gdbserver' for the target, and use a cross-gdb + on the host. See BR2_PACKAGE_HOST_GDB in the Toolchain menu + to enable one. Notice that external toolchains often provide + their own pre-built cross-gdb and gdbserver binaries. + + http://www.gnu.org/software/gdb/ + +if BR2_PACKAGE_GDB + +config BR2_PACKAGE_GDB_SERVER + bool "gdbserver" + help + Build the gdbserver stub to run on the target. + A full gdb is needed to debug the progam. + +config BR2_PACKAGE_GDB_DEBUGGER + bool "full debugger" + select BR2_PACKAGE_NCURSES + depends on BR2_USE_WCHAR + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_TOOLCHAIN_HAS_THREADS_DEBUG + depends on !BR2_sh && !BR2_sh64 && !BR2_avr32 && !BR2_microblaze && !BR2_bfin && !BR2_aarch64 + +comment "full gdb on target needs WCHAR, thread and thread debugging support in toolchain" + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \ + !BR2_TOOLCHAIN_HAS_THREADS_DEBUG + +endif
package/gdb/Config.in.host new file +56 -0
56 lines not on this page · raw message
package/gdb/gdb.mk new file +101 -0
101 lines not on this page · raw message
toolchain/Config.in +0 -2
@@ -12,7 +12,6 @@ config BR2_TOOLCHAIN_BUILDROOT bool "Buildroot toolchain" depends on !BR2_microblaze && !BR2_aarch64 select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS - select BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED config BR2_TOOLCHAIN_EXTERNAL bool "External toolchain"
@@ -25,7 +24,6 @@ config BR2_TOOLCHAIN_CTNG bool "Crosstool-NG toolchain" depends on !BR2_microblaze && !BR2_aarch64 && !BR2_xtensa select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS - select BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED help Say 'y' if you want to generate the toolchain with crosstool-NG ( http://ymorin.is-a-geek.org/projects/crosstool )
toolchain/gdb/Config.in deleted +0 -99
99 lines not on this page · raw message
toolchain/gdb/gdb.mk deleted +0 -234
234 lines not on this page · raw message
toolchain/toolchain-buildroot.mk +0 -1
@@ -2,6 +2,5 @@ include toolchain/elf2flt/elf2flt.mk include toolchain/gcc/gcc-uclibc-4.x.mk -include toolchain/gdb/gdb.mk include toolchain/kernel-headers/kernel-headers.mk include toolchain/uClibc/uclibc.mk
toolchain/toolchain-buildroot/Config.in.2 +7 -0
@@ -99,6 +99,13 @@ choice depends on !BR2_xtensa endchoice +config BR2_PTHREAD_DEBUG + bool "Thread library debugging" + depends on BR2_PTHREADS || BR2_PTHREADS_OLD || BR2_PTHREADS_NATIVE + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG + help + Build the thread library with debugging enabled. + source "toolchain/elf2flt/Config.in" config BR2_VFP_FLOAT
toolchain/toolchain-common.in +1 -6
@@ -3,7 +3,7 @@ # we want gdb config in the middle of both source and external # toolchains, but mconf won't let us source the same file twice, # so put it here instead -source "toolchain/gdb/Config.in" +source "package/gdb/Config.in.host" config BR2_LARGEFILE bool
@@ -27,11 +27,6 @@ config BR2_TOOLCHAIN_HAS_THREADS bool config BR2_TOOLCHAIN_HAS_THREADS_DEBUG - select BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED - bool - -config BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED - default y if !BR2_TOOLCHAIN_HAS_THREADS bool config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
toolchain/toolchain-crosstool-ng.mk +0 -1
@@ -4,6 +4,5 @@ include toolchain/helpers.mk include toolchain/elf2flt/elf2flt.mk include toolchain/gcc/gcc-uclibc-4.x.mk -include toolchain/gdb/gdb.mk include toolchain/toolchain-crosstool-ng/crosstool-ng.mk include toolchain/uClibc/uclibc.mk
toolchain/toolchain-crosstool-ng/Config.in +3 -0
@@ -121,15 +121,18 @@ choice config BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS bool "linuxthreads" select BR2_TOOLCHAIN_HAS_THREADS + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG config BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS_OLD bool "linuxthreads (stable/old)" select BR2_TOOLCHAIN_HAS_THREADS + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG depends on BR2_TOOLCHAIN_CTNG_uClibc config BR2_TOOLCHAIN_CTNG_THREADS_NPTL bool "Native POSIX Threading (NPTL)" select BR2_TOOLCHAIN_HAS_THREADS + select BR2_TOOLCHAIN_HAS_THREADS_DEBUG endchoice endif # BR2_TOOLCHAIN_CTNG
toolchain/toolchain-external.mk +0 -1
@@ -3,7 +3,6 @@ include toolchain/helpers.mk include toolchain/elf2flt/elf2flt.mk include toolchain/gcc/gcc-uclibc-4.x.mk -include toolchain/gdb/gdb.mk include toolchain/kernel-headers/kernel-headers.mk include toolchain/toolchain-external/ext-tool.mk include toolchain/uClibc/uclibc.mk
toolchain/toolchain-external/Config.in +7 -0
@@ -913,5 +913,12 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM +config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY + bool "Copy gdb server to the Target" + depends on BR2_TOOLCHAIN_EXTERNAL + help + Copy the gdbserver provided by the external toolchain to the + target. + endif # BR2_TOOLCHAIN_EXTERNAL
toolchain/uClibc/Config.in +0 -6
@@ -53,12 +53,6 @@ config BR2_UCLIBC_CONFIG See also docs/README in this package. If unsure, use the default. -config BR2_PTHREAD_DEBUG - bool "Thread library debugging" - depends on BR2_PTHREADS || BR2_PTHREADS_OLD || BR2_PTHREADS_NATIVE - help - Build the thread library with debugging enabled. - config BR2_UCLIBC_INSTALL_TEST_SUITE bool "Compile and install uClibc tests" select BR2_PACKAGE_MAKE
Signature · 1 line
1.7.9.5
PATCH v2 1/1 gdb: convert to the package infrastructure
Thomas, All,
Quoted 18 lines · On Tuesday 19 March 2013 Thomas Petazzoni wrote:
This commit converts gdb to the package infrastructure, and therefore moves it from toolchain/gdb to package/gdb.
The target package is now visible in "Package selection for the target" => "Debugging, profiling and benchmark". The main option, "gdb", forcefully selects the "gdbserver" sub-option by default. Another sub-option, "full debugger" allows to install the complete gdb on the target. When this option is enabled, then "gdbserver" is no longer forcefully selected. This ensures that at least gdbserver or the full debugger gets built/installed, so that the package is not a no-op.
The host debugger is still enabled through a configuration option in "Toolchain". It is now visible regardless of the toolchain type (it used to be hidden for External Toolchains). The configuration options relative to the host debugger are now in package/gdb/Config.in.host, similar to how we have package/binutils/Config.in.host.
Quoted 10 lines
Since gdb is now a proper package, it is no longer allowed to 'select
BR2_PTHREADS_DEBUG' to ensure thread debugging is available when needed. Instead, it now 'depends onBR2_TOOLCHAIN_HAS_THREADS_DEBUG'. This option, in turn, is select by the different toolchain backends when appropriate. The 'BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED' option is removed, since we no longer need to know when it is allowed to 'selectBR2_PTHREADS_DEBUG'. Also, the 'BR2_PTHREADS_DEBUG' option is moved to appear right below the thread implementation selection (in the case of the Buildroot toolchain backend).
There is a little inconsistency in the available choices:
Toolchain --->
[ ] Copy gdb server to the Target
is still available, even if:
Package Selection for the target --->
Debugging, profiling and benchmark --->
[*] gdb
[*] gdbserverI think it does not make sense to both copy the gdbserver from the toolchain, *and* build our own version.
Given that the cross-gdb and the gdbserver are tightly coupled one to the other, I think we should have these possibility expressed in the menuconfig:
- copy gdbserver from the external toolchain
--> this assumes that there is a cross-gdb in the toolchain
--> we should not build our own host cross-gdb
--> we should not build our gdbserver
--> we can build the full gdb (on the target)- do not copy gdbserver from the toolchain
--> we can build both our host cross-gdb and our gdbserver
--> we can build the full gdb (on the target)
--> if the user uses the cross-gdb from the external toolchain, and
it breaks, then too bad for him/her.At the very least, the external gdbserver and our own should be mutually exclusive.
Also, the host cross-gdb and the gdbserver should be compiled from the same version, otherwise you may experience breakage. Although the gdbserver protocol should be stable, experience has proven this is not always the case.
So I would suggest that, if we build the gdb (on the target) and/or the gdbserver, then the host cross-gdb version should not be selectable, and should be deduced from the version used to build the gdb (on the target).
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/1 gdb: convert to the package infrastructure
Dear Yann E. MORIN,
Quoted 4 lines · Yann E. MORIN
There is a little inconsistency in the available choices:
Toolchain --->
[ ] Copy gdb server to the Target
Quoted 8 lines
is still available, even if:
Package Selection for the target ---> Debugging, profiling and benchmark ---> [*] gdb [*] gdbserverI think it does not make sense to both copy the gdbserver from the toolchain, *and* build our own version.
Yes. I don't think it's really "inconsistent", but can certainly be improved. I was thinking of doing that sort of improvement as a second step.
Quoted 10 lines
Given that the cross-gdb and the gdbserver are tightly coupled one to the other, I think we should have these possibility expressed in the menuconfig:
- copy gdbserver from the external toolchain
--> this assumes that there is a cross-gdb in the toolchain --> we should not build our own host cross-gdb --> we should not build our gdbserver --> we can build the full gdb (on the target)
Quoted 8 lines
- do not copy gdbserver from the toolchain
--> we can build both our host cross-gdb and our gdbserver --> we can build the full gdb (on the target) --> if the user uses the cross-gdb from the external toolchain, and it breaks, then too bad for him/her.At the very least, the external gdbserver and our own should be mutually exclusive.
I generally agree with your proposal. Do you mind if I implement that as a followup patch? The current patch is already a bit large to review.
Quoted 8 lines
Also, the host cross-gdb and the gdbserver should be compiled from the same version, otherwise you may experience breakage. Although the gdbserver protocol should be stable, experience has proven this is not always the case.
So I would suggest that, if we build the gdb (on the target) and/or the gdbserver, then the host cross-gdb version should not be selectable, and should be deduced from the version used to build the gdb (on the target).
It is already the case. Look at gdb.mk:
------------------------------------------------------------------
GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))GDB_SITE = $(BR2_GNU_MIRROR)/gdb
# When no version is defined, it means that cross-gdb for the host has
# not been enabled, and we will only build gdbserver or gdb for the # target. In this case, use the latest available version # automatically. ifeq ($(GDB_VERSION),) ifeq ($(BR2_bfin),y) GDB_VERSION = 6.6a else ifeq ($(BR2_avr32),y) GDB_VERSION = 6.7.1-avr32-2.1.5 GDB_SITE = ftp://www.at91.com/pub/buildroot/ else GDB_VERSION = 7.5.1 endif endif
------------------------------------------------------------------
As the comment explains, if you have selected cross-gdb, then BR2_GDB_VERSION will be non-empty (defined in package/gdb/Config.in.host) and we will use this version to build gdbserver and the gdb on the target. If no cross-gdb has been selected, then we will use some default version (6.6a, 6.7.1 or 7.5 depending on the architecture).
Doesn't that solve the issue you're raising?
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v2 1/1 gdb: convert to the package infrastructure
Thomas, All,
Quoted 11 lines · On Wednesday 20 March 2013 Thomas Petazzoni wrote:
Quoted 10 lines · Yann E. MORIN
There is a little inconsistency in the available choices:
Toolchain --->
[ ] Copy gdb server to the Targetis still available, even if:
Package Selection for the target ---> Debugging, profiling and benchmark ---> [*] gdb [*] gdbserver
Quoted 6 lines
Quoted 2 lines
I think it does not make sense to both copy the gdbserver from the toolchain, *and* build our own version.
Yes. I don't think it's really "inconsistent", but can certainly be improved. I was thinking of doing that sort of improvement as a second step.
Yes, not really an inconsistency per-se, sorry for the bad phrasing. Yes, an incremental change is OK by me. :-)
[--SNIP--]
Quoted 5 lines
Quoted 3 lines
So I would suggest that, if we build the gdb (on the target) and/or the gdbserver, then the host cross-gdb version should not be selectable, and should be deduced from the version used to build the gdb (on the target).
It is already the case. Look at gdb.mk:
[--SNIP--]
Quoted 8 lines
As the comment explains, if you have selected cross-gdb, then
BR2_GDB_VERSIONwill be non-empty (defined in package/gdb/Config.in.host) and we will use this version to build gdbserver and the gdb on the target. If no cross-gdb has been selected, then we will use some default version (6.6a, 6.7.1 or 7.5 depending on the architecture).Doesn't that solve the issue you're raising?
As far as I can see, yes. Sorry, I really misssed that part of the .mk.
Thanks for the clarifications! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'