[Lldb-commits] [PATCH] Fix CLI commands in lldb-mi
Ilia K
ki.stfu at gmail.com
Mon Feb 2 13:34:58 PST 2015
Hi abidh, clayborg,
This patch fixes execution of CLI commands in MI mode. The CLI commands are executed using "-interpreter-exec" command. The bug was in the CMICmnLLDBDebugSessionInfo class which contained the following members: SBProcess, SBTarget, SBDebugger and SBListener, but CLI commands don't affect to them and they aren't updated. Therefore some members can contain incorrect (or obsolete) reference and it can cause an error. My patch removes these members and uses getters that provides the updated instance every time it is used.
For example (before fix):
```
$ bin/lldb-mi --interpreter
(gdb)
-interpreter-exec command "target create ~/p/hello"
Current executable set to '~/p/hello' (x86_64).
Current executable set to '~/p/hello' (x86_64).
^done
-break-insert -f main
^done,bkpt={number="0",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="??",file="??",fullname="??/??",line="0",pending=["main"],times="0",original-location="main"}
-exec-run
^error,msg="Command 'exec-run'. Invalid process during debug session"
```
As I said, my patch fixes this example (and many others):
```
$ bin/lldb-mi --interpreter
(gdb)
-interpreter-exec command "target create ~/p/hello"
Current executable set to '~/p/hello' (x86_64).
Current executable set to '~/p/hello' (x86_64).
^done
-break-insert -f main
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="4",pending=["main"],times="0",original-location="main"}
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="main",file="hello.cpp",fullname="/Users/IliaK/p/hello.cpp",line="4",pending=["main"],times="1",original-location="main"}
-exec-run
^running
=thread-group-started,id="i1",pid="56624"
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
*running,thread-id="all"
(gdb)
(gdb)
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x1036d6e74",func="main",args=[{name="argc",value="1"},{name="argv",value="0x00007fff5c529f28"}],file="hello.cpp",fullname="/Users//IliaK/p/hello.cpp",line="4"},thread-id="1",stopped-threads="all"
(gdb)
quit
MI: Program exited OK
```
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7357
Files:
tools/lldb-mi/MICmdCmdBreak.cpp
tools/lldb-mi/MICmdCmdData.cpp
tools/lldb-mi/MICmdCmdData.h
tools/lldb-mi/MICmdCmdExec.cpp
tools/lldb-mi/MICmdCmdFile.cpp
tools/lldb-mi/MICmdCmdGdbInfo.cpp
tools/lldb-mi/MICmdCmdMiscellanous.cpp
tools/lldb-mi/MICmdCmdStack.cpp
tools/lldb-mi/MICmdCmdTarget.cpp
tools/lldb-mi/MICmdCmdThread.cpp
tools/lldb-mi/MICmdCmdVar.cpp
tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
tools/lldb-mi/MICmnLLDBDebugSessionInfo.h
tools/lldb-mi/MICmnLLDBDebugger.cpp
tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
tools/lldb-mi/MICmnLLDBProxySBValue.cpp
tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7357.19180.patch
Type: text/x-patch
Size: 44784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150202/129beffd/attachment.bin>
More information about the lldb-commits
mailing list