Create more useful instance names for target, process and thread instances.
Change default 'set' behavior so that all instance settings for the specified variable will be
updated, unless the "-n" ("--no_override") command options is specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114808 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index f81d9e5..bbc41be 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -425,6 +425,8 @@
m_scratch_ast_context_ap.reset (new ClangASTContext(target_triple.GetCString()));
}
}
+
+ UpdateInstanceName();
}
@@ -792,6 +794,21 @@
lldb::eVarSetOperationAssign, false, "[]");
}
+void
+Target::UpdateInstanceName ()
+{
+ StreamString sstr;
+
+ ModuleSP module_sp = GetExecutableModule();
+ if (module_sp)
+ {
+ sstr.Printf ("%s_%s", module_sp->GetFileSpec().GetFilename().AsCString(),
+ module_sp->GetArchitecture().AsCString());
+ Target::GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
+ sstr.GetData());
+ }
+}
+
//--------------------------------------------------------------
// class Target::SettingsController
//--------------------------------------------------------------
@@ -948,9 +965,9 @@
const ConstString
TargetInstanceSettings::CreateInstanceName ()
{
- static int instance_count = 1;
StreamString sstr;
-
+ static int instance_count = 1;
+
sstr.Printf ("target_%d", instance_count);
++instance_count;