21 const char *syntax, uint32_t flags)
29 const char *syntax, uint32_t flags)
39 bool all_threads =
false;
55 std::vector<lldb::tid_t> tids;
61 tids.push_back(thread_sp->GetID());
66 std::lock_guard<std::recursive_mutex> guard(
69 for (
size_t i = 0; i < num_args; i++) {
86 tids.push_back(thread->GetID());
92 std::set<UniqueStack> unique_stacks;
104 const std::vector<uint32_t> &thread_index_ids =
105 stack.GetUniqueThreadIndexIDs();
106 strm.
Format(
"{0} thread(s) ", thread_index_ids.size());
107 for (
const uint32_t &thread_index_id : thread_index_ids) {
108 strm.
Format(
"#{0} ", thread_index_id);
113 uint32_t representative_thread_id = stack.GetRepresentativeThread();
115 representative_thread_id);
135 lldb::tid_t tid, std::set<UniqueStack> &unique_stacks,
140 if (thread ==
nullptr) {
146 std::stack<lldb::addr_t> stack_frames;
147 const uint32_t frame_count = thread->GetStackFrameCount();
148 for (uint32_t frame_index = 0; frame_index < frame_count; frame_index++) {
150 thread->GetStackFrameAtIndex(frame_index);
152 stack_frames.push(
pc);
155 uint32_t thread_index_id = thread->GetIndexID();
156 UniqueStack new_unique_stack(stack_frames, thread_index_id);
159 std::set<UniqueStack>::iterator matching_stack =
160 unique_stacks.find(new_unique_stack);
161 if (matching_stack != unique_stacks.end()) {
162 matching_stack->AddThread(thread_index_id);
164 unique_stacks.insert(new_unique_stack);
173 std::vector<lldb::tid_t> tids;
176 std::lock_guard<std::recursive_mutex> guard(
181 tids.push_back(thread_sp->GetID());
185 tids.push_back(thread.GetID());
188 for (
size_t i = 0; i < num_args; i++) {
204 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)
CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help=nullptr, const char *syntax=nullptr, uint32_t flags=0)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
ExecutionContext m_exe_ctx
void AppendMessage(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
void AppendErrorWithFormatv(const char *format, Args &&...args)
Stream & GetOutputStream()
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)
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