summaryrefslogtreecommitdiff
path: root/lldb/source/Target/Target.cpp
diff options
context:
space:
mode:
authorVy Nguyen <vyng@google.com>2025-03-20 18:05:06 -0400
committerGitHub <noreply@github.com>2025-03-20 18:05:06 -0400
commitff21b50509c88606a8220002865c3e42e825a3b3 (patch)
treec25ddc1efc96de249187b9fec41717b2bcf4c28f /lldb/source/Target/Target.cpp
parente86d627a8b0278556d18e73b9823761ca8fe24a5 (diff)
Reapply LLDB-Telemetry TargetInfo branch (pr/127834) (#132043)
New changes: add check to avoid accessing invalid obj
Diffstat (limited to 'lldb/source/Target/Target.cpp')
-rw-r--r--lldb/source/Target/Target.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index bbc2110dada5..c26bca546891 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -24,6 +24,7 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/StructuredDataImpl.h"
+#include "lldb/Core/Telemetry.h"
#include "lldb/DataFormatters/FormatterSection.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/ExpressionVariable.h"
@@ -1559,10 +1560,30 @@ void Target::DidExec() {
void Target::SetExecutableModule(ModuleSP &executable_sp,
LoadDependentFiles load_dependent_files) {
+ telemetry::ScopedDispatcher<telemetry::ExecutableModuleInfo> helper(
+ &m_debugger);
Log *log = GetLog(LLDBLog::Target);
ClearModules(false);
if (executable_sp) {
+ lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
+ if (ProcessSP proc = GetProcessSP())
+ pid = proc->GetID();
+
+ helper.DispatchNow([&](telemetry::ExecutableModuleInfo *info) {
+ info->exec_mod = executable_sp;
+ info->uuid = executable_sp->GetUUID();
+ info->pid = pid;
+ info->triple = executable_sp->GetArchitecture().GetTriple().getTriple();
+ info->is_start_entry = true;
+ });
+
+ helper.DispatchOnExit([&](telemetry::ExecutableModuleInfo *info) {
+ info->exec_mod = executable_sp;
+ info->uuid = executable_sp->GetUUID();
+ info->pid = pid;
+ });
+
ElapsedTime elapsed(m_stats.GetCreateTime());
LLDB_SCOPED_TIMERF("Target::SetExecutableModule (executable = '%s')",
executable_sp->GetFileSpec().GetPath().c_str());