2014-05-16 18:51:01 +08:00
|
|
|
//===-- MICmdCmdThread.h ----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-05-16 18:51:01 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Overview: CMICmdCmdThreadInfo interface.
|
2014-05-16 18:51:01 +08:00
|
|
|
//
|
2016-09-07 04:57:50 +08:00
|
|
|
// To implement new MI commands derive a new command class from the
|
|
|
|
// command base
|
|
|
|
// class. To enable the new command for interpretation add the new
|
|
|
|
// command class
|
2014-11-18 02:06:21 +08:00
|
|
|
// to the command factory. The files of relevance are:
|
|
|
|
// MICmdCommands.cpp
|
|
|
|
// MICmdBase.h / .cpp
|
|
|
|
// MICmdCmd.h / .cpp
|
2016-09-07 04:57:50 +08:00
|
|
|
// For an introduction to adding a new command see
|
|
|
|
// CMICmdCmdSupportInfoMiCmdQuery
|
2014-11-18 02:06:21 +08:00
|
|
|
// command class as an example.
|
2014-05-16 18:51:01 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// In-house headers:
|
|
|
|
#include "MICmdBase.h"
|
|
|
|
#include "MICmnMIValueList.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "MICmnMIValueTuple.h"
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++
|
|
|
|
//============================================================================
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: MI command class. MI commands derived from the command base class.
|
|
|
|
// *this class implements MI command "thread-info".
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2016-09-07 04:57:50 +08:00
|
|
|
class CMICmdCmdThreadInfo : public CMICmdBase {
|
|
|
|
// Statics:
|
|
|
|
public:
|
|
|
|
// Required by the CMICmdFactory when registering *this command
|
|
|
|
static CMICmdBase *CreateSelf();
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Methods:
|
|
|
|
public:
|
|
|
|
/* ctor */ CMICmdCmdThreadInfo();
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Overridden:
|
|
|
|
public:
|
|
|
|
// From CMICmdInvoker::ICmd
|
|
|
|
bool Execute() override;
|
|
|
|
bool Acknowledge() override;
|
|
|
|
bool ParseArgs() override;
|
|
|
|
// From CMICmnBase
|
|
|
|
/* dtor */ ~CMICmdCmdThreadInfo() override;
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Typedefs:
|
|
|
|
private:
|
|
|
|
typedef std::vector<CMICmnMIValueTuple> VecMIValueTuple_t;
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Attributes:
|
|
|
|
private:
|
|
|
|
CMICmnMIValueTuple m_miValueTupleThread;
|
|
|
|
bool m_bSingleThread; // True = yes single thread, false = multiple threads
|
|
|
|
bool m_bThreadInvalid; // True = invalid, false = ok
|
|
|
|
VecMIValueTuple_t m_vecMIValueTuple;
|
|
|
|
const CMIUtilString m_constStrArgNamedThreadId;
|
-thread-info in lldbmi does not conform to protocol. Should end with current thread id
-thread-info in lldbmi does not conform to protocol. Should end with
current thread id as described here:
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Thread-Commands.html#GDB_002fMI-Thread-Commands
When printing all threads, the current thread id should be printed
afterwards.
Example:
-thread-info
^done,threads=[
{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)",
frame={level="0",addr="0xffffe410",func="__kernel_vsyscall",
args=[]},state="running"},
{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
frame={level="0",addr="0x0804891f",func="foo",
args=[{name="i",value="10"}],
file="/tmp/a.c",fullname="/tmp/a.c",line="158"},
state="running"}],
current-thread-id="1"
(gdb)
Patch from jacdavis@microsoft.com
Reviewers: zturner, chuckr
Differential Revision: http://reviews.llvm.org/differential/revision/edit/18880/
llvm-svn: 265858
2016-04-09 06:17:53 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// mi value of current-thread-id if multiple threads are requested
|
|
|
|
bool m_bHasCurrentThread;
|
|
|
|
CMICmnMIValue m_miValueCurrThreadId;
|
2014-05-16 18:51:01 +08:00
|
|
|
};
|