-g and -o in gdb
i'm newbie in linux gcc,gdb
when i make a debug.c data, and go to gcc and put this $gcc -g -o debugfile debug.c $gdb debugfile and then sentence showed up "Reading symbols from........./debugfile...done if i use $gcc -o debugfile debug.c $gdb debugfile this sentence sentence showed up "Reading symbols from.........../debugfile...(no debugging symbols found)" what is the causes of these different output thank you.. sorry for bad english use |
That's quite simple... even if you decide to name the output file "debugfile", it doesn't actually make it be a debug file... it's just the compilation output (a binary executable).
What actually makes it "debuggable" is in fact the '-g' option: Code:
-g If you add the '-g' option, debugging symbols will be added to the output file. If you don't, debugging symbols will be omitted, making your program much smaller in size, but harder to debug and reverse engineer. Edit: Oh, and as for what debugging symbols actually are... they're little bits of extra information scattered all over the program, that help gdb figure out what assembler instruction corresponds to what line of code, what memory address corresponds to what variable name, and so on. These aren't actually needed in a program to run, but they're needed to debug it. |
All times are GMT -5. The time now is 09:08 PM. |