← Back to team overview

unity-dev team mailing list archive

Re: [Ayatana-dev] Debugging Unity-2d QML

 

On Monday, April 11, 2011 03:20:26 PM Ugo Riboni wrote:
> > Yes, I've been trying that, but unity-2d-spread needs to be run as root.
> > So I tried running qt creator as root with 'sudo qtcreator' in my
> > current session but that didn't work too well. Or maybe I should set the
> > setuid bit on the unity-2d-spread executable so it can run as root - I'm
> > still experimenting.
> > 
> > It doesn't look too hard to add a menu option 'Connect to Running QML
> > Application..' to 'Debug ->  Start Debugging' to Qt Creator though, and
> > I've started doing that now too. Certainly if I need to debug
> > unity-2d-launcher and unity-2d-panel I'll need be able to connect to a
> > running process anyway, because they must be started by the
> > gnome-session process.
> 
> Actually this does not seem correct.
> 
> First off, why do you say that you need to run spread as root ?
> It should definitely not be run as root.
If I use 'ps ax' to get the pid of the unity-2d-spread process, and then try 
the command 'gdb attach <spread_pid>' I get an error about not being able to 
attach to the process and it says 'try running again as root'. If I then try 
'sudo gdb attach <spread_pid>', it works. So I had assumed from this message 
that the unity-2d-spread process needs to be run as root - but wrongly it 
seems. On the other hand, if I try and run unity-2d-spread from qt creator it 
doesn't start properly, and doesn't log anything in the Application Output 
pane to explain why either. I had assumed this was because it wasn't running 
as root.

> Second, you don't need launcher and panel to be started by the session,
> if all you need is to debug them.
> What you can do is to change the
> /usr/share/applications/unity-2d-launcher and change the line with the
> name of the executable to something that doesn't exist (to prevent the
> session from starting it).
> Then log out of your session and log in again. Press ctrl+alt+t to start
> a new terminal and launch qtcreator from there, then start your launcher
> under a debugger.
Yes, I assume you mean /usr/share/applications/unity-2d-launcher.desktop 
above. I've got the various binaries that are normally exec'd by the .desktop 
files replaced with custom shell scripts and that is working well. I can also 
try your suggestion of making the .desktop files try to run a non-existent 
binary.

> Of course if you prefer hacking qtcreator, that's great and definitely
> something other people can use, but it's certainly not the quickest way
> to debug this problem.
Yes, I agree - which is why I'm trying to implement a short term solution as 
described above, along with a better longer term solution base on Qt Creator 
where we can all get a really nice IDE based development environment going.

-- Richard



Follow ups

References