https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 currently for trivia nonthreaded helloworld with no debug info up to -ggdb2 you will get: (gdb) p errno [some error] * with -ggdb2 and less "errno" in fact does not exist anywhere as it was compiled to "(*__errno_location ())" and the macro definition is not present. Unfortunately gdb will find the TLS symbol and it will try to access it but as the program has been compiled without -lpthread the TLS base register (%gs on i386) is not setup and it will result in: Cannot access memory at address 0x8 Attached suggestion patch how to deal with the most common "errno" symbol for the most common under-ggdb3 compiled programs. 2006-08-25 Jan Kratochvil * target.c (target_translate_tls_address): Provided warnings for TLS `errno' on non-TLS targets. Index: gdb-6.6/gdb/target.c =================================================================== --- gdb-6.6.orig/gdb/target.c 2007-01-17 01:25:31.000000000 +0100 +++ gdb-6.6/gdb/target.c 2007-01-20 06:31:36.000000000 +0100 @@ -898,7 +898,18 @@ /* It wouldn't be wrong here to try a gdbarch method, too; finding TLS is an ABI-specific thing. But we don't do that yet. */ else - error (_("Cannot find thread-local variables on this target")); + { + struct minimal_symbol *msymbol; + + msymbol = lookup_minimal_symbol ("errno", NULL, NULL); + if (msymbol != NULL + && SYMBOL_VALUE_ADDRESS (msymbol) == offset + && SYMBOL_BFD_SECTION (msymbol)->owner == objfile->obfd) + error (_("TLS symbol `errno' not resolved for non-TLS program." + " You should use symbol \"(*__errno_location ())\" or" + " compile the program with `gcc -ggdb3' or `gcc -pthread'.")); + error (_("Cannot find thread-local variables on this target")); + } return addr; }