GDB for Noux

With this patch the 'GNU Project Debugger' (GDB) can be built for Noux.

The included run script connects GDB and GDB monitor via a cross-link
terminal and allows interactive source-level debugging of the GDB monitor
test application on Genode.

Fixes #280.
This commit is contained in:
Christian Prochaska
2012-07-12 21:25:55 +02:00
committed by Norman Feske
parent dbd1c425bf
commit 1b8fd4aa44
10 changed files with 331 additions and 37 deletions

View File

@@ -440,32 +440,12 @@ $(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2: $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading gdb...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GDB_DOWNLOAD_URL)/gdb-$(GDB_VERSION).tar.bz2 && touch $@
$(CONTRIB_DIR)/gdb-$(GDB_VERSION)/configure: $(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2
$(CONTRIB_DIR)/gdb-$(GDB_VERSION): $(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2
$(ECHO) "$(BRIGHT_COL)unpacking gdb...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(CONTRIB_DIR)
$(VERBOSE)tar xfj $^ -C $(CONTRIB_DIR) && touch $@
$(ECHO) "$(BRIGHT_COL)patching gdb...$(DEFAULT_COL)"
@#
@# Include 'solib.o' and 'solib-svr4.o' in arm*-*-* (non-OS) target configuration for shared library support
@#
$(VERBOSE)sed -i "s/gdb_target_obs=\"arm-tdep\.o\"$$/gdb_target_obs=\"arm-tdep.o solib.o solib-svr4.o\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/configure.tgt
@#
@# Add an x86_64-*-* (non-OS) target with shared library support
@#
$(VERBOSE)sed -i "/^xtensa\*-\*-linux\*/ s/^/x86_64-*-*)\n\tgdb_target_obs=\"amd64-tdep.o i386-tdep.o i387-tdep.o solib.o solib-svr4.o\"\n\t;;\n/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/configure.tgt
@#
@# Enable shared library support
@#
$(VERBOSE)sed -i "/^#include \"features\/i386\/amd64-avx\.c\"$$/ s/$$/\n\n#include \"solib-svr4\.h\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/amd64-tdep.c
$(VERBOSE)sed -i "/AMD64 generally uses/ s/^/ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_lp64_fetch_link_map_offsets);\n\n/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/amd64-tdep.c
$(VERBOSE)sed -i "/^#include \"features\/arm-with-m\.c\"$$/ s/$$/\n\n#include \"solib-svr4\.h\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/arm-tdep.c
$(VERBOSE)sed -i "/gdbarch = gdbarch_alloc (&info, tdep);/ s/$$/\n\n set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/arm-tdep.c
$(VERBOSE)sed -i "/^#include \"features\/i386\/i386-mmx\.c\"$$/ s/$$/\n\n#include \"solib-svr4\.h\"/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/i386-tdep.c
$(VERBOSE)sed -i "/gdbarch = gdbarch_alloc (&info, tdep);/ s/$$/\n\n set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/i386-tdep.c
@#
@# Enable software single-stepping on ARM
@#
$(VERBOSE)sed -i "/gdbarch = gdbarch_alloc (&info, tdep);/ s/$$/\n\n set_gdbarch_software_single_step(gdbarch, arm_software_single_step);/" $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/gdb/arm-tdep.c
include $(GENODE_DIR)/tool/tool_chain_gdb_patches.inc
build/$(PLATFORM)/gdb/Makefile: $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/configure
$(ECHO) "$(BRIGHT_COL)configuring gdb...$(DEFAULT_COL)"