Question with hook-stop command
Amker.Cheng
amker.cheng@gmail.com
Thu Jul 21 02:05:00 GMT 2011
Hi,
In my program, there are several hard coded breakpoint
instructions(bkpt for arm cortex-m processors).
I want to define hook-stop command to skip those bkpt insn and keep
target program running, here is what I've done:
define skip_bkpt
printf "process bkpt"
set $pc += 2
c
end
define hook-stop
set $insn = *(unsigned short *)$pc
if ($insn == 0xbeab) #here 0xbeab is the bkpt insn's encoding
skip_bkpt
end
end
I assume that with these two commands, every time the program
encounters the bkpt(0xbeab) instruction,
gdb will just skip it and continue the target program.
But when running, seems hook-stop(and the continue command) get
executed only once, the GDB output like following:
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
process bkpt
Program received signal SIGTRAP, Trace/breakpoint trap.
0x000022ac in initialise_monitor_handles ()
0x000022ac in initialise_monitor_handles ()
The instruction "0x000022ac" is another bkpt(0xbeab) instruction, Why
the hook-stop not get executed here?
So any suggestions? Thanks very much.
BTW the gdb version info is:
GNU gdb 7.3.50.20110609-cvs
......
This GDB was configured as "--host=i586-mingw32 --target=arm-none-eabi".
--
Best Regards.
More information about the Gdb
mailing list