From 698f6eb86c944601816940f1e54ddd5759ca8b3b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sat, 3 Apr 2021 14:33:12 +0200 Subject: [PATCH] gdb_monitor: weaken reliance on sandbox internals GDB monitor re-uses internal parts of the sandbox library. It thereby relies on the internal detail of how local headers are included (using "" instead of the now usual practice <>). A seemingly unrelated change "init/sandbox: avoid repetitive state reports" eventually broke the build of the GDB monitor. This patch makes the GDB monitor less reliant on the way of how the sandbox includes headers internally. It also fixes a few warnings caused by the double definition of __GENODE__ (adding an missing include guard and making the #define conditional). Related to issue #4064 --- .../src/app/gdb_monitor/gdbserver/config.h | 7 +++++++ repos/ports/src/app/gdb_monitor/target.mk | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/repos/ports/src/app/gdb_monitor/gdbserver/config.h b/repos/ports/src/app/gdb_monitor/gdbserver/config.h index 215218d303..404ed7a45f 100644 --- a/repos/ports/src/app/gdb_monitor/gdbserver/config.h +++ b/repos/ports/src/app/gdb_monitor/gdbserver/config.h @@ -11,6 +11,9 @@ * under the terms of the GNU Affero General Public License version 3. */ +#ifndef _GDBSERVER_CONFIG_H_ +#define _GDBSERVER_CONFIG_H_ + #define HAVE_ARPA_INET_H 1 #define HAVE_ERRNO_H 1 #define HAVE_FCNTL_H 1 @@ -25,7 +28,11 @@ #define HAVE_LINUX_REGSETS 1 #define HAVE_LINUX_USRREGS 1 +#ifndef __GENODE__ #define __GENODE__ +#endif /* first process id */ #define GENODE_MAIN_LWPID 1 + +#endif /* _GDBSERVER_CONFIG_H_ */ diff --git a/repos/ports/src/app/gdb_monitor/target.mk b/repos/ports/src/app/gdb_monitor/target.mk index 11f64c356e..198314d971 100644 --- a/repos/ports/src/app/gdb_monitor/target.mk +++ b/repos/ports/src/app/gdb_monitor/target.mk @@ -90,19 +90,29 @@ vpath %.cc $(GDB_CONTRIB_DIR)/gdb vpath %.cc $(PRG_DIR)/gdbserver # -# Files from init +# Files from sandbox library # # Because the 'server.h' file exists both in gdb and in init and both gdb's # 'server.c' and init's 'server.cc' are compiled to a 'server.o' file, the # parent directory of the init source is used as reference. # -SANDBOX_PARENT_DIR = $(abspath $(dir $(call select_from_repositories,src/lib/sandbox/server.cc))/..) - -INC_DIR += $(SANDBOX_PARENT_DIR) +SANDBOX_SRC_DIR = $(call select_from_repositories,src/lib/sandbox) +SANDBOX_PARENT_DIR = $(abspath $(addsuffix /..,$(SANDBOX_SRC_DIR))) SRC_CC += sandbox/server.cc +# needed to compile gdbserver/genode-low.cc +INC_DIR += $(SANDBOX_PARENT_DIR) + vpath sandbox/%.cc $(SANDBOX_PARENT_DIR) +# import selected headers needed from sandbox library +SANDBOX_HEADERS = types.h verbose.h report.h name_registry.h service.h utils.h + +genode-low.o sandbox/server.o: $(SANDBOX_HEADERS) + +%.h: $(SANDBOX_SRC_DIR)/%.h + ln -sf $< $@ + CC_CXX_WARN_STRICT =