I am using gdb [7.11.1] kali linux 32-bit when I use list command to lload the source of my assembly program in gdb it displays the following error message: 'No symbol table is loaded. Use the "file" command'
I have tried the command as:
list list line_number
In both the cases the error is same.
Please help me
Thanks! in advance
I use list command to lload the source of my assembly
List command does nothing of the sort. Rather, it lists sources that GDB has already loaded.
as -o progname.o progname.s
In your case, GDB does not load any sources because you compiled your program without any debug info. You likely want:
as -g -o progname.o progname.s
From man as :
-g
--gen-debug
Generate debugging information for each assembler source line
using whichever debug format is preferred by the target. This
currently means either STABS, ECOFF or DWARF2.
I was incurring same problem while I was trying to debug my c code for buffer overflow stuffs. That error rises because of clean compiling without generating any debug info. For c program, rather than normal compiling as gcc program.c
try to run gcc -g -fno-stack-protector -z exec stack -o buffer program.c
.
-g
tells GCC to add extra information for GDB -fno-stack-protector
flag to turn off stack protection mechanism -z execstack
, it makes stack executable
This command will create a buffer
binary file of your c program and hence it will fulfil all the criteria for running the list command in gdb.
Start the gdb with gdb ./buffer
then type list
command. It will work!!
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.