Difference between revisions of "Strace"

From eLinux.org
Jump to: navigation, search
m (Add category)
 
Line 31: Line 31:
 
  mb-desktop-dotdesktop: failed to open /home/root/.applications
 
  mb-desktop-dotdesktop: failed to open /home/root/.applications
 
It works! (some desktop appear on the screen)
 
It works! (some desktop appear on the screen)
 +
 +
[[Category:Development Tools]]

Latest revision as of 14:50, 27 October 2011

Introduction

Strace is generally used to trace the system calls. It is generally useful when a program doesn't start or behave correctly because of some missing files.

Real Use case

For instance we have matchbox-desktop from matchbox1 which goes in segmentation fault: On a terminal:

# screen Xorg

On another terminal:

# DISPLAY=:0.0 matchbox-desktop
Segmentation fault

How do we resolve that? let's try strace:

DISPLAY=:0.0 strace matchbox-desktop

which displays a lot of output,I reproduced only the end of it here,which,in this case, is the interesting part.

stat64("/home/root/.icons/mbup.png", 0xbec7c358) = -1 ENOENT (No such file or directory)
stat64("/usr/share/pixmaps/mbup.png", 0xbec7c358) = -1 ENOENT (No such file or directory)
stat64("mbup.png", 0xbec7c358)          = -1 ENOENT (No such file or directory)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 2134 detached

Here we can see that it lacks the mbup.png file,that makes it goes into segmentation fault.

Now how to resolve that? we simlpy have to look for the package providing mbup.png and install it This package is matchbox-common(a good idea would also be to make matchbox-desktop depend on matchbbox-common) After installing matchbox common,here's the result:

# DISPLAY=:0.0  matchbox-desktop      
matchbox-desktop: loading /usr/lib/matchbox/desktop/tasks.so with args ( None )
matchbox-desktop: loading /usr/lib/matchbox/desktop/dotdesktop.so with args ( None )
user_overides is (nil)
mb-desktop-dotdesktop: failed to open /usr/local/share/applications
mb-desktop-dotdesktop: failed to open /home/root/.applications

It works! (some desktop appear on the screen)