[lldb-dev] Question on lldb commands and remote connection

Greg Clayton gclayton at apple.com
Wed Oct 9 09:50:32 PDT 2013

On Oct 9, 2013, at 8:06 AM, Yin Ma <yin at affinic.com> wrote:

> Hi
> I cannot find the command set the working directory and

(lldb) process launch --working-dir /tmp

If you are attaching to a GDB server that already has an existing process running, your GDB server is responsible for setting the working directory prior to LLDB attaching. 

If you start GDB server with no executable, then you can use the LLDB specific packets for setting environment variables and setting the working directory, but most GDB servers don't support that. Let me know if you want to know more about that.

> The command to set temporary breakpoint like tbreak in
> Gdb.

(lldb) help tbreak 
   Set a one shot breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.  This command takes 'raw' input (no need to quote stuff).

Syntax: _regexp-tbreak [<filename>:<linenum>]
_regexp-break [<linenum>]
_regexp-break [<address>]
_regexp-break <...>

'tbreak' is an abbreviation for '_regexp-tbreak'

> For remote connection, I only find gdb-remote, which based
> On manual is target remote. But I cannot find about how to
> Use it and those matching control commands
> target extended-remote

LLDB doesn't need to switch targets. To connect to a remote GDB server:

1 - launch remote GDB server

remote% debugserver local:1234 -- /bin/ls -lAF

2 - launch lldb and attach

local% lldb
(lldb) process connect --plugin gdb-remote connect://remote:1234

The command below is equivalent to the above command:

(lldb) gdb-remote remote:1234

"gdb-remote" is just a regex alias that will run "process connect".

> disconnect

(lldb) process detach 

> monitor exit

I have no idea what this does.

> set remote exec-file

This is where you want to use the python API, but you can do this via the "script" command line command. Lets say you have a local copy of "/bin/ls" for your remote system on your current machine at "/tmp/ls". When you launch lldb you would use the local copy:

% lldb
(lldb) target create --platform remote-macosx /tmp/ls 

When you can set the remote path:

(lldb) script exe_module = lldb.target.FindModule(lldb.SBFileSpec('/tmp/ls', false)); exe_module.SetPlatformFileSpec(lldb.SBFileSpec('/bin/ls', False))

> Could Anyone tell me what they are?
> Thanks,
> Yin
> _______________________________________________
> 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