mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
Config option for GDB monitor RAM preservation
This patch allows to configure the amount of RAM that GDB monitor should preserve for itself. The configuration syntax looks as follows: <start name="gdb_monitor"> <resource name="RAM" quantum="1G"/> <config> <target name="noux"> <preserve name="RAM" quantum="2M"/> ... </config> </start> Fixes #190.
This commit is contained in:
parent
3236395e6a
commit
93faa9a36f
@ -63,7 +63,10 @@ set config {
|
||||
<start name="gdb_monitor">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<provides><service name="Nitpicker"/></provides>
|
||||
<config><target name="nitpicker"/></config>
|
||||
<config>
|
||||
<target name="nitpicker"/>
|
||||
<preserve name="RAM" quantum="2M"/>
|
||||
</config>
|
||||
</start>
|
||||
<start name="scout">
|
||||
<resource name="RAM" quantum="32M"/>
|
||||
|
@ -59,7 +59,10 @@ set config {
|
||||
</start>
|
||||
<start name="gdb_monitor">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config> <target name="test-gdb_monitor" /> </config>
|
||||
<config>
|
||||
<target name="test-gdb_monitor"/>
|
||||
<preserve name="RAM" quantum="2M"/>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -53,7 +53,10 @@ set config {
|
||||
</start>
|
||||
<start name="gdb_monitor">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<config> <target name="test-gdb_monitor" /> </config>
|
||||
<config>
|
||||
<target name="test-gdb_monitor"/>
|
||||
<preserve name="RAM" quantum="2M"/>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ set config {
|
||||
<test_config_subnode/>
|
||||
</config>
|
||||
</target>
|
||||
<preserve name="RAM" quantum="2M"/>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
|
@ -65,8 +65,23 @@ int main()
|
||||
/* 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 */
|
||||
Number_of_bytes ram_quota = env()->ram_session()->avail() - 2*1024*1024;
|
||||
/*
|
||||
* preserve the configured amount of memory for gdb_monitor and give the
|
||||
* remainder to the child
|
||||
*/
|
||||
Number_of_bytes preserved_ram_quota = 0;
|
||||
try {
|
||||
Xml_node preserve_node = config()->xml_node().sub_node("preserve");
|
||||
if (preserve_node.attribute("name").has_value("RAM"))
|
||||
preserve_node.attribute("quantum").value(&preserved_ram_quota);
|
||||
else
|
||||
throw Xml_node::Exception();
|
||||
} catch (...) {
|
||||
PERR("Error: could not find a valid <preserve> config node");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Number_of_bytes ram_quota = env()->ram_session()->avail() - preserved_ram_quota;
|
||||
|
||||
/* start the application */
|
||||
char *unique_name = filename;
|
||||
|
Loading…
x
Reference in New Issue
Block a user