[lldb-dev] Remote debug a program running on FreeBSD from Mac OS X

Dr. Rolf Jansen rj at obsigna.com
Thu May 7 16:45:53 PDT 2015


I entered the log enable command and then I repeated exactly the same debug session of my initial post up to " … lost connection". Here comes the content of the log file (s. below). I am a little bit lost with that. However I, learned from another post, that remote debugging of a program running on FreeBSD from an external client is not possible, and I guess, that it isn't very promising starting debugging at the end of the pipe. Therefore, I stop my efforts for now.

Anyway, thank you very much for taking your time to respond to my message.

Best regards

Rolf

<   1> send packet: +
history[1] tid=0x0513 <   1> send packet: +
<  19> send packet: $QStartNoAckMode#b0
<   1> read packet: +
<   6> read packet: $OK#9a
<   1> send packet: +
<  13> send packet: $qHostInfo#9b
< 482> read packet: $triple:7838365f36342d756e6b6e6f776e2d6672656562736431302e31;ptrsize:8;watchpoint_exceptions_received:after;endian:little;os_version:10.1;os_build:3030313939353036;os_kernel:467265654253442031302e312d52454c454153452d70392023313a20467269204170722031302030373a32383a30392042525420323031352020202020726f6f74407365727665722e70726f6a656374776f726c642e6e65743a2f7573722f6f626a2f7573722f7372632f7379732f47454e455249435f4950736563;hostname:7365727665722e70726f6a656374776f726c642e6e6574;#57
<  21> send packet: $QSetDisableASLR:0#cd
<   4> read packet: $#00
<  23> send packet: $QSetDetachOnError:0#f7
<   6> read packet: $OK#9a
<  50> send packet: $QLaunchArch:x86_64-unknown-freebsd10.1-unknown#55
<   6> read packet: $OK#9a
<  24> send packet: $A14,0,2e2f68656c6c6f#04
<   6> read packet: $OK#9a
<  18> send packet: $qLaunchSuccess#a5
<   6> read packet: $OK#9a
<  16> send packet: $qProcessInfo#dc
< 186> read packet: $pid:859a;parent-pid:858e;real-uid:0;real-gid:0;effective-uid:0;effective-gid:0;triple:7838365f36342d756e6b6e6f776e2d6672656562736431302e31;ostype:freebsd10.1;endian:little;ptrsize:8;#55
<  48> send packet: $qLaunchGDBServer;host:rolf.mydomain.org;#f3
<  25> read packet: $pid:34203;port:16158;#ed
<   1> send packet: +
history[1] tid=0x0513 <   1> send packet: +
<  19> send packet: $QStartNoAckMode#b0
<   1> read packet: +
<   6> read packet: $OK#9a
<   1> send packet: +
<  26> send packet: $QThreadSuffixSupported#e4
<   6> read packet: $OK#9a
<  27> send packet: $QListThreadsInStopReply#21
<   6> read packet: $OK#9a
<  13> send packet: $qHostInfo#9b
< 482> read packet: $triple:7838365f36342d756e6b6e6f776e2d6672656562736431302e31;ptrsize:8;watchpoint_exceptions_received:after;endian:little;os_version:10.1;os_build:3030313939353036;os_kernel:467265654253442031302e312d52454c454153452d70392023313a20467269204170722031302030373a32383a30392042525420323031352020202020726f6f74407365727665722e70726f6a656374776f726c642e6e65743a2f7573722f6f626a2f7573722f7372632f7379732f47454e455249435f4950736563;hostname:7365727665722e70726f6a656374776f726c642e6e6574;#57
<  10> send packet: $vCont?#49
<  17> read packet: $vCont;c;C;s;S#62
<  27> send packet: $qVAttachOrWaitSupported#38
<   4> read packet: $#00
<  16> send packet: $qProcessInfo#dc
<   7> read packet: $E44#ad
<   6> send packet: $qC#b4
<   7> read packet: $E44#ad
<  23> send packet: $QSetDetachOnError:0#f7
<   6> read packet: $OK#9a
<  16> send packet: $vAttach;859a#0d
<   7> read packet: $E01#a6


> Am 07.05.2015 um 14:12 schrieb Greg Clayton <gclayton at apple.com>:
> 
> Check the gdb-remote packet log. It seems you are losing connection to your lldb-server and that causes the process to die with -1 and "lost connection". To see the log:
> 
> (lldb) log enable -t -f /tmp/packet.log gdb-remote packets
> 
> This will log all GDB remote packets, including the ones that the "lldb-server platform" is sending, but you might be able to see how far your program is making it...
> 
> Greg
> 
>> On May 7, 2015, at 10:02 AM, Dr. Rolf Jansen <rj at obsigna.com> wrote:
>> 
>> I built lldb (+clang/llvm) from trunk on the FreeBSD 10.1-RELEASE-p9 box and on the Mac OS X 10.10.3 client. Is remote debugging of an executable on FreeBSD possible from within lldb on Mac OS X? Considering the simple "hello.c" below, I can launch the executable which resides on FreeBSD remotely via lldb on the Mac OS X client, but the session is then immediately stopped with the following message:
>> 
>> Process 17299 exited with status = -1 (0xffffffff) lost connection
>> 
>> 
>> What am I doing wrong? Here comes, what I achieved so far:
>> 
>> hello.c:
>> 
>> #include <stdio.h>
>> 
>> int main(int argc, const char *argv[])
>> {
>>  printf("Hello, World!\n");
>>  getchar();
>>  return 0;
>> }
>> 
>> 
>> On the FreeBSD box:
>> 
>> # cd ~/helloworld
>> # clang -O0 -g hello.c -o hello
>> # ~/install/LLVM/llvm/build/bin/lldb-server platform —listen *:1234
>> 
>> 
>> On the Mac OS X client:
>> 
>> $ scp -rp root at server:helloworld helloworld
>> $ cd helloworld
>> $ ~/install/LLVM/build/bin/lldb
>> (lldb) version
>> lldb-340.99.0
>> (lldb) platform select remote-freebsd
>>     Host: Darwin 14.3.0 (MBPRJ.local)
>> Host: Darwin 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64
>> Platform: remote-freebsd
>> Connected: no
>> (lldb) target create ./hello
>> Current executable set to './hello' (x86_64).
>> (lldb) platform connect connect://192.168.222.35:1234
>>     Host: Darwin 14.3.0 (MBPRJ.local)
>> Host: Darwin 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64
>> Platform: remote-freebsd
>>   Triple: x86_64-unknown-freebsd10.1
>> OS Version: 10.1 (00199506)
>>   Kernel: FreeBSD 10.1-RELEASE-p9 #1: Fri Apr 10 07:28:09 BRT 2015     root at server.mydomain.org:/usr/obj/usr/src/sys/GENERIC_IPsec
>> Hostname: server.mydomain.org
>> Connected: yes
>> (lldb) b hello.c:5
>> Breakpoint 1: where = hello`main + 30 at hello.c:5, address = 0x000000000040086e
>> (lldb) platform process launch
>> (lldb) Process 17299 exited with status = -1 (0xffffffff) lost connection
>> 
>> 
>> Best regards
>> 
>> Rolf
>> 
>> 
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 





More information about the lldb-dev mailing list