Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | m_setCmdArgs.Add(*(new CMICmdArgValOptionShort(m_constStrArgNamedRestrictBrkPtToThreadId, false, true, | ||||
CMICmdArgValListBase::eArgValType_Number, 1))); | CMICmdArgValListBase::eArgValType_Number, 1))); | ||||
m_setCmdArgs.Add(*(new CMICmdArgValString(m_constStrArgNamedLocation, false, true))); | m_setCmdArgs.Add(*(new CMICmdArgValString(m_constStrArgNamedLocation, false, true))); | ||||
m_setCmdArgs.Add( | m_setCmdArgs.Add( | ||||
*(new CMICmdArgValOptionLong(m_constStrArgNamedThreadGroup, false, true, CMICmdArgValListBase::eArgValType_ThreadGrp, 1))); | *(new CMICmdArgValOptionLong(m_constStrArgNamedThreadGroup, false, true, CMICmdArgValListBase::eArgValType_ThreadGrp, 1))); | ||||
return ParseValidateCmdOptions(); | return ParseValidateCmdOptions(); | ||||
} | } | ||||
//++ ------------------------------------------------------------------------------------ | //++ ------------------------------------------------------------------------------------ | ||||
// Helper function for CMICmdCmdBreakInsert::Execute(void). | |||||
// | |||||
// Given a string, return the position of the ':' separator in 'file:func' | |||||
// or 'file:line', if any. If not found, return npos. For example, return | |||||
// 5 for 'foo.c:std::string'. | |||||
//-- | |||||
static size_t findFileSeparatorPos(const std::string& x) | |||||
{ | |||||
// Full paths in windows can have ':' after a drive letter, so we | |||||
// search backwards, taking care to skip C++ namespace tokens '::'. | |||||
size_t n = x.find_last_of(':'); | |||||
while (n != std::string::npos && n > 1 && x[n-1] == ':') | |||||
{ | |||||
n = x.find_last_of(':', n - 2); | |||||
} | |||||
return n; | |||||
} | |||||
//++ ------------------------------------------------------------------------------------ | |||||
// Details: The invoker requires this function. The command does work in this function. | // Details: The invoker requires this function. The command does work in this function. | ||||
// The command is likely to communicate with the LLDB SBDebugger in here. | // The command is likely to communicate with the LLDB SBDebugger in here. | ||||
// Type: Overridden. | // Type: Overridden. | ||||
// Args: None. | // Args: None. | ||||
// Return: MIstatus::success - Functional succeeded. | // Return: MIstatus::success - Functional succeeded. | ||||
// MIstatus::failure - Functional failed. | // MIstatus::failure - Functional failed. | ||||
// Throws: None. | // Throws: None. | ||||
//-- | //-- | ||||
Show All 37 Lines | CMICmdCmdBreakInsert::Execute(void) | ||||
m_bBrkPtThreadId = pArgRestrictBrkPtToThreadId->GetFound(); | m_bBrkPtThreadId = pArgRestrictBrkPtToThreadId->GetFound(); | ||||
if (m_bBrkPtCondition) | if (m_bBrkPtCondition) | ||||
{ | { | ||||
pArgRestrictBrkPtToThreadId->GetExpectedOption<CMICmdArgValNumber, MIuint>(m_nBrkPtThreadId); | pArgRestrictBrkPtToThreadId->GetExpectedOption<CMICmdArgValNumber, MIuint>(m_nBrkPtThreadId); | ||||
} | } | ||||
// Determine if break on a file line or at a function | // Determine if break on a file line or at a function | ||||
BreakPoint_e eBrkPtType = eBreakPoint_NotDefineYet; | BreakPoint_e eBrkPtType = eBreakPoint_NotDefineYet; | ||||
const CMIUtilString cColon = ":"; | |||||
CMIUtilString fileName; | CMIUtilString fileName; | ||||
MIuint nFileLine = 0; | MIuint nFileLine = 0; | ||||
CMIUtilString strFileFn; | CMIUtilString strFileFn; | ||||
CMIUtilString rStrLineOrFn; | CMIUtilString rStrLineOrFn; | ||||
// Full path in windows can have : after drive letter. So look for the | // Is the string in the form 'file:func' or 'file:line'? | ||||
// last colon | // If so, find the position of the ':' separator. | ||||
const size_t nPosColon = m_brkName.find_last_of(cColon); | const size_t nPosColon = findFileSeparatorPos(m_brkName); | ||||
if (nPosColon != std::string::npos) | if (nPosColon != std::string::npos) | ||||
{ | { | ||||
// extract file name and line number from it | // Extract file name and line number from it | ||||
fileName = m_brkName.substr(0, nPosColon); | fileName = m_brkName.substr(0, nPosColon); | ||||
rStrLineOrFn = m_brkName.substr(nPosColon + 1, m_brkName.size() - nPosColon - 1); | rStrLineOrFn = m_brkName.substr(nPosColon + 1, m_brkName.size() - nPosColon - 1); | ||||
if (rStrLineOrFn.empty()) | if (rStrLineOrFn.empty()) | ||||
eBrkPtType = eBreakPoint_ByName; | eBrkPtType = eBreakPoint_ByName; | ||||
else | else | ||||
{ | { | ||||
MIint64 nValue = 0; | MIint64 nValue = 0; | ||||
▲ Show 20 Lines • Show All 860 Lines • Show Last 20 Lines |