[lldb-dev] Restarting the application in remote debugging

chansarav chansarav at gmail.com
Mon Aug 19 07:44:20 PDT 2013

> Send a “WXX” packet to indicate the program exited.

Thank you. Sending the "WXX"” packet to indicate the program exited worked.
I received the following message at the lldb prompt.

Process 1 exited with status = 0

And now to restart the application I gave the 'run' command for which I
received the error "'A' packet returned an error: -1". When I checked the
simulator for this I found that the simulator didn't receive the 'A'

When debugged the lldb, I found that the problem is with the platform that
has been chosen for my target. I had made platform "gdb-server" as my
default platform explicitly by modifying the
"PlatformRemoteGDBServer::Initialize ()" method.

$ lldb --arch vliw workplace/app.elf
Current executable set to 'workplace/app.elf' (vliw).
(lldb) target list
Current targets:
* target #0: /home/chandra/app01/workplace/app.elf (
arch=vliw-unknown-unknown, platform=remote-gdb-server )

Since I was connecting the target simulator using the Process plugin
'gdb-remote', the platform "gdb-server" didn't come into picture of
connecting the simulator.

(lldb) process connect --plugin gdb-remote connect://localhost:51000

The connection and the debugging happened through the 'gdb-remote' Process
plugin. And the problem comes when I restart the program after it
terminates with an exit status. I.e. When I give the 'run' command to
restart the program, the platform "gdb-server" sends the argument packet
'A' for program launching. But there is no connection associated with the
platform "gdb-server". Hence lldb gives the following error:

error: 'A' packet returned an error: -1

With my existing porting of lldb I am able to connect the simulator and
successfully debug a program once. But I am not able to do the following:

1. Restart the program for debugging with disconnecting the connection.
2. Send launch command to the simulator from lldb.

Can't I support the above two features from the 'gdb-remote' Process
plugin? Can you please suggest the way of supporting the above two features?

Chandra Kumar R.

On Sat, Aug 10, 2013 at 1:26 AM, Greg Clayton <gclayton at apple.com> wrote:

> On Aug 8, 2013, at 6:04 AM, chansarav <chansarav at gmail.com> wrote:
> > I have ported lldb for remotely debugging our target. The lldb is
> connected to the target simulator using the gdb remote protocol.
> >
> > $lldb --arch vliw app.elf
> > (lldb)process connect --plugin gdb-remote connect://localhost:51000
> >
> > The above command connects the lldb with the target simulator waiting at
> port '51000'. And the debug commands work properly.
> >
> > But once the execution of the application completes, I am facing the
> problem in restarting the application for debugging again.
> >
> > For restarting the application being debugged, I think lldb should send
> the 'R' packet. When would lldb send the 'R' packet?
> >
> > Currently the target simulator sends the SIGTERM signal (T0fthread:0001)
> after completing the program execution. And on receiving this signal, lldb
> doesn't doesn't display the message "Program exited normally”.
> The “T0F” means we stopped with a signal. Send a “WXX” packet to indicate
> the program exited.
> >
> > Also when I gave the 'continue' command to restart the application
> debugging again, lldb sends the 'C0f' packet.
> Yes, you indicated you stopped with a signal. We often catch signals
> before they get passed onto the signal handlers and we can decide to not
> pass on the signal. See “help process handle” for more information, but
> again, if your process exits with a signal, send a “WXX” packet where XX is
> the hex exit status of the program.
> Greg
> >
> >
> > Thanks,
> > Chandra Kumar R.
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130819/d669b8f3/attachment.html>

More information about the lldb-dev mailing list