I have following sample code
#include<stdio.h>
int main()
{
int num1, num2;
printf("Enter two numbers\n");
scanf("%d",&num1);
scanf("%d",&num2);
int i;
for(i = 0; i < num2; i++)
num1 = num1 + num1;
printf("Result is %d \n",num1);
return 0;
}
I compiled this code with -g option to gcc.
gcc -g file.c
Generate separate symbol file
objcopy --only-keep-debug a.out a.out.sym
Strip the symbols from a.out
strip -s a.out
Load this a.out in gdb
gdb a.out
gdb says "no debug information found" fine. Then I use add-symbol-file command in gdb
(gdb) add-symbol-file a.out.debug [Enter]
The address where a.out.debug has been loaded is missing
- I want to know how to find this address?
- Is there any command or trick to find it?
- This address is representing WHAT?
I know gdb has an other command symbol-file but it overwrites the previous loaded symbols. So I have to use this command to add many symbol files in gdb. my system is 64bit running ubuntu LTS 12.04 gdb version is 7.4-2012.04 gcc version is 4.6.3
| grep '.text'
to extract only that line) – Kristiankristiansand