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

Dr. Rolf Jansen rj at obsigna.com
Thu May 7 10:02:33 PDT 2015


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





More information about the lldb-dev mailing list