[lldb-dev] [lldb-mi] unable to debug GTK applications

Jan Kratochvil via lldb-dev lldb-dev at lists.llvm.org
Fri Mar 8 12:22:51 PST 2019

On Tue, 26 Feb 2019 14:52:26 +0100, Eran Ifrah via lldb-dev wrote:
> I am trying a GTK application using lldb-mi, however, the application
> terminates immediately with the error message:
> @"15:47:16: Error: Unable to initialize GTK+, is DISPLAY set properly?\r\n"
> Running the same using "pure" lldb works as expected.

Using Eclipse the lldb-server environment is empty as nothing sets it.

I tried the attached patch (a copy from StartDebugserverProcess()) which does
fix it for local debugging but it is apparently a wrong patch as it provides
to the application environment from gdbserver, not from Eclipse as it should
by QEnvironmentHexEncoded packets.

As I should do something else is there some known status of the environment
passing? Isn't it some unimplemented Linux-port feature?

-------------- next part --------------
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -217,6 +217,9 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
+  // Copy the current environment to the gdbserver instance
+  m_process_launch_info.GetEnvironment() = Host::GetEnvironment();
   if (should_forward_stdio) {
     if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection())
       return Status(std::move(Err));

More information about the lldb-dev mailing list