2015-07-21 21:09:39 +08:00
|
|
|
//===-- MICmnMIOutOfBandRecord.cpp ------------------------------*- C++ -*-===//
|
2014-05-16 18:51:01 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// In-house headers:
|
|
|
|
#include "MICmnMIOutOfBandRecord.h"
|
|
|
|
#include "MICmnResources.h"
|
|
|
|
|
|
|
|
// Instantiations:
|
2014-11-18 02:06:21 +08:00
|
|
|
CMICmnMIOutOfBandRecord::MapOutOfBandToOutOfBandText_t ms_MapOutOfBandToOutOfBandText = {
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_Running, "running"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_Stopped, "stopped"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointCreated, "breakpoint-created"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, "breakpoint-modified"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_Thread, ""}, // "" Meant to be empty
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupAdded, "thread-group-added"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupExited, "thread-group-exited"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupRemoved, "thread-group-removed"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, "thread-group-started"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadCreated, "thread-created"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadExited, "thread-exited"},
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadSelected, "thread-selected"},
|
2015-04-30 19:08:31 +08:00
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_TargetModuleLoaded, "library-loaded"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_TargetModuleUnloaded, "library-unloaded"},
|
2015-04-24 19:27:36 +08:00
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput, ""}};
|
2014-11-18 02:06:21 +08:00
|
|
|
CMICmnMIOutOfBandRecord::MapOutOfBandToOutOfBandText_t ms_constMapAsyncRecordTextToToken = {
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_Running, "*"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_Stopped, "*"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointCreated, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_Thread, "@"},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupAdded, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupExited, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupRemoved, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadCreated, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadExited, "="},
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_ThreadSelected, "="},
|
2015-04-30 19:08:31 +08:00
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_TargetModuleLoaded, "="},
|
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_TargetModuleUnloaded, "="},
|
2015-04-24 19:27:36 +08:00
|
|
|
{CMICmnMIOutOfBandRecord::eOutOfBand_TargetStreamOutput, "@"}};
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2014-05-16 18:51:01 +08:00
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: CMICmnMIOutOfBandRecord constructor.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: None.
|
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
CMICmnMIOutOfBandRecord::CMICmnMIOutOfBandRecord(void)
|
|
|
|
: m_strAsyncRecord(MIRSRC(IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION))
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: CMICmnMIOutOfBandRecord constructor.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: veType - (R) A MI Out-of-Bound enumeration.
|
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
CMICmnMIOutOfBandRecord::CMICmnMIOutOfBandRecord(const OutOfBand_e veType)
|
|
|
|
: m_eResultAsyncRecordClass(veType)
|
|
|
|
, m_strAsyncRecord(MIRSRC(IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION))
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
BuildAsyncRecord();
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: CMICmnMIOutOfBandRecord constructor.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: veType - (R) A MI Out-of-Bound enumeration.
|
2015-04-24 19:27:36 +08:00
|
|
|
// vConst - (R) A MI const object.
|
2014-11-18 02:06:21 +08:00
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2015-04-24 19:27:36 +08:00
|
|
|
CMICmnMIOutOfBandRecord::CMICmnMIOutOfBandRecord(const OutOfBand_e veType, const CMICmnMIValueConst &vConst)
|
2014-11-18 02:06:21 +08:00
|
|
|
: m_eResultAsyncRecordClass(veType)
|
|
|
|
, m_strAsyncRecord(MIRSRC(IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION))
|
2015-04-24 19:27:36 +08:00
|
|
|
{
|
|
|
|
BuildAsyncRecord();
|
|
|
|
m_strAsyncRecord += vConst.GetString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
|
|
|
// Details: CMICmnMIOutOfBandRecord constructor.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: veType - (R) A MI Out-of-Bound enumeration.
|
|
|
|
// vResult - (R) A MI result object.
|
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
|
|
|
//--
|
|
|
|
CMICmnMIOutOfBandRecord::CMICmnMIOutOfBandRecord(const OutOfBand_e veType, const CMICmnMIValueResult &vResult)
|
|
|
|
: m_eResultAsyncRecordClass(veType)
|
|
|
|
, m_strAsyncRecord(MIRSRC(IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION))
|
|
|
|
, m_partResult(vResult)
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
BuildAsyncRecord();
|
|
|
|
Add(m_partResult);
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: CMICmnMIOutOfBandRecord destructor.
|
|
|
|
// Type: Overrideable.
|
|
|
|
// Args: None.
|
|
|
|
// Return: None.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
CMICmnMIOutOfBandRecord::~CMICmnMIOutOfBandRecord(void)
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Return the MI Out-of-band record as a string. The string is a direct result of
|
|
|
|
// work done on *this Out-of-band record so if not enough data is added then it is
|
|
|
|
// possible to return a malformed Out-of-band record. If nothing has been set or
|
|
|
|
// added to *this MI Out-of-band record object then text "<Invalid>" will be returned.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: None.
|
|
|
|
// Return: CMIUtilString & - MI output text.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
const CMIUtilString &
|
|
|
|
CMICmnMIOutOfBandRecord::GetString(void) const
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
return m_strAsyncRecord;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
2014-11-18 02:06:21 +08:00
|
|
|
|
2014-05-16 18:51:01 +08:00
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Build the Out-of-band record's mandatory data part. The part up to the first
|
|
|
|
// (additional) result i.e. async-record ==> "*" type.
|
|
|
|
// Type: Method.
|
|
|
|
// Args: None.
|
|
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
|
|
// MIstatus::failure - Functional failed.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
bool
|
|
|
|
CMICmnMIOutOfBandRecord::BuildAsyncRecord(void)
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2015-07-03 21:45:34 +08:00
|
|
|
const char *pFormat = "%s%s";
|
2014-11-18 02:06:21 +08:00
|
|
|
const CMIUtilString &rStrAsyncRecord(ms_MapOutOfBandToOutOfBandText[m_eResultAsyncRecordClass]);
|
|
|
|
const CMIUtilString &rStrToken(ms_constMapAsyncRecordTextToToken[m_eResultAsyncRecordClass]);
|
|
|
|
m_strAsyncRecord = CMIUtilString::Format(pFormat, rStrToken.c_str(), rStrAsyncRecord.c_str());
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
return MIstatus::success;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//++ ------------------------------------------------------------------------------------
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: Add to *this Out-of-band record additional information.
|
|
|
|
// Type: Method.
|
2015-04-24 19:27:36 +08:00
|
|
|
// Args: vResult - (R) A MI result object.
|
2014-11-18 02:06:21 +08:00
|
|
|
// Return: MIstatus::success - Functional succeeded.
|
|
|
|
// MIstatus::failure - Functional failed.
|
|
|
|
// Throws: None.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
2014-11-18 02:06:21 +08:00
|
|
|
bool
|
2015-04-24 19:27:36 +08:00
|
|
|
CMICmnMIOutOfBandRecord::Add(const CMICmnMIValueResult &vResult)
|
2014-05-16 18:51:01 +08:00
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
m_strAsyncRecord += ",";
|
2015-04-24 19:27:36 +08:00
|
|
|
m_strAsyncRecord += vResult.GetString();
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
return MIstatus::success;
|
2014-05-16 18:51:01 +08:00
|
|
|
}
|