gdb: enable simulator support for host build
authorWaldemar Brodkorb <wbx@openadk.org>
Tue, 31 May 2016 21:01:36 +0000 (23:01 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 31 May 2016 21:14:00 +0000 (23:14 +0200)
Add an option to enable GDB simulator support, so
it can be used to test some no-MMU systems.

Newer GDB Blackfin Simulator need a workaround for in-tree compile.
It doesn't break for older Buildroot supported GDB Blackfin
Simulator.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/gdb/Config.in.host
package/gdb/gdb.mk

index 257d68ac9bfb824eafcc4ed435dd023e7654c18d..dc149b636d3fc2fd24d490cb21652eee76670fba 100644 (file)
@@ -23,6 +23,11 @@ config BR2_PACKAGE_HOST_GDB_PYTHON
        help
          This option enables the Python support in the cross gdb.
 
+config BR2_PACKAGE_HOST_GDB_SIM
+       bool "Simulator support"
+       help
+         This option enables the simulator support in the cross gdb.
+
 choice
        prompt "GDB debugger Version"
        depends on !BR2_arc
index 0a7af1ef61c6062f4c8268b16bf10de28086423a..84f2029e97eca37ef94ae66663c72a8fcecd75b5 100644 (file)
@@ -163,8 +163,7 @@ HOST_GDB_CONF_OPTS = \
        --enable-threads \
        --disable-werror \
        --without-included-gettext \
-       $(GDB_DISABLE_BINUTILS_CONF_OPTS) \
-       --disable-sim
+       $(GDB_DISABLE_BINUTILS_CONF_OPTS)
 
 ifeq ($(BR2_PACKAGE_HOST_GDB_TUI),y)
 HOST_GDB_CONF_OPTS += --enable-tui
@@ -179,6 +178,20 @@ else
 HOST_GDB_CONF_OPTS += --without-python
 endif
 
+# workaround a bug if in-tree build is used for bfin sim
+define HOST_GDB_BFIN_SIM_WORKAROUND
+       $(RM) $(@D)/sim/common/tconfig.h
+endef
+
+ifeq ($(BR2_PACKAGE_HOST_GDB_SIM),y)
+HOST_GDB_CONF_OPTS += --enable-sim
+ifeq ($(BR2_bfin),y)
+HOST_GDB_PRE_CONFIGURE_HOOKS += HOST_GDB_BFIN_SIM_WORKAROUND
+endif
+else
+HOST_GDB_CONF_OPTS += --disable-sim
+endif
+
 # legacy $arch-linux-gdb symlink
 define HOST_GDB_ADD_SYMLINK
        cd $(HOST_DIR)/usr/bin && \