diff options
| author | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2015-02-08 20:21:08 +0000 |
|---|---|---|
| committer | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2015-02-08 20:21:08 +0000 |
| commit | 93ad6b31ec5a1d3f3f782f331acd179d64b7b0fc (patch) | |
| tree | dd18df52ba10185d5c5a7cfcd4512b5e99fd7953 /lldb/tools/lldb-mi/MICmdCmdBreak.cpp | |
| parent | 055811ef722c140091f27dcc5f058e8ee17c6305 (diff) | |
| download | bcm5719-llvm-93ad6b31ec5a1d3f3f782f331acd179d64b7b0fc.tar.gz bcm5719-llvm-93ad6b31ec5a1d3f3f782f331acd179d64b7b0fc.zip | |
Fix a handling of full path in break-insert.
For some time, eclipse (CDT) uses full path of the file in break-insert command
when putting breakpoint on a source line. On windows, a typical command looks
like the following.
56-break-insert -f F:\\work\\ws\\test\\main.c:49
Current implementation in lldb-mi have problem in 2 ways.
1. It was assuming that there will be only one : in the path which is wrong if full
path is supplied.
2. CDT sends out path with double backslashes in windows which gives error on
resolution.
Fixed the : issue in lldb-mi. Changed FileSpec::Normalize to make sure that it
handles the path with \\ correctly. Added test cases to check for full path in
both lldb-mi and lldb. Also added a test case to check SBFileSpec with double
slashes.
llvm-svn: 228538
Diffstat (limited to 'lldb/tools/lldb-mi/MICmdCmdBreak.cpp')
| -rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdBreak.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdBreak.cpp b/lldb/tools/lldb-mi/MICmdCmdBreak.cpp index 9e7a110afca..9ad7ea3540f 100644 --- a/lldb/tools/lldb-mi/MICmdCmdBreak.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdBreak.cpp @@ -180,19 +180,16 @@ CMICmdCmdBreakInsert::Execute(void) CMIUtilString fileName; MIuint nFileLine = 0; CMIUtilString strFileFn; - const MIint nPosColon = m_brkName.find(cColon); - if (nPosColon != (MIint)std::string::npos) + CMIUtilString rStrLineOrFn; + // Full path in windows can have : after drive letter. So look for the + // last colon + const size_t nPosColon = m_brkName.find_last_of(cColon); + if (nPosColon != std::string::npos) { - CMIUtilString::VecString_t vecFileAndLocation; - const MIuint nSplits = m_brkName.Split(cColon, vecFileAndLocation); - MIunused(nSplits); - if (vecFileAndLocation.size() != 2) - { - SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_LOCATION_FORMAT), m_cmdData.strMiCmd.c_str(), m_brkName.c_str())); - return MIstatus::failure; - } - fileName = vecFileAndLocation.at(0); - const CMIUtilString &rStrLineOrFn(vecFileAndLocation.at(1)); + // extract file name and line number from it + fileName = m_brkName.substr(0, nPosColon); + rStrLineOrFn = m_brkName.substr(nPosColon + 1, m_brkName.size() - nPosColon - 1); + if (rStrLineOrFn.empty()) eBrkPtType = eBreakPoint_ByName; else |

