dawn created this revision. dawn added reviewers: abidh, brucem, ki.stfu. dawn added a subscriber: lldb-commits. dawn set the repository for this revision to rL LLVM.
Given eBreakPoint_ByFileFn, code previously was calling: sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str()); which calls the overload: lldb::SBBreakpoint BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); but the module_name is expected to be the exe or dll here, i.e. for -break-insert a.out:func which isn't a valid use of -break-insert in gdb. This patch calls the correct overload: lldb::SBBreakpoint BreakpointCreateByName (const char *symbol_name, const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list); Comments were added to the tests for cases that won't work due to bugs in lldb. Repository: rL LLVM http://reviews.llvm.org/D11499 Files: test/tools/lldb-mi/breakpoint/TestMiBreak.py tools/lldb-mi/MICmdCmdBreak.cpp Index: tools/lldb-mi/MICmdCmdBreak.cpp =================================================================== --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -245,8 +245,13 @@ m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress); break; case eBreakPoint_ByFileFn: - m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str()); + { + lldb::SBFileSpecList module; // search in all modules + lldb::SBFileSpecList compUnit; + compUnit.Append (lldb::SBFileSpec(fileName.c_str())); + m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), module, compUnit); break; + } case eBreakPoint_ByFileLine: m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine); break; Index: test/tools/lldb-mi/breakpoint/TestMiBreak.py =================================================================== --- test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -73,7 +73,29 @@ # Test that non-pending BP was set correctly self.runCmd("-exec-continue") self.expect("\^running") - self.expect("\*stopped,reason=\"breakpoint-hit\"") + self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"2\"") + + # Test that we can set a BP using the file:func syntax + self.runCmd("-break-insert main.cpp:main") + self.expect("\^done,bkpt={number=\"4\"") + self.runCmd("-break-insert main.cpp:ns::foo1") + self.expect("\^done,bkpt={number=\"5\"") + #FIXME: quotes on filenames aren't handled correctly in lldb-mi. + #self.runCmd("-break-insert \"main.cpp\":main") + #self.expect("\^done,bkpt={number=\"6\"") + + # We should hit BP #5 on 'main.cpp:ns::foo1' + self.runCmd("-exec-continue") + self.expect("\^running") + self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"5\"") + #self.expect("\*stopped,reason=\"breakpoint-hit\"") + + # Test that we can set a BP using the global namespace token + #FIXME: this test is disabled due to a bug in lldb. + #self.runCmd("-break-insert \"::main\"") + #self.expect("\^done,bkpt={number=\"7\"") + #self.runCmd("-break-insert \"main.cpp:::main\"") + #self.expect("\^done,bkpt={number=\"8\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
Index: tools/lldb-mi/MICmdCmdBreak.cpp =================================================================== --- tools/lldb-mi/MICmdCmdBreak.cpp +++ tools/lldb-mi/MICmdCmdBreak.cpp @@ -245,8 +245,13 @@ m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress); break; case eBreakPoint_ByFileFn: - m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), fileName.c_str()); + { + lldb::SBFileSpecList module; // search in all modules + lldb::SBFileSpecList compUnit; + compUnit.Append (lldb::SBFileSpec(fileName.c_str())); + m_brkPt = sbTarget.BreakpointCreateByName(strFileFn.c_str(), module, compUnit); break; + } case eBreakPoint_ByFileLine: m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine); break; Index: test/tools/lldb-mi/breakpoint/TestMiBreak.py =================================================================== --- test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -73,7 +73,29 @@ # Test that non-pending BP was set correctly self.runCmd("-exec-continue") self.expect("\^running") - self.expect("\*stopped,reason=\"breakpoint-hit\"") + self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"2\"") + + # Test that we can set a BP using the file:func syntax + self.runCmd("-break-insert main.cpp:main") + self.expect("\^done,bkpt={number=\"4\"") + self.runCmd("-break-insert main.cpp:ns::foo1") + self.expect("\^done,bkpt={number=\"5\"") + #FIXME: quotes on filenames aren't handled correctly in lldb-mi. + #self.runCmd("-break-insert \"main.cpp\":main") + #self.expect("\^done,bkpt={number=\"6\"") + + # We should hit BP #5 on 'main.cpp:ns::foo1' + self.runCmd("-exec-continue") + self.expect("\^running") + self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"5\"") + #self.expect("\*stopped,reason=\"breakpoint-hit\"") + + # Test that we can set a BP using the global namespace token + #FIXME: this test is disabled due to a bug in lldb. + #self.runCmd("-break-insert \"::main\"") + #self.expect("\^done,bkpt={number=\"7\"") + #self.runCmd("-break-insert \"main.cpp:::main\"") + #self.expect("\^done,bkpt={number=\"8\"") @lldbmi_test @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
_______________________________________________ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits