From e89e83529ad17bc1ae7ae23d337fd4067db01708 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Thu, 3 May 2018 00:14:42 +0100 Subject: [PATCH] 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 Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/10301 Reviewed-by: Nikos Nikoleris Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/sim/system.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sim/system.cc b/src/sim/system.cc index 911ee5d9b..74bc94ee8 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -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 -- 2.30.2