[lldb-dev] Launching the program through 'gdb-remote' process plugin

chansarav chansarav at gmail.com
Wed Aug 21 07:47:27 PDT 2013


Hi,

I am connecting lldb with my simulator through 'gdb-remote' process plugin.
After extablishing the connection, I want to issue the 'process launch'
command in lldb which should send the arguments packet 'A' to simulator
asking it to launch the program.

I am facing the problem while issuing the 'process launch' command in lldb.
When I give the 'process launch' command, lldb hangs and there is no
communication with simulator. When I debugged with gdb, I got the backtrace
as follows:

#2  0xb6703a6f in lldb_private::Condition::Wait (this=0x8077dac, mutex=...,
abstime=0x0, timed_out=0xbfffaa9f) at
/home/chandra/llvm-3.1/tools/lldb/source/Host/common/Condition.cpp:92
#3  0xb662768d in lldb_private::Predicate<bool>::WaitForValueEqualTo
(this=0x8077d90, value=true, abstime=0x0, timed_out=0xbfffaa9f) at
/home/chandra/llvm-3.1/tools/lldb/source/Core/../../include/lldb/Host/Predicate.h:317
#4  0xb662b03f in lldb_private::Listener::WaitForEventsInternal
(this=0x8077d3c, timeout=0x0, broadcaster=0xadb0179c,
broadcaster_names=0x0, num_broadcaster_names=0, event_type_mask=3,
event_sp=...) at
/home/chandra/llvm-3.1/tools/lldb/source/Core/Listener.cpp:409
#5  0xb662b1f7 in
lldb_private::Listener::WaitForEventForBroadcasterWithType (this=0x8077d3c,
timeout=0x0, broadcaster=0xadb0179c, event_type_mask=3, event_sp=...) at
/home/chandra/llvm-3.1/tools/lldb/source/Core/Listener.cpp:440
#6  0xb69421ec in lldb_private::Process::WaitForStateChangedEvents
(this=0xadb01788, timeout=0x0, event_sp=...) at
/home/chandra/llvm-3.1/tools/lldb/source/Target/Process.cpp:1069
#7  0xb6941f2c in lldb_private::Process::WaitForProcessToStop
(this=0xadb01788, timeout=0x0) at
/home/chandra/llvm-3.1/tools/lldb/source/Target/Process.cpp:977
#8  0xb6587d98 in CommandObjectProcessLaunch::DoExecute (this=0x80813d0,
launch_args=..., result=...) at
/home/chandra/llvm-3.1/tools/lldb/source/Commands/CommandObjectProcess.cpp:220
#9  0xb672c999 in lldb_private::CommandObjectParsed::Execute
(this=0x80813d0, args_string=0xb4d667bc "", result=...) at
/home/chandra/llvm-3.1/tools/lldb/source/Interpreter/CommandObject.cpp:856
#10 0xb67215d3 in lldb_private::CommandInterpreter::HandleCommand
(this=0x8077fc8, command_line=0x883a614 "process launch",
lazy_add_to_history=lldb_private::eLazyBoolYes, result=...,
    override_context=0x0, repeat_on_empty_command=true,
no_context_switching=false) at
/home/chandra/llvm-3.1/tools/lldb/source/Interpreter/CommandInterpreter.cpp:1571
#11 0xb64e0ced in lldb::SBCommandInterpreter::HandleCommand
(this=0xbfffc2cc, command_line=0x883a614 "process launch", result=...,
add_to_history=true) at
/home/chandra/llvm-3.1/tools/lldb/source/API/SBCommandInterpreter.cpp:97
#12 0x0805a103 in Driver::HandleIOEvent (this=0xbfffec7c, event=...) at
/home/chandra/llvm-3.1/tools/lldb/tools/driver/Driver.cpp:996
#13 0x0805b516 in Driver::MainLoop (this=0xbfffec7c) at
/home/chandra/llvm-3.1/tools/lldb/tools/driver/Driver.cpp:1430
#14 0x0805bbf2 in main (argc=4, argv=0xbfffede4, envp=0xbfffedf8) at
/home/chandra/llvm-3.1/tools/lldb/tools/driver/Driver.cpp:1562

Though I am analyzing on this, Can someone help me in finding out what goes
wrong while trying to launch a program in simulator through 'gdb-remote'
process plugin?


Following is the communication between lldb and simulator for the "process
connect --plugin gdb-remote connect://localhost:51000" command.

Send Packet: QStartNoAckMode: 15 chars
Read Packet:
Send Packet: QThreadSuffixSupported: 22 chars
Read Packet:
Send Packet: QListThreadsInStopReply: 23 chars
Read Packet: E01
Send Packet: qHostInfo: 9 chars
Read Packet:
cputype:201;cpusubtype:-2;ostype:unknown;vendor:unknown;endian:little;ptrsize:4;
Send Packet: vCont?: 6 chars
Read Packet: vCont[;c;s]
Send Packet: qVAttachOrWaitSupported: 23 chars
Read Packet:
Send Packet: qC: 2 chars
Read Packet: QC0

LLDB sets the status as connected after this communication.
(snip start)
    if (pid == LLDB_INVALID_PROCESS_ID)
    {
        // We don't have a valid process ID, so note that we are connected
        // and could now request to launch or attach, or get remote process
        // listings...
        SetPrivateState (eStateConnected);
    }
(snip end)
function: ProcessGDBRemote::DoConnectRemote ()

Thanks,
Chandra Kumar R.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130821/9423b8b0/attachment.html>


More information about the lldb-dev mailing list