[Lldb-commits] [lldb] [LLDB][Telemetry]Define TargetInfo for collecting data about a target (PR #127834)

Vy Nguyen via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 12 08:03:16 PDT 2025


oontvoo wrote:

> Define "target". 

"target" == the thing to be debugged. Eg.., `lldb <target>` or (after starting lldb, you'd do `target create <target>`).

> Define "loading a target". When a process does an execve is it still the same target (as far as the rest of lldb is concerned, it is, even though it starts executing a different binary)?

I think by "loading" i mean the time it takes from "target create" command till when lldb command prompt is ready to accept the next command. (Admitted, in this implementation, it's not quite measuring that since that's a bit more tricky to instrument, so I settled to the closest thing, which was around initting the main executable).

Can you clarify your definition of "target" ? :) You're saying a "target" could have *different* main-executable ("different binary")?? How would that use case look? 

I understand you could do something like
```
~/home/ $ lldb  # << start LLDB w/o specifying a debug target
< ... inside lldb prompt >
0: (lldb) target create path/to/MyTarget
1:  (lldb) run  
<.... finish>
2: (lldb) run
< ... finish >
3: (lldb) run
```

Same target, 3 different "runs" but still the same *binary*.
In other words, we would have had 1 target,  3 (different) processes (ie., different PIDs), 3 exit statuses (one for each of those processes).

Is this the right characterisation?
 
So maybe the data can be restructured to:
```
TargetInfo {
  + target_id;
  + target_name; /// (ie., the <path/to/MyTarget> argument)
  + (other related stuff like platform, arch, etc)

  + init_time_duration: Ideally, measuring the time it takes from "target create" till ready. (or just initting the main exec)
  // The following two is less important, but could be interesting
  + start_timestamp: When the target was first created
  + exit_timestamp: when the target is deleted 
}

ProcessInfo {
   + target_id; /// The ID of the Target object that this process belongs to
   + exit_status
}
 
```



https://github.com/llvm/llvm-project/pull/127834


More information about the lldb-commits mailing list