This is an archive of the discontinued LLVM Phabricator instance.

Linux - debugging of local processes via lldb-gdbserver
ClosedPublic

Authored by vharron on Feb 11 2015, 1:01 PM.

Details

Reviewers
ovyalov
clayborg
Summary

Instead of lldb calling the ptrace APIs directly, it launches an llgs
instance and communicates with it via the remote debug protocol.

This has two advantages.

  1. There is more code shared between the remote debugging code path

and the local debugging code path. If a feature works in remote, it
probably works locally and vice-versa.

  1. It makes us more architecturally similar to OSX (which also does

local debugging via a connection to debugserver).

This path is called LLGS local. We think that this configuration is
now at parity with (or better than) local linux debugging.

It is currently invoked if you have an environment variable defined
"PLATFORM_LINUX_FORCE_LLGS_LOCAL"

We would like to switch to LLGS local as the default path and only
use the non-LLGS path if someone has an environment variable defined
"PLATFORM_LINUX_DISABLE_LLGS_LOCAL"

Later, if all goes well, we would like to remove non-LLGS local
debugging support to simplify the codebase and avoid confusion.

Diff Detail

Event Timeline

vharron updated this revision to Diff 19778.Feb 11 2015, 1:01 PM
vharron retitled this revision from to Linux - debugging of local processes via lldb-gdbserver.
vharron updated this object.
vharron edited the test plan for this revision. (Show Details)
vharron added reviewers: ovyalov, clayborg.
vharron added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.Feb 11 2015, 1:22 PM
clayborg edited edge metadata.

Looks good. I believe doing remote debugging all of the time is the best way to go and what we should encourage people to use it.

We might also, in a separate patch, ask the platform for the GDB remote binary. The default implementation would return "lldb-gdbserver":

virtual Error
Platform::GetGDBServer(FileSpec &f)
{

// Calculate the default path to llgs

}

Then we would override this on PlatformDarwin to return the path to debugserver. This way the GDB remote binary path isn't hard coded at compile time. And other platforms that use the GDB remote protocol can specify their own binaries that might get distributed with the built LLDB.

This revision is now accepted and ready to land.Feb 11 2015, 1:22 PM
ovyalov accepted this revision.Feb 11 2015, 4:00 PM
ovyalov edited edge metadata.

lgtm

vharron updated this revision to Diff 19795.Feb 11 2015, 4:26 PM
vharron edited edge metadata.

Changed from reading env variable to reading setting

vharron updated this revision to Diff 19796.Feb 11 2015, 4:27 PM

Removed unchanged file

vharron closed this revision.Mar 1 2015, 4:29 PM

Committed: r230919