21 const char *syntax, uint32_t flags)
29 const char *syntax, uint32_t flags)
39 bool all_threads =
false;
53 std::vector<lldb::tid_t> tids;
59 tids.push_back(thread_sp->GetID());
64 std::lock_guard<std::recursive_mutex> guard(
67 for (
size_t i = 0; i < num_args; i++) {
84 tids.push_back(thread->GetID());
90 std::set<UniqueStack> unique_stacks;
102 const std::vector<uint32_t> &thread_index_ids =
103 stack.GetUniqueThreadIndexIDs();
104 strm.
Format(
"{0} thread(s) ", thread_index_ids.size());
105 for (
const uint32_t &thread_index_id : thread_index_ids) {
106 strm.
Format(
"#{0} ", thread_index_id);
111 uint32_t representative_thread_id = stack.GetRepresentativeThread();
113 representative_thread_id);
133 lldb::tid_t tid, std::set<UniqueStack> &unique_stacks,
138 if (thread ==
nullptr) {
144 std::stack<lldb::addr_t> stack_frames;
146 for (uint32_t frame_index = 0; frame_index < frame_count; frame_index++) {
150 stack_frames.push(
pc);
153 uint32_t thread_index_id = thread->
GetIndexID();
154 UniqueStack new_unique_stack(stack_frames, thread_index_id);
157 std::set<UniqueStack>::iterator matching_stack =
158 unique_stacks.find(new_unique_stack);
159 if (matching_stack != unique_stacks.end()) {
160 matching_stack->AddThread(thread_index_id);
162 unique_stacks.insert(new_unique_stack);
171 std::vector<lldb::tid_t> tids;
174 std::lock_guard<std::recursive_mutex> guard(
179 tids.push_back(thread_sp->GetID());
183 tids.push_back(thread.
GetID());
186 for (
size_t i = 0; i < num_args; i++) {
202 tids.push_back(thread->GetID());
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
lldb::ReturnStatus m_success_return
bool BucketThread(lldb::tid_t tid, std::set< UniqueStack > &unique_stacks, CommandReturnObject &result)
CommandObjectIterateOverThreads(CommandInterpreter &interpreter, const char *name, const char *help, const char *syntax, uint32_t flags)
virtual bool HandleOneThread(lldb::tid_t, CommandReturnObject &result)=0
void DoExecute(Args &command, CommandReturnObject &result) override
virtual bool DoExecuteOnThreads(Args &command, CommandReturnObject &result, llvm::ArrayRef< lldb::tid_t > tids)=0
Method that handles the command after the main arguments have been parsed.
void DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectMultipleThreads(CommandInterpreter &interpreter, const char *name, const char *help, const char *syntax, uint32_t flags)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
ExecutionContext m_exe_ctx
void AppendErrorWithFormatv(const char *format, Args &&... args)
void AppendMessage(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
Stream & GetOutputStream()
Process & GetProcessRef() const
Returns a reference to the process object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
Thread & GetThreadRef() const
Returns a reference to the thread object.
Thread * GetThreadPtr() const
Returns a pointer to the thread object.
A plug-in interface definition class for debugging a process.
ThreadList & GetThreadList()
ThreadList::ThreadIterable Threads()
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
size_t EOL()
Output and End of Line character to the stream.
lldb::ThreadSP FindThreadByIndexID(uint32_t index_id, bool can_update=true)
std::recursive_mutex & GetMutex() const override
lldb::ThreadSP FindThreadByID(lldb::tid_t tid, bool can_update=true)
virtual lldb::StackFrameSP GetStackFrameAtIndex(uint32_t idx)
uint32_t GetIndexID() const
virtual uint32_t GetStackFrameCount()
GetStackFrameCount can be expensive.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
lldb::user_id_t GetID() const
Get accessor for the user ID.