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
This commit is contained in:
Norman Feske 2021-04-03 14:33:12 +02:00
parent 73e8d64c34
commit 698f6eb86c
2 changed files with 21 additions and 4 deletions

View File

@ -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_ */

View File

@ -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 =