mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 18:06:50 +00:00
Pass config to child of GDB monitor
With this patch GDB monitor provides a 'config' file to the target. Its content can be defined in the <config> sub node of the <target> XML node. Fixes #179.
This commit is contained in:
parent
ff3e08f9ea
commit
674e898af3
@ -20,6 +20,7 @@
|
|||||||
#include <base/child.h>
|
#include <base/child.h>
|
||||||
#include <base/service.h>
|
#include <base/service.h>
|
||||||
|
|
||||||
|
#include <init/child_config.h>
|
||||||
#include <init/child_policy.h>
|
#include <init/child_policy.h>
|
||||||
|
|
||||||
#include <util/arg_string.h>
|
#include <util/arg_string.h>
|
||||||
@ -46,7 +47,10 @@ namespace Gdb_monitor {
|
|||||||
Service_registry *_parent_services;
|
Service_registry *_parent_services;
|
||||||
Service_registry _local_services;
|
Service_registry _local_services;
|
||||||
|
|
||||||
|
Init::Child_config _child_config;
|
||||||
|
|
||||||
Init::Child_policy_provide_rom_file _binary_policy;
|
Init::Child_policy_provide_rom_file _binary_policy;
|
||||||
|
Init::Child_policy_provide_rom_file _config_policy;
|
||||||
|
|
||||||
Gdb_stub_thread _gdb_stub_thread;
|
Gdb_stub_thread _gdb_stub_thread;
|
||||||
Object_pool<Dataspace_object> _managed_ds_map;
|
Object_pool<Dataspace_object> _managed_ds_map;
|
||||||
@ -234,12 +238,15 @@ namespace Gdb_monitor {
|
|||||||
Genode::Ram_session_capability ram_session,
|
Genode::Ram_session_capability ram_session,
|
||||||
Genode::Cap_session *cap_session,
|
Genode::Cap_session *cap_session,
|
||||||
Service_registry *parent_services,
|
Service_registry *parent_services,
|
||||||
Genode::Rpc_entrypoint *root_ep)
|
Genode::Rpc_entrypoint *root_ep,
|
||||||
|
Xml_node target_node)
|
||||||
: Init::Child_policy_enforce_labeling(unique_name),
|
: Init::Child_policy_enforce_labeling(unique_name),
|
||||||
_unique_name(unique_name),
|
_unique_name(unique_name),
|
||||||
_entrypoint(cap_session, STACK_SIZE, "GDB monitor entrypoint name"),
|
_entrypoint(cap_session, STACK_SIZE, "GDB monitor entrypoint name"),
|
||||||
_parent_services(parent_services),
|
_parent_services(parent_services),
|
||||||
|
_child_config(ram_session, target_node),
|
||||||
_binary_policy("binary", elf_ds, &_entrypoint),
|
_binary_policy("binary", elf_ds, &_entrypoint),
|
||||||
|
_config_policy("config", _child_config.dataspace(), &_entrypoint),
|
||||||
_gdb_stub_thread(),
|
_gdb_stub_thread(),
|
||||||
_rm_root(&_entrypoint, env()->heap() /* should be _child.heap() */, &_managed_ds_map, &_gdb_stub_thread),
|
_rm_root(&_entrypoint, env()->heap() /* should be _child.heap() */, &_managed_ds_map, &_gdb_stub_thread),
|
||||||
_rm_session_cap(_get_rm_session_cap()),
|
_rm_session_cap(_get_rm_session_cap()),
|
||||||
@ -281,6 +288,10 @@ namespace Gdb_monitor {
|
|||||||
if ((service = _binary_policy.resolve_session_request(service_name, args)))
|
if ((service = _binary_policy.resolve_session_request(service_name, args)))
|
||||||
return service;
|
return service;
|
||||||
|
|
||||||
|
/* check for config file request */
|
||||||
|
if ((service = _config_policy.resolve_session_request(service_name, args)))
|
||||||
|
return service;
|
||||||
|
|
||||||
service = _local_services.find(service_name);
|
service = _local_services.find(service_name);
|
||||||
if (service)
|
if (service)
|
||||||
return service;
|
return service;
|
||||||
|
@ -62,6 +62,9 @@ int main()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* extract target node from config file */
|
||||||
|
Xml_node target_node = config()->xml_node().sub_node("target");
|
||||||
|
|
||||||
/* reserve some memory for gdb_monitor and give the rest to the child */
|
/* reserve some memory for gdb_monitor and give the rest to the child */
|
||||||
Number_of_bytes ram_quota = env()->ram_session()->avail() - 2*1024*1024;
|
Number_of_bytes ram_quota = env()->ram_session()->avail() - 2*1024*1024;
|
||||||
|
|
||||||
@ -99,7 +102,8 @@ int main()
|
|||||||
ram.cap(),
|
ram.cap(),
|
||||||
&cap_session,
|
&cap_session,
|
||||||
&parent_services,
|
&parent_services,
|
||||||
&child_root_ep);
|
&child_root_ep,
|
||||||
|
target_node);
|
||||||
sleep_forever();
|
sleep_forever();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user