Quick Binary Debugging in Linux with Strace System Call Tracer

I’ve recently come across strace, a debugging utility for Linux that “monitor the system calls used by a program and all the signals”. It may not be that useful if you have the source code and can run other debugging tools such as gdb, or simply add printf to your code. But if you don’t have source code of the program, or you are a system administrator who wants to check if the program fails due to file access reasons, for example, this is really a great tool as it may help you find out which file causes problem.

In my case, I was trying OpenGL ES on an ARM platform, and at least part of the code comes in libraries that are only available in binary form.

I got the following error message running es2_info (part of mesa-utils-extra):

UMP: ump_arch_open() failed to open UMP device driver
ERROR: In file: src/base/common/mem/base_common_mem.c  function: initialize_memo
ry_system()   line:1521
Could not open UMP memory system. Shutdown.

Error: eglInitialize() failed

I don’t have the source for src/base/common/mem/base_common_mem.c, and I’ve been advised to use strace to find out if the problem could be file related (missing missing, permission issue…). You may need to install it first (e.g. Ubuntu/Debian):

sudo apt-get install strace

Now time to give it a try:

This will output a debugging information each time a file or a socket is accessed. In this case, strace helped me identify the issue when it showed es2_info could not open /dev/ump device file due to permission issues. Running the program with sudo or changing /dev/ump permission fixed that particular issue.

This is just one example. If you want to know more about the options provided by this tool, simply visit strace manpage.

Share this:

Support CNX Software! Donate via cryptocurrencies or become a Patron on Patreon

ROCK Pi 4C Plus
Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
Weller PCB manufacturer