← Back to team overview

unity-dev team mailing list archive

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

 

On 11/04/2011 17:38, Richard Dale wrote:
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.

This is not specific to unity-2d-spread. Ubuntu default security settings forbid a regular user from attaching a debugger to an existing process. You can try running the debugger as root, but that is not really practical. Kees Cook (security engineer working on Ubuntu) blogged about it:

http://www.outflux.net/blog/archives/2011/02/18/ptracing-siblings/

Aurélien



References