[Lldb-commits] [lldb] r232734 - Fix -break-insert for system functions (MI)

Ilia K ki.stfu at gmail.com
Thu Mar 19 10:13:20 PDT 2015


Author: ki.stfu
Date: Thu Mar 19 12:13:20 2015
New Revision: 232734

URL: http://llvm.org/viewvc/llvm-project?rev=232734&view=rev
Log:
Fix -break-insert for system functions (MI)

Summary:
# Fix -break-insert for system functions
# Fix MiExecTestCase to use -break-insert instead of CLI "b"
# Improve MiBreakTestCase: now it uses printf() instead of in-house function

All tests pass on OS X.

Test Plan:
```
$ bin/lldb-mi --interpreter
(gdb)
-file-exec-and-symbols ~/p/hello
^done
(gdb)
=shlibs-added,shlib-info=[num="1",name="hello",dyld-addr="-",reason="dyld",path="/Users/IliaK/p/hello",loaded_addr="-",dsym-objpath="/Users/IliaK/p/hello.dSYM/Contents/Resources/DWARF/hello"]
-break-insert -f printf
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="??",file="??",fullname="??/??",line="0",pending=["printf"],times="0",original-location="printf"}
(gdb)
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="??",file="??",fullname="??/??",line="0",pending=["printf"],times="0",original-location="printf"}
-exec-run
^running
...
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x7fff8a476910",func="printf",args=[],file="??",fullname="??",line="-1"},thread-id="1",stopped-threads="all"
(gdb)
```

Reviewers: abidh, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, abidh

Differential Revision: http://reviews.llvm.org/D8412

Modified:
    lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
    lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp
    lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
    lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp

Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=232734&r1=232733&r2=232734&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/TestMiBreak.py Thu Mar 19 12:13:20 2015
@@ -21,7 +21,7 @@ class MiBreakTestCase(lldbmi_testcase.Mi
         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
         self.expect("\^done")
 
-        self.runCmd("-break-insert -f g_MyFunction")
+        self.runCmd("-break-insert -f printf")
         self.expect("\^done,bkpt={number=\"1\"")
 
         self.runCmd("-exec-run")
@@ -46,7 +46,7 @@ class MiBreakTestCase(lldbmi_testcase.Mi
         self.expect("\^running")
         self.expect("\*stopped,reason=\"breakpoint-hit\"")
 
-        self.runCmd("-break-insert g_MyFunction")
+        self.runCmd("-break-insert printf")
         self.expect("\^done,bkpt={number=\"2\"")
 
         self.runCmd("-exec-continue")

Modified: lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp?rev=232734&r1=232733&r2=232734&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/breakpoint/main.cpp Thu Mar 19 12:13:20 2015
@@ -7,14 +7,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-void
-g_MyFunction(void)
-{
-}
+#include <cstdio>
 
 int
 main(int argc, char const *argv[])
 {
-    g_MyFunction();
+    printf("");
     return 0; // BP_return
 }

Modified: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py?rev=232734&r1=232733&r2=232734&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py Thu Mar 19 12:13:20 2015
@@ -430,9 +430,8 @@ class MiExecTestCase(lldbmi_testcase.MiT
         #self.expect("\^error: Frame index 10 is out of range")
 
         # Set BP at printf and run to BP
-        # FIXME: BP at printf not resolved and never hit!
-        self.runCmd("-interpreter-exec command \"breakpoint set --name printf\"") #FIXME: self.runCmd("-break-insert -f printf")
-        self.expect("\^done")                                                     #FIXME: self.expect("\^done,bkpt={number=\"3\"")
+        self.runCmd("-break-insert -f printf")
+        self.expect("\^done,bkpt={number=\"3\"")
         self.runCmd("-exec-continue")
         self.expect("\^running")
         self.expect("\*stopped,reason=\"breakpoint-hit\"")

Modified: lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp?rev=232734&r1=232733&r2=232734&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp Thu Mar 19 12:13:20 2015
@@ -232,7 +232,7 @@ CMICmdCmdBreakInsert::Execute(void)
             m_brkPt = sbTarget.BreakpointCreateByLocation(fileName.c_str(), nFileLine);
             break;
         case eBreakPoint_ByName:
-            m_brkPt = sbTarget.BreakpointCreateByName(m_brkName.c_str(), sbTarget.GetExecutable().GetFilename());
+            m_brkPt = sbTarget.BreakpointCreateByName(m_brkName.c_str(), nullptr);
             break;
         case eBreakPoint_count:
         case eBreakPoint_NotDefineYet:





More information about the lldb-commits mailing list