gdb_monitor: Support session upgrades

This patch enables the debugging on services that rely on dynamic
session upgrades. For example, nitpicker expects its clients to donate
RAM quota that matches the size of the virtual framebuffer, which might
change during the lifetime of a nitpicker session.
This commit is contained in:
Norman Feske 2014-07-21 15:23:02 +02:00
parent 37248560d1
commit 6820de51ba

View File

@ -196,9 +196,28 @@ namespace Gdb_monitor {
return cap;
}
void upgrade(Session_capability, Upgrade_args const &)
void upgrade(Session_capability session_cap,
Upgrade_args const &args)
{
PDBG("not yet implemented");
using namespace Genode;
Child_session *session = _sessions.lookup_and_lock(session_cap);
if (!session) {
PERR("attempt to upgrade unknown session");
return;
}
Genode::size_t ram_quota =
Arg_string::find_arg(args.string(),
"ram_quota").long_value(0);
/* forward session quota to child */
env()->ram_session()->transfer_quota(_child_ram, ram_quota);
session->ram_quota += ram_quota;
/* inform child about quota upgrade */
_child_root.upgrade(session_cap, args);
}
void close(Session_capability session_cap)