-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[lldb] Add support for unique target ids #160736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
c155381
50e56ec
87c9418
dfe2644
a363167
2beeaab
c9b766e
2b9de97
ac1fe66
7f7f763
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -256,6 +256,8 @@ Status TargetList::CreateTargetInternal(Debugger &debugger, | |
| Status error; | ||
| const bool is_dummy_target = false; | ||
|
|
||
| static uint32_t g_target_unique_id = 0; | ||
|
|
||
| ArchSpec arch(specified_arch); | ||
|
|
||
| if (arch.IsValid()) { | ||
|
|
@@ -344,6 +346,8 @@ Status TargetList::CreateTargetInternal(Debugger &debugger, | |
| if (!target_sp) | ||
| return error; | ||
|
|
||
| target_sp->m_target_unique_id = ++g_target_unique_id; | ||
|
||
|
|
||
| // Set argv0 with what the user typed, unless the user specified a | ||
| // directory. If the user specified a directory, then it is probably a | ||
| // bundle that was resolved and we need to use the resolved bundle path | ||
|
|
@@ -428,6 +432,18 @@ TargetSP TargetList::FindTargetWithProcess(Process *process) const { | |
| return target_sp; | ||
| } | ||
|
|
||
| TargetSP TargetList::FindTargetWithUniqueID(uint32_t id) const { | ||
| std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); | ||
| auto it = llvm::find_if(m_target_list, [id](const TargetSP &item) { | ||
| return item->GetUniqueID() == id; | ||
| }); | ||
|
|
||
| if (it != m_target_list.end()) | ||
| return *it; | ||
|
|
||
| return TargetSP(); | ||
| } | ||
|
|
||
| TargetSP TargetList::GetTargetSP(Target *target) const { | ||
| TargetSP target_sp; | ||
| if (!target) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.