I have an executable file I put together from an demo powerpc assembly program I whipped together.
AssemblyProgram.s
.global _Start
.text
_Start:
addi 3, 0, 0xa
addi 4, 0, 0xb
addi 5, 0, 0xc
b .
All it does is load hex a, b, c into registers 3, 4, and 5. When I go to step through it in GDB, I am trying now to set a breakpoint on the instruction b . which is located at address 0x1000012 due to the linker script placement of the instructions.
I can set the breakpoint no problem, but when try to continue I get an error. My example session is shown below:
(gdb) target sim
Connected to the simulator.
(gdb) load assem-ABCRegs-ppceabi-ex.elf
(gdb) x /4i 0x1000000
0x1000000 <_Start>: li r3,10
0x1000004 <_Start+4>: li r4,11
0x1000008 <_Start+8>: li r5,12
0x100000c <_Start+12>: b 0x100000c <_Start+12>
(gdb) b *0x1000000
Breakpoint 1 at 0x1000000
(gdb) run
Starting program: /home/default/PPC-Baremetal-Base/assem-ABCRegs-ppceabi-ex.elf
Breakpoint 1, 0x01000000 in _Start ()
(gdb) si
0x01000004 in _Start ()
(gdb) b *0x1000012
Breakpoint 2 at 0x1000012
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x1000012
(gdb) si
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x1000012
(gdb) d 2
(gdb) si
0x01000008 in _Start ()
(gdb) si
0x0100000c in _Start ()
(gdb)
This is a trivial program, but it is just a learning program. I want to be able to set a breakpoint on a real program and continue (not step) through the execution until my breakpoint is hit if ever. Is this possible if I am not able to recompile?
EDIT:
The above test run tries to set a breakpoint at the wrong locations (in the middle of an instruction. Below is a proper run.
(gdb) target sim
Connected to the simulator.
(gdb) load assem-ABCRegs-ppceabi-ex.elf
(gdb) b *0x1000008
Breakpoint 1 at 0x1000008
(gdb) c
Starting program: /home/default/PPC-Baremetal-Base/assem-ABCRegs-ppceabi-ex.elf
0x1000000 in _Start ()