blob: 6f5aaccd87eee17cf438a25abed66a464ec23445 [file] [log] [blame]
Deepak Panickal6f9c4682014-05-16 10:51:01 +00001//===-- MICmnLLDBDebugSessionInfo.h -----------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10//++
11// File: MICmnLLDBDebugSessionInfo.h
12//
13// Overview: CMICmnLLDBDebugSessionInfo interface.
14//
15// Environment: Compilers: Visual C++ 12.
16// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
17// Libraries: See MIReadmetxt.
18//
19// Copyright: None.
20//--
21
22#pragma once
23
24// Third party headers:
25#include <map>
26#include <vector>
27#include <lldb/API/SBDebugger.h>
28#include <lldb/API/SBListener.h>
29#include <lldb/API/SBProcess.h>
30#include <lldb/API/SBTarget.h>
31
32// In-house headers:
33#include "MICmnBase.h"
34#include "MIUtilSingletonBase.h"
35#include "MICmnLLDBDebugSessionInfoVarObj.h"
36#include "MICmnMIValueTuple.h"
37
38// Declarations:
39class CMICmnLLDBDebugger;
40struct SMICmdData;
41class CMICmnMIValueTuple;
42class CMICmnMIValueList;
43
44//++ ============================================================================
45// Details: MI debug session object that holds debugging information between
46// instances of MI commands executing their work and producing MI
47// result records. Information/data is set by one or many commands then
48// retrieved by the same or other sebsequent commands.
49// It primarily to hold LLDB type objects.
50// A singleton class.
51// Gotchas: None.
52// Authors: Illya Rudkin 04/03/2014.
53// Changes: None.
54//--
55class CMICmnLLDBDebugSessionInfo
56: public CMICmnBase
57, public MI::ISingleton< CMICmnLLDBDebugSessionInfo >
58{
59 friend class MI::ISingleton< CMICmnLLDBDebugSessionInfo >;
60
61// Typedefs:
62public:
63 typedef std::vector< uint32_t > VecActiveThreadId_t;
64
65// Methods:
66public:
67 bool Initialize( void );
68 bool Shutdown( void );
69
70 // Variant type data which can be assigned and retrieved across all command instances
71 bool SharedDataAdd( const CMIUtilString & vKey, const CMIUtilString & vData );
72 bool SharedDataRetrieve( const CMIUtilString & vKey, CMIUtilString & vwData );
73 bool SharedDataDestroy( void );
74
75 // Common command required functionality
76 bool AccessPath( const CMIUtilString & vPath, bool & vwbYesAccessible );
77 bool GetFrameInfo( const lldb::SBFrame & vrFrame, lldb::addr_t & vwPc, CMIUtilString & vwFnName, CMIUtilString & vwFileName, CMIUtilString & vwPath, MIuint & vwnLine );
78 bool GetThreadFrames( const SMICmdData & vCmdData, const MIuint vThreadIdx, CMICmnMIValueTuple & vwrThreadFrames );
79 bool ResolvePath( const SMICmdData & vCmdData, const CMIUtilString & vPath, CMIUtilString & vwrResolvedPath );
80 bool ResolvePath( const CMIUtilString & vstrUnknown, CMIUtilString & vwrResolvedPath );
81 bool MIResponseFormFrameInfo( const lldb::SBThread & vrThread, const MIuint vnLevel, CMICmnMIValueTuple & vwrMiValueTuple );
82 bool MIResponseFormFrameInfo( const lldb::addr_t vPc, const CMIUtilString & vFnName, const CMIUtilString & vArgs, const CMIUtilString & vFileName, const CMIUtilString & vPath, const MIuint vnLine, CMICmnMIValueTuple & vwrMiValueTuple );
83 bool MIResponseFormThreadInfo( const SMICmdData & vCmdData, const lldb::SBThread & vrThread, CMICmnMIValueTuple & vwrMIValueTuple );
84 bool MIResponseFormVariableInfo( const lldb::SBFrame & vrFrame, const MIuint vMaskVarTypes, CMICmnMIValueList & vwrMiValueList );
85 bool MIResponseFormBrkPtFrameInfo( const lldb::addr_t vPc, const CMIUtilString & vFnName, const CMIUtilString & vFileName, const CMIUtilString & vPath, const MIuint vnLine, CMICmnMIValueTuple & vwrMiValueTuple );
86 bool MIResponseFormBrkPtInfo( const lldb::break_id_t vId, const CMIUtilString & vStrType, const bool vbDisp, const bool vbEnabled, const lldb::addr_t vPc, const CMIUtilString & vFnName, const CMIUtilString & vFileName, const CMIUtilString & vPath, const MIuint vnLine, const bool vbHaveArgOptionThreadGrp, const CMIUtilString & vStrOptThrdGrp, const MIuint & vnTimes, const CMIUtilString & vStrOrigLoc, CMICmnMIValueTuple & vwrMiValueTuple );
87
88 // Attributes:
89public:
90 // The following are available to all command instances
91 lldb::SBDebugger & m_rLldbDebugger;
92 lldb::SBListener & m_rLlldbListener;
93 lldb::SBTarget m_lldbTarget;
94 lldb::SBProcess m_lldbProcess;
95 MIuint m_nBrkPointCnt;
96 const MIuint m_nBrkPointCntMax;
97 VecActiveThreadId_t m_vecActiveThreadId;
98 lldb::tid_t m_currentSelectedThread;
99 //
100 const CMIUtilString m_constStrSharedDataKeyWkDir;
101
102// Typedefs:
103private:
104 typedef std::map< CMIUtilString, CMIUtilString > MapKeyToStringValue_t; // Todo: change this to be a variant type
105 typedef std::pair< CMIUtilString, CMIUtilString > MapPairKeyToStringValue_t;
106 typedef std::vector< CMICmnLLDBDebugSessionInfoVarObj > VecVarObj_t;
107
108// Methods:
109private:
110 /* ctor */ CMICmnLLDBDebugSessionInfo( void );
111 /* ctor */ CMICmnLLDBDebugSessionInfo( const CMICmnLLDBDebugSessionInfo & );
112 void operator=( const CMICmnLLDBDebugSessionInfo & );
113
114// Overridden:
115private:
116 // From CMICmnBase
117 /* dtor */ virtual ~CMICmnLLDBDebugSessionInfo( void );
118
119// Attributes:
120private:
121 MapKeyToStringValue_t m_mapKeyToStringValue; // Hold and retrieve key to value data available across all commands
122 VecVarObj_t m_vecVarObj; // Vector of session variable objects
123};