Print `errno` instead of value in GDB

I wonder if there is a way to print a symbolic name errnoinstead of a number in GDB. For example, instead of

errno = 13

I would like to see something like

EACCES
+5
source share
1 answer

Assuming you have recent GDB with built-in Python, you can use the Python interpreter to accomplish what you want.

The following (unverified) code must be right:

(gdb) python import errno
(gdb) python print errno.errorcode[13]

You should be able to define a python command, for example. perrnowhich will cut input. The documentation is here .

+8
source

All Articles