2014-05-16 18:51:01 +08:00
|
|
|
//===-- MICmnLLDBDebugSessionInfo.h -----------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Third party headers:
|
2015-01-20 08:04:26 +08:00
|
|
|
#include "lldb/API/SBDebugger.h"
|
|
|
|
#include "lldb/API/SBListener.h"
|
|
|
|
#include "lldb/API/SBProcess.h"
|
|
|
|
#include "lldb/API/SBTarget.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
2014-05-16 18:51:01 +08:00
|
|
|
|
|
|
|
// In-house headers:
|
|
|
|
#include "MICmnBase.h"
|
|
|
|
#include "MICmnLLDBDebugSessionInfoVarObj.h"
|
|
|
|
#include "MICmnMIValueTuple.h"
|
2014-06-25 00:35:50 +08:00
|
|
|
#include "MIUtilMapIdToVariant.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "MIUtilSingletonBase.h"
|
2015-02-04 17:59:23 +08:00
|
|
|
#include "MIUtilThreadBaseStd.h"
|
2014-05-16 18:51:01 +08:00
|
|
|
|
|
|
|
// Declarations:
|
|
|
|
class CMICmnLLDBDebugger;
|
|
|
|
struct SMICmdData;
|
|
|
|
class CMICmnMIValueTuple;
|
|
|
|
class CMICmnMIValueList;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++
|
|
|
|
//============================================================================
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: MI debug session object that holds debugging information between
|
|
|
|
// instances of MI commands executing their work and producing MI
|
|
|
|
// result records. Information/data is set by one or many commands then
|
2015-07-07 22:04:40 +08:00
|
|
|
// retrieved by the same or other subsequent commands.
|
|
|
|
// It primarily holds LLDB type objects.
|
2014-11-18 02:06:21 +08:00
|
|
|
// A singleton class.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2016-09-07 04:57:50 +08:00
|
|
|
class CMICmnLLDBDebugSessionInfo
|
|
|
|
: public CMICmnBase,
|
|
|
|
public MI::ISingleton<CMICmnLLDBDebugSessionInfo> {
|
|
|
|
friend class MI::ISingleton<CMICmnLLDBDebugSessionInfo>;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Structs:
|
|
|
|
public:
|
|
|
|
//++
|
|
|
|
//============================================================================
|
|
|
|
// Details: Break point information object. Used to easily pass information
|
|
|
|
// about
|
|
|
|
// a break around and record break point information to be recalled
|
|
|
|
// by
|
|
|
|
// other commands or LLDB event handling functions.
|
|
|
|
//--
|
|
|
|
struct SBrkPtInfo {
|
|
|
|
SBrkPtInfo()
|
|
|
|
: m_id(0), m_bDisp(false), m_bEnabled(false), m_pc(0), m_nLine(0),
|
|
|
|
m_bHaveArgOptionThreadGrp(false), m_nTimes(0), m_bPending(false),
|
|
|
|
m_nIgnore(0), m_bCondition(false), m_bBrkPtThreadId(false),
|
|
|
|
m_nBrkPtThreadId(0) {}
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
MIuint m_id; // LLDB break point ID.
|
|
|
|
CMIUtilString m_strType; // Break point type.
|
|
|
|
bool m_bDisp; // True = "del", false = "keep".
|
|
|
|
bool m_bEnabled; // True = enabled, false = disabled break point.
|
|
|
|
lldb::addr_t m_pc; // Address number.
|
|
|
|
CMIUtilString m_fnName; // Function name.
|
|
|
|
CMIUtilString m_fileName; // File name text.
|
|
|
|
CMIUtilString m_path; // Full file name and path text.
|
|
|
|
MIuint m_nLine; // File line number.
|
|
|
|
bool m_bHaveArgOptionThreadGrp; // True = include MI field, false = do not
|
|
|
|
// include "thread-groups".
|
|
|
|
CMIUtilString m_strOptThrdGrp; // Thread group number.
|
|
|
|
MIuint m_nTimes; // The count of the breakpoint existence.
|
|
|
|
CMIUtilString m_strOrigLoc; // The name of the break point.
|
|
|
|
bool m_bPending; // True = the breakpoint has not been established yet,
|
|
|
|
// false = location found
|
|
|
|
MIuint m_nIgnore; // The number of time the breakpoint is run over before it
|
|
|
|
// is stopped on a hit
|
|
|
|
bool m_bCondition; // True = break point is conditional, use condition
|
|
|
|
// expression, false = no condition
|
|
|
|
CMIUtilString m_strCondition; // Break point condition expression
|
|
|
|
bool m_bBrkPtThreadId; // True = break point is specified to work with a
|
|
|
|
// specific thread, false = no specified thread given
|
|
|
|
MIuint
|
|
|
|
m_nBrkPtThreadId; // Restrict the breakpoint to the specified thread-id
|
|
|
|
};
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Enumerations:
|
|
|
|
public:
|
|
|
|
//++ ===================================================================
|
|
|
|
// Details: The type of variable used by MIResponseFormVariableInfo family
|
|
|
|
// functions.
|
|
|
|
//--
|
|
|
|
enum VariableType_e {
|
|
|
|
eVariableType_InScope = (1u << 0), // In scope only.
|
|
|
|
eVariableType_Statics = (1u << 1), // Statics.
|
|
|
|
eVariableType_Locals = (1u << 2), // Locals.
|
|
|
|
eVariableType_Arguments = (1u << 3) // Arguments.
|
|
|
|
};
|
2014-12-09 02:07:40 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++ ===================================================================
|
|
|
|
// Details: Determine the information that should be shown by using
|
|
|
|
// MIResponseFormVariableInfo family functions.
|
|
|
|
//--
|
|
|
|
enum VariableInfoFormat_e {
|
|
|
|
eVariableInfoFormat_NoValues = 0,
|
|
|
|
eVariableInfoFormat_AllValues = 1,
|
|
|
|
eVariableInfoFormat_SimpleValues = 2
|
|
|
|
};
|
2015-02-07 02:08:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++ ===================================================================
|
|
|
|
// Details: Determine the information that should be shown by using
|
|
|
|
// MIResponseFormThreadInfo family functions.
|
|
|
|
//--
|
|
|
|
enum ThreadInfoFormat_e {
|
|
|
|
eThreadInfoFormat_NoFrames,
|
|
|
|
eThreadInfoFormat_AllFrames
|
|
|
|
};
|
Refactor CMICmnLLDBDebuggerHandleEvents/CMICmnLLDBDebugSessionInfo/CMICmnLLDBDebugSessionInfoVarObj (MI)
Summary:
This patch includes the following changes:
# Refactor GetVariableInfo/GetValueStringFormatted/GetValue to use the same code (MI)
Also it expands the variable value format for strings (aka char*):
was:
```
^done,name="v4",numchild="1",value="0x0000000100000f56",type="const char *",thread-id="1",has_more="0"
```
now:
```
^done,name="v4",numchild="1",value="0x0000000100000f56 \"ab\"",type="const char *",thread-id="1",has_more="0"
```
# Expand the variable value format for arrays (according to GDB)
For example:
was:
```
^done,name="v3",numchild="2",value="{...}",type="char [2]",thread-id="1",has_more="0"
```
now:
```
^done,name="v3",numchild="2",value="[2]",type="char [2]",thread-id="1",has_more="0"
```
# Rename MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry_default to test_lldbmi_gdb_show_process_stopatentry (MI)
# Fix a comment in MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry (MI)
# Refactor CMICmnLLDBUtilSBValue
## Add CMICmnLLDBUtilSBValue::IsPointerType/IsArrayType
## Refactor CMICmnLLDBUtilSBValue::GetValue
## Fix CMICmnLLDBUtilSBValue::IsChildCharType to ignore a number of childs
## Rename CMICmnLLDBUtilSBValue::IsChildCharType to IsFirstChildCharType
## Fix CMICmnLLDBUtilSBValue::GetValueCString to accept char[]
# Minor changes in CMICmnLLDBUtilSBValue::GetValue
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo family functions (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo2
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept args
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Add vArgInfo arg to CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo
## Move CMICmnLLDBDebugSessionInfo::GetFrameInfo/MIResponseFormFrameInfo to private namespace
# Refactor CMICmnLLDBDebugSessionInfo::GetThreadFrames family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::GetThreadFrames2
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept vnMaxDepth
# Fix vnMaxDepth arg name in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Merge CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo functions into one
# Don't modify fnName in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo3
## Improve -CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept vnMaxDepth
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo2
## Add CMICmnLLDBDebugSessionInfo::ThreadInfoFormat_e enum to specify thread format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept veThreadInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo (not needed because veThreadInfoFormat was added)
# Move CMICmnLLDBDebugSessionInfo::GetThreadFrames to private namespace (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e enum to specify frame format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept veFrameInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (not needed because veFrameInfoFormat was added)
# Remove duplicated level field in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
# Refactor CMICmnLLDBUtilSBValue::GetValue (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValue
## Use CMICmnLLDBUtilSBValue::GetSimpleValue in GetVlaue
# Fix CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e::eFrameInfoFormat_AllArgumentsInSimpleForm which is used to get stack-args in simple form (i.e. show {...} for composite types). It can be done by calling MIResponseFormVariableInfo with vnMaxDepth=0.
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept veFrameInfoFormat
## Remove vnMaxDepth from CMICmnLLDBDebugSessionInfo::GetThreadFrames (we should use veFrameInfoFormat instead)
# Refactor CMICmnLLDBUtilSBValue::GetValue to expand composite types (MI)
## Add CMICmnLLDBUtilSBValue::GetCompositeValue to expand composite types
## Add CMICmnLLDBUtilSBValue::m_pComposite to avoid multiple {...} in the code
## Improve CMICmnLLDBUtilSBValue::GetValue to accept vbExpandAggregates option (default=false)
## Clean up CMICmnLLDBDebugSessionInfo::GetVariableInfo to use CMICmnLLDBUtilSBValue::GetValue
## Remove the wrapping into {} in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo
## Fix MiStackTestCase.test_lldbmi_stack_list_locals test to expect result without superfluous space ' ' around the '{' or '}' brackets:
was:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = { var_d = 30 }}
```
now:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = {var_d = 30}}
```
## Fix vwrValue arg name in CMICmnLLDBUtilSBValue::GetSimpleValue (was vrValue)
# Refactor CMICmnLLDBDebugSessionInfo::GetVariableInfo (MI)
## Remove vnMaxDepth/vbIsChildValue/vnDepth args in CMICmnLLDBDebugSessionInfo::GetVariableInfo
## Improve CMICmnLLDBDebugSessionInfo::GetVariableInfo to accept vwrStrValue
## Remove vwrMiValueList arg in CMICmnLLDBDebugSessionInfo::GetVariableInfo (we should use vwrStrValue instead)
## Fix CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo to Escape values
was:
```
{name="p",value="0x0000000000000000 """}
```
now:
```
{name="p",value="0x0000000000000000 \"\""}
```
# Refactor CMICmnLLDBUtilSBValue
## Improve CMICmnLLDBUtilSBValue::GetValue to handle PrintExpandAggregates
## Improve CMICmnLLDBUtilSBValue::GetSimpleValue to handle vbHandleArrayType (use it to specify that array should be represented as simple type, i.e. value="[2]")
# Add spacing between fields in CMICmnLLDBUtilSBValue::GetCompositeValue (MI)
For example:
was:
```
^done,name="var3",numchild="3",value="{i = 3,inner = {l = 3},complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```
now:
```
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```
# Fix spacing in MiStackTestCase.test_lldbmi_stack_list_locals test (MI)
Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/
Reviewers: abidh
Subscribers: lldb-commits, abidh
Differential Revision: http://reviews.llvm.org/D8913
llvm-svn: 234476
2015-04-09 19:17:54 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++ ===================================================================
|
|
|
|
// Details: Determine the information that should be shown by using
|
|
|
|
// MIResponseFormFrameInfo family functions.
|
|
|
|
//--
|
|
|
|
enum FrameInfoFormat_e {
|
|
|
|
eFrameInfoFormat_NoArguments,
|
|
|
|
eFrameInfoFormat_AllArguments,
|
|
|
|
eFrameInfoFormat_AllArgumentsInSimpleForm
|
|
|
|
};
|
Refactor CMICmnLLDBDebuggerHandleEvents/CMICmnLLDBDebugSessionInfo/CMICmnLLDBDebugSessionInfoVarObj (MI)
Summary:
This patch includes the following changes:
# Refactor GetVariableInfo/GetValueStringFormatted/GetValue to use the same code (MI)
Also it expands the variable value format for strings (aka char*):
was:
```
^done,name="v4",numchild="1",value="0x0000000100000f56",type="const char *",thread-id="1",has_more="0"
```
now:
```
^done,name="v4",numchild="1",value="0x0000000100000f56 \"ab\"",type="const char *",thread-id="1",has_more="0"
```
# Expand the variable value format for arrays (according to GDB)
For example:
was:
```
^done,name="v3",numchild="2",value="{...}",type="char [2]",thread-id="1",has_more="0"
```
now:
```
^done,name="v3",numchild="2",value="[2]",type="char [2]",thread-id="1",has_more="0"
```
# Rename MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry_default to test_lldbmi_gdb_show_process_stopatentry (MI)
# Fix a comment in MiGdbSetShowTestCase.test_lldbmi_gdb_show_process_stopatentry (MI)
# Refactor CMICmnLLDBUtilSBValue
## Add CMICmnLLDBUtilSBValue::IsPointerType/IsArrayType
## Refactor CMICmnLLDBUtilSBValue::GetValue
## Fix CMICmnLLDBUtilSBValue::IsChildCharType to ignore a number of childs
## Rename CMICmnLLDBUtilSBValue::IsChildCharType to IsFirstChildCharType
## Fix CMICmnLLDBUtilSBValue::GetValueCString to accept char[]
# Minor changes in CMICmnLLDBUtilSBValue::GetValue
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo family functions (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo2
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept args
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Add vArgInfo arg to CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo
## Move CMICmnLLDBDebugSessionInfo::GetFrameInfo/MIResponseFormFrameInfo to private namespace
# Refactor CMICmnLLDBDebugSessionInfo::GetThreadFrames family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::GetThreadFrames2
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept vnMaxDepth
# Fix vnMaxDepth arg name in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo family functions (MI)
## Merge CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo functions into one
# Don't modify fnName in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo3
## Improve -CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept vnMaxDepth
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo family functions (MI)
## Remove CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo2
## Add CMICmnLLDBDebugSessionInfo::ThreadInfoFormat_e enum to specify thread format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo to accept veThreadInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormThreadInfo (not needed because veThreadInfoFormat was added)
# Move CMICmnLLDBDebugSessionInfo::GetThreadFrames to private namespace (MI)
# Refactor CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e enum to specify frame format
## Improve CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo to accept veFrameInfoFormat
## Remove vnMaxDepth arg in CMICmnLLDBDebugSessionInfo::MIResponseFormFrameInfo (not needed because veFrameInfoFormat was added)
# Remove duplicated level field in CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
# Refactor CMICmnLLDBUtilSBValue::GetValue (MI)
## Add CMICmnLLDBUtilSBValue::GetSimpleValue
## Use CMICmnLLDBUtilSBValue::GetSimpleValue in GetVlaue
# Fix CMICmnLLDBDebugSessionInfo::GetThreadFrames (MI)
## Add CMICmnLLDBDebugSessionInfo::FrameInfoFormat_e::eFrameInfoFormat_AllArgumentsInSimpleForm which is used to get stack-args in simple form (i.e. show {...} for composite types). It can be done by calling MIResponseFormVariableInfo with vnMaxDepth=0.
## Improve CMICmnLLDBDebugSessionInfo::GetThreadFrames to accept veFrameInfoFormat
## Remove vnMaxDepth from CMICmnLLDBDebugSessionInfo::GetThreadFrames (we should use veFrameInfoFormat instead)
# Refactor CMICmnLLDBUtilSBValue::GetValue to expand composite types (MI)
## Add CMICmnLLDBUtilSBValue::GetCompositeValue to expand composite types
## Add CMICmnLLDBUtilSBValue::m_pComposite to avoid multiple {...} in the code
## Improve CMICmnLLDBUtilSBValue::GetValue to accept vbExpandAggregates option (default=false)
## Clean up CMICmnLLDBDebugSessionInfo::GetVariableInfo to use CMICmnLLDBUtilSBValue::GetValue
## Remove the wrapping into {} in CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo
## Fix MiStackTestCase.test_lldbmi_stack_list_locals test to expect result without superfluous space ' ' around the '{' or '}' brackets:
was:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = { var_d = 30 }}
```
now:
```
{name=\"var_c\",value=\"{var_a = 10,var_b = 97 'a',inner_ = {var_d = 30}}
```
## Fix vwrValue arg name in CMICmnLLDBUtilSBValue::GetSimpleValue (was vrValue)
# Refactor CMICmnLLDBDebugSessionInfo::GetVariableInfo (MI)
## Remove vnMaxDepth/vbIsChildValue/vnDepth args in CMICmnLLDBDebugSessionInfo::GetVariableInfo
## Improve CMICmnLLDBDebugSessionInfo::GetVariableInfo to accept vwrStrValue
## Remove vwrMiValueList arg in CMICmnLLDBDebugSessionInfo::GetVariableInfo (we should use vwrStrValue instead)
## Fix CMICmnLLDBDebugSessionInfo::MIResponseFormVariableInfo to Escape values
was:
```
{name="p",value="0x0000000000000000 """}
```
now:
```
{name="p",value="0x0000000000000000 \"\""}
```
# Refactor CMICmnLLDBUtilSBValue
## Improve CMICmnLLDBUtilSBValue::GetValue to handle PrintExpandAggregates
## Improve CMICmnLLDBUtilSBValue::GetSimpleValue to handle vbHandleArrayType (use it to specify that array should be represented as simple type, i.e. value="[2]")
# Add spacing between fields in CMICmnLLDBUtilSBValue::GetCompositeValue (MI)
For example:
was:
```
^done,name="var3",numchild="3",value="{i = 3,inner = {l = 3},complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```
now:
```
^done,name="var3",numchild="3",value="{i = 3, inner = {l = 3}, complex_ptr = 0x00007fff5fbff848}",type="complex_type",thread-id="1",has_more="0"
```
# Fix spacing in MiStackTestCase.test_lldbmi_stack_list_locals test (MI)
Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/
Reviewers: abidh
Subscribers: lldb-commits, abidh
Differential Revision: http://reviews.llvm.org/D8913
llvm-svn: 234476
2015-04-09 19:17:54 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Typedefs:
|
|
|
|
public:
|
|
|
|
typedef std::vector<uint32_t> VecActiveThreadId_t;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Methods:
|
|
|
|
public:
|
|
|
|
bool Initialize() override;
|
|
|
|
bool Shutdown() override;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Variant type data which can be assigned and retrieved across all command
|
|
|
|
// instances
|
|
|
|
template <typename T>
|
|
|
|
bool SharedDataAdd(const CMIUtilString &vKey, const T &vData);
|
|
|
|
template <typename T>
|
|
|
|
bool SharedDataRetrieve(const CMIUtilString &vKey, T &vwData);
|
|
|
|
void SharedDataDestroy();
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Common command required functionality
|
|
|
|
bool AccessPath(const CMIUtilString &vPath, bool &vwbYesAccessible);
|
|
|
|
bool ResolvePath(const SMICmdData &vCmdData, const CMIUtilString &vPath,
|
|
|
|
CMIUtilString &vwrResolvedPath);
|
|
|
|
bool ResolvePath(const CMIUtilString &vstrUnknown,
|
|
|
|
CMIUtilString &vwrResolvedPath);
|
|
|
|
bool MIResponseFormFrameInfo(const lldb::SBThread &vrThread,
|
|
|
|
const MIuint vnLevel,
|
|
|
|
const FrameInfoFormat_e veFrameInfoFormat,
|
|
|
|
CMICmnMIValueTuple &vwrMiValueTuple);
|
|
|
|
bool MIResponseFormThreadInfo(const SMICmdData &vCmdData,
|
|
|
|
const lldb::SBThread &vrThread,
|
|
|
|
const ThreadInfoFormat_e veThreadInfoFormat,
|
|
|
|
CMICmnMIValueTuple &vwrMIValueTuple);
|
|
|
|
bool MIResponseFormVariableInfo(const lldb::SBFrame &vrFrame,
|
|
|
|
const MIuint vMaskVarTypes,
|
|
|
|
const VariableInfoFormat_e veVarInfoFormat,
|
|
|
|
CMICmnMIValueList &vwrMiValueList,
|
|
|
|
const MIuint vnMaxDepth = 10,
|
|
|
|
const bool vbMarkArgs = false);
|
|
|
|
void MIResponseFormBrkPtFrameInfo(const SBrkPtInfo &vrBrkPtInfo,
|
|
|
|
CMICmnMIValueTuple &vwrMiValueTuple);
|
|
|
|
bool MIResponseFormBrkPtInfo(const SBrkPtInfo &vrBrkPtInfo,
|
|
|
|
CMICmnMIValueTuple &vwrMiValueTuple);
|
|
|
|
bool GetBrkPtInfo(const lldb::SBBreakpoint &vBrkPt,
|
|
|
|
SBrkPtInfo &vrwBrkPtInfo) const;
|
|
|
|
bool RecordBrkPtInfo(const MIuint vnBrkPtId, const SBrkPtInfo &vrBrkPtInfo);
|
|
|
|
bool RecordBrkPtInfoGet(const MIuint vnBrkPtId,
|
|
|
|
SBrkPtInfo &vrwBrkPtInfo) const;
|
|
|
|
bool RecordBrkPtInfoDelete(const MIuint vnBrkPtId);
|
|
|
|
CMIUtilThreadMutex &GetSessionMutex() { return m_sessionMutex; }
|
|
|
|
lldb::SBDebugger &GetDebugger() const;
|
|
|
|
lldb::SBListener &GetListener() const;
|
|
|
|
lldb::SBTarget GetTarget() const;
|
|
|
|
lldb::SBProcess GetProcess() const;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Attributes:
|
|
|
|
public:
|
|
|
|
// The following are available to all command instances
|
|
|
|
const MIuint m_nBrkPointCntMax;
|
|
|
|
VecActiveThreadId_t m_vecActiveThreadId;
|
|
|
|
lldb::tid_t m_currentSelectedThread;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// These are keys that can be used to access the shared data map
|
|
|
|
// Note: This list is expected to grow and will be moved and abstracted in the
|
|
|
|
// future.
|
|
|
|
const CMIUtilString m_constStrSharedDataKeyWkDir;
|
|
|
|
const CMIUtilString m_constStrSharedDataSolibPath;
|
|
|
|
const CMIUtilString m_constStrPrintCharArrayAsString;
|
|
|
|
const CMIUtilString m_constStrPrintExpandAggregates;
|
|
|
|
const CMIUtilString m_constStrPrintAggregateFieldNames;
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Typedefs:
|
|
|
|
private:
|
|
|
|
typedef std::vector<CMICmnLLDBDebugSessionInfoVarObj> VecVarObj_t;
|
|
|
|
typedef std::map<MIuint, SBrkPtInfo> MapBrkPtIdToBrkPtInfo_t;
|
|
|
|
typedef std::pair<MIuint, SBrkPtInfo> MapPairBrkPtIdToBrkPtInfo_t;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Methods:
|
|
|
|
private:
|
|
|
|
/* ctor */ CMICmnLLDBDebugSessionInfo();
|
|
|
|
/* ctor */ CMICmnLLDBDebugSessionInfo(const CMICmnLLDBDebugSessionInfo &);
|
|
|
|
void operator=(const CMICmnLLDBDebugSessionInfo &);
|
|
|
|
//
|
|
|
|
bool GetVariableInfo(const lldb::SBValue &vrValue, const bool vbInSimpleForm,
|
|
|
|
CMIUtilString &vwrStrValue);
|
|
|
|
bool GetFrameInfo(const lldb::SBFrame &vrFrame, lldb::addr_t &vwPc,
|
|
|
|
CMIUtilString &vwFnName, CMIUtilString &vwFileName,
|
|
|
|
CMIUtilString &vwPath, MIuint &vwnLine);
|
|
|
|
bool GetThreadFrames(const SMICmdData &vCmdData, const MIuint vThreadIdx,
|
|
|
|
const FrameInfoFormat_e veFrameInfoFormat,
|
|
|
|
CMIUtilString &vwrThreadFrames);
|
|
|
|
bool
|
|
|
|
MIResponseForVariableInfoInternal(const VariableInfoFormat_e veVarInfoFormat,
|
|
|
|
CMICmnMIValueList &vwrMiValueList,
|
|
|
|
const lldb::SBValueList &vwrSBValueList,
|
|
|
|
const MIuint vnMaxDepth,
|
|
|
|
const bool vbIsArgs, const bool vbMarkArgs);
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Overridden:
|
|
|
|
private:
|
|
|
|
// From CMICmnBase
|
|
|
|
/* dtor */ ~CMICmnLLDBDebugSessionInfo() override;
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
// Attributes:
|
|
|
|
private:
|
|
|
|
CMIUtilMapIdToVariant m_mapIdToSessionData; // Hold and retrieve key to value
|
|
|
|
// data available across all
|
|
|
|
// commands
|
|
|
|
VecVarObj_t m_vecVarObj; // Vector of session variable objects
|
|
|
|
MapBrkPtIdToBrkPtInfo_t m_mapBrkPtIdToBrkPtInfo;
|
|
|
|
CMIUtilThreadMutex m_sessionMutex;
|
2014-05-16 18:51:01 +08:00
|
|
|
};
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
// Details: Command instances can create and share data between other instances
|
|
|
|
// of commands.
|
|
|
|
// This function adds new data to the shared data. Using the same ID
|
|
|
|
// more than
|
2014-11-18 02:06:21 +08:00
|
|
|
// once replaces any previous matching data keys.
|
|
|
|
// Type: Template method.
|
|
|
|
// Args: T - The type of the object to be stored.
|
|
|
|
// vKey - (R) A non empty unique data key to retrieve the data by.
|
|
|
|
// vData - (R) Data to be added to the share.
|
|
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
|
|
// MIstatus::failure - Functional failed.
|
|
|
|
// Throws: None.
|
2014-06-25 00:35:50 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
template <typename T>
|
2016-09-07 04:57:50 +08:00
|
|
|
bool CMICmnLLDBDebugSessionInfo::SharedDataAdd(const CMIUtilString &vKey,
|
|
|
|
const T &vData) {
|
|
|
|
if (!m_mapIdToSessionData.Add<T>(vKey, vData)) {
|
|
|
|
SetErrorDescription(m_mapIdToSessionData.GetErrorDescription());
|
|
|
|
return MIstatus::failure;
|
|
|
|
}
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return MIstatus::success;
|
2014-06-25 00:35:50 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//++
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
// Details: Command instances can create and share data between other instances
|
|
|
|
// of commands.
|
2014-11-18 02:06:21 +08:00
|
|
|
// This function retrieves data from the shared data container.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: T - The type of the object being retrieved.
|
|
|
|
// vKey - (R) A non empty unique data key to retrieve the data by.
|
|
|
|
// vData - (W) The data.
|
2016-09-07 04:57:50 +08:00
|
|
|
// Return: bool - True = data found, false = data not found or an error
|
|
|
|
// occurred trying to fetch.
|
2014-11-18 02:06:21 +08:00
|
|
|
// Throws: None.
|
2014-06-25 00:35:50 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
template <typename T>
|
2016-09-07 04:57:50 +08:00
|
|
|
bool CMICmnLLDBDebugSessionInfo::SharedDataRetrieve(const CMIUtilString &vKey,
|
|
|
|
T &vwData) {
|
|
|
|
bool bDataFound = false;
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (!m_mapIdToSessionData.Get<T>(vKey, vwData, bDataFound)) {
|
|
|
|
SetErrorDescription(m_mapIdToSessionData.GetErrorDescription());
|
|
|
|
return MIstatus::failure;
|
|
|
|
}
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return bDataFound;
|
2014-11-18 02:06:21 +08:00
|
|
|
}
|