I am trying to debug my c program using
gcc -g -lm -lpthread -std=c99 -w terminalproject.c
and then
gdb a.out
but when I type layout next
, it shows me assembly code not c code.
How to switch to C code in layout?
EDIT: I am using Red Hat Linux 6, I tried to run it in Ubuntu, It is showing C code.
ps my code has pthreads in it.
This command:
gcc -g -lm -lpthread -std=c99 -w terminalproject.c
is wrong . Use this instead:
gcc -g -std=c99 -pthread terminalproject.c -lm
You should never use -w
(suppress all warnings) flag, unless you desire painful debugging sessions.
layout src
saysNo source Available
.
This likely means that you are using updated GCC, but ancient GDB. Try building recent GDB release from source -- it's usually not hard.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.