When you are doing a port or working on a new platform, you need to know what #defines are supported for the architecture and operating system. The following command reads nothing(/dev/null) and dumps the #defines:
cpp -dM </dev/null
When you are doing a port or working on a new platform, you need to know what #defines are supported for the architecture and operating system. The following command reads nothing(/dev/null) and dumps the #defines:
cpp -dM </dev/null
When running GDB under Linux, I often want to see why a system call failed, but when I try to print errno, I get “Cannot access memory at address 0×8″. This is because errno is a macro for:
# define errno (*__errno_location ())
The solution to the problem is to print what the macro expands to:
(gdb) p errno
Cannot access memory at address 0×8
(gdb) p (*__errno_location ())
$4 = 1
Tiptop Software Company’s technical notes is our way of sharing we’ve learned on the field. Often, we find ourselves searching the Internet or digging through documentation to solve a problem. We are hoping if we post up, the next web search might be easier.