[Lldb-commits] [lldb] r236832 - Fix -break-insert without -f to cause an error if BP not resolved (MI)

Ilia K ki.stfu at gmail.com
Fri May 8 05:09:57 PDT 2015


Author: ki.stfu
Date: Fri May  8 07:09:56 2015
New Revision: 236832

URL: http://llvm.org/viewvc/llvm-project?rev=236832&view=rev
Log:
Fix -break-insert without -f to cause an error if BP not resolved (MI)

For example:
was:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert main
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0000000100000e2d",func="main",file="hello.cpp",fullname="/Users/Ilia
hello.cpp",line="14",pending=["main"],times="0",original-location="main"}
```

now:
```
$ bin/lldb-mi ~/p/hello
[...]
-break-insert main
^error,msg="Command 'break-insert'. Breakpoint location 'main' not found"
```


Modified:
    lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
    lldb/trunk/tools/lldb-mi/MICmnResources.cpp
    lldb/trunk/tools/lldb-mi/MICmnResources.h

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp?rev=236832&r1=236831&r2=236832&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp Fri May  8 07:09:56 2015
@@ -243,14 +243,19 @@ CMICmdCmdBreakInsert::Execute(void)
 
     if (bOk)
     {
+        if (!m_bBrkPtIsPending && (m_brkPt.GetNumLocations() == 0))
+        {
+            sbTarget.BreakpointDelete(m_brkPt.GetID());
+            SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND), m_cmdData.strMiCmd.c_str(), m_brkName.c_str()));
+            return MIstatus::failure;
+        }
+
         m_brkPt.SetEnabled(m_bBrkPtEnabled);
         m_brkPt.SetIgnoreCount(m_nBrkPtIgnoreCount);
         if (m_bBrkPtCondition)
             m_brkPt.SetCondition(m_brkPtCondition.c_str());
         if (m_bBrkPtThreadId)
             m_brkPt.SetThreadID(m_nBrkPtThreadId);
-        if (!m_brkPt.IsValid())
-            m_bBrkPtIsPending = pArgPendingBrkPt->GetFound();
     }
 
     // CODETAG_LLDB_BREAKPOINT_CREATION

Modified: lldb/trunk/tools/lldb-mi/MICmnResources.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.cpp?rev=236832&r1=236831&r2=236832&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnResources.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnResources.cpp Fri May  8 07:09:56 2015
@@ -217,6 +217,7 @@ const CMICmnResources::SRsrcTextData CMI
     {IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED, "Command '%s'. Command not implemented as it has been deprecated"},
     {IDS_CMD_ERR_CREATE_TARGET, "Command '%s'. Create target failed: %s"},
     {IDS_CMD_ERR_BRKPT_LOCATION_FORMAT, "Command '%s'. Incorrect format for breakpoint location '%s'"},
+    {IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND, "Command '%s'. Breakpoint location '%s' not found"},
     {IDS_CMD_ERR_BRKPT_INVALID, "Command '%s'. Breakpoint '%s' invalid"},
     {IDS_CMD_ERR_BRKPT_CNT_EXCEEDED, "Command '%s'. Number of valid breakpoint exceeded %d. Cannot create new breakpoint '%s'"},
     {IDS_CMD_ERR_SOME_ERROR, "Command '%s'. Error: %s"},

Modified: lldb/trunk/tools/lldb-mi/MICmnResources.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnResources.h?rev=236832&r1=236831&r2=236832&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmnResources.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmnResources.h Fri May  8 07:09:56 2015
@@ -235,6 +235,7 @@ enum
     IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED,
     IDS_CMD_ERR_CREATE_TARGET,
     IDS_CMD_ERR_BRKPT_LOCATION_FORMAT,
+    IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND,
     IDS_CMD_ERR_BRKPT_INVALID,
     IDS_CMD_ERR_BRKPT_CNT_EXCEEDED,
     IDS_CMD_ERR_SOME_ERROR,





More information about the lldb-commits mailing list