sim: Remove trailing dot when assigning a master's name

This patch fixes the master's name allocation in the system. The error
was occurring when a submaster was not specified in getMasterId: a
trailing separation dot was still added to the master's name.

Change-Id: I0e67900f6fdd36a61900453b55219fc7007d1b05
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/10301
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Giacomo Travaglini
2018-05-03 00:14:42 +01:00
parent b7bf68e287
commit e89e83529a

View File

@@ -538,10 +538,13 @@ System::_getMasterId(const SimObject* master, std::string master_name)
std::string
System::leafMasterName(const SimObject* master, const std::string& submaster)
{
// Get the full master name by appending the submaster name to
// the root SimObject master name
auto master_name = master->name() + "." + submaster;
return master_name;
if (submaster.empty()) {
return master->name();
} else {
// Get the full master name by appending the submaster name to
// the root SimObject master name
return master->name() + "." + submaster;
}
}
std::string