41 bool all_threads =
false;
55 std::vector<lldb::tid_t> tids;
60 for (ThreadSP thread_sp : process->
Threads())
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);
136 lldb::tid_t tid, std::set<UniqueStack> &unique_stacks,
141 if (thread ==
nullptr) {
147 std::stack<lldb::addr_t> stack_frames;
149 for (
uint32_t frame_index = 0; frame_index < frame_count; frame_index++) {
150 const lldb::StackFrameSP frame_sp =
153 stack_frames.push(
pc);
157 UniqueStack new_unique_stack(stack_frames, thread_index_id);
160 std::set<UniqueStack>::iterator matching_stack =
161 unique_stacks.find(new_unique_stack);
162 if (matching_stack != unique_stacks.end()) {
163 matching_stack->AddThread(thread_index_id);
165 unique_stacks.insert(new_unique_stack);
174 std::vector<lldb::tid_t> tids;
177 std::lock_guard<std::recursive_mutex> guard(
181 for (ThreadSP thread_sp : process.
Threads())
182 tids.push_back(thread_sp->GetID());
186 tids.push_back(thread.
GetID());
189 for (
size_t i = 0; i < num_args; i++) {
205 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.
bool DoExecute(Args &command, CommandReturnObject &result) override
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
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.
bool DoExecute(Args &command, CommandReturnObject &result) override
CommandObjectMultipleThreads(CommandInterpreter &interpreter, const char *name, const char *help, const char *syntax, uint32_t flags)
ExecutionContext m_exe_ctx
std::vector< CommandArgumentEntry > m_arguments
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()
A class that represents a running process on the host machine.
Used to build individual command argument lists.
lldb::user_id_t GetID() const
Get accessor for the user ID.