gdb Cannot access memory at address problem
by shogun1234 from LinuxQuestions.org on (#51DRJ)
I am completely new to gdb and lower level programming. But I am interested in it and play to see if I can learn some new skills.
What I want to accomplish is understand (analyze) what happened to the program that have segment fault.
I follow the tutorial - https://felix.abecassis.me/2012/08/g...pped-binaries/
The program code I use is
Code://#include <stdio.h>
// __attribute__ ((noinline)) void fun(int test)
//{
//printf("value: %d\n", test);
//}
int main()
{
int v = 21;
}and it's complied by gcc myprogram.c. Also strip -s a.out is used to strip off the debug symbols.
Then I launch gdb a.out
Using info file to find the entry point, which looks like
Code:(gdb) info file
Symbols from "/home/jacob/a.out".
Local exec file:
`/home/jacob/a.out', file type elf64-x86-64.
Entry point: 0x4f0
0x0000000000000238 - 0x0000000000000254 is .interp
0x0000000000000254 - 0x0000000000000274 is .note.ABI-tag
0x0000000000000274 - 0x0000000000000298 is .note.gnu.build-idNext I set a breakpoint at entry point by b *0x4f0
Code:(gdb) b *0x4f0
Breakpoint 1 at 0x4f0However, when run debugging, gdb complains Cannot access memory at address 0xf40
Code:(gdb) run
Starting program: /home/jacob/a.out
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x4f0Anything I've done is wrong or I misunderstand?
Thanks for advice.


What I want to accomplish is understand (analyze) what happened to the program that have segment fault.
I follow the tutorial - https://felix.abecassis.me/2012/08/g...pped-binaries/
The program code I use is
Code://#include <stdio.h>
// __attribute__ ((noinline)) void fun(int test)
//{
//printf("value: %d\n", test);
//}
int main()
{
int v = 21;
}and it's complied by gcc myprogram.c. Also strip -s a.out is used to strip off the debug symbols.
Then I launch gdb a.out
Using info file to find the entry point, which looks like
Code:(gdb) info file
Symbols from "/home/jacob/a.out".
Local exec file:
`/home/jacob/a.out', file type elf64-x86-64.
Entry point: 0x4f0
0x0000000000000238 - 0x0000000000000254 is .interp
0x0000000000000254 - 0x0000000000000274 is .note.ABI-tag
0x0000000000000274 - 0x0000000000000298 is .note.gnu.build-idNext I set a breakpoint at entry point by b *0x4f0
Code:(gdb) b *0x4f0
Breakpoint 1 at 0x4f0However, when run debugging, gdb complains Cannot access memory at address 0xf40
Code:(gdb) run
Starting program: /home/jacob/a.out
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x4f0Anything I've done is wrong or I misunderstand?
Thanks for advice.