This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Implementation of different software breakpoint kinds in gdb server
- From: Michal Lesniewski <m dot lesniewski at samsung dot com>
- To: gdb at sourceware dot org
- Date: Thu, 18 Oct 2012 11:22:35 +0200
- Subject: Implementation of different software breakpoint kinds in gdb server
Hi All,
I have been recently analyzing parts of GDB server code. I focused mainly on
the ARM specific code and checked if it is possible to add tracepoint
support for this architecture. I found out that there is a lot of work to do
that but that's not the point. The main problem is the internal
implementation of software breakpoints.
The most general type of tracepoints are trap tracepoints (created using the
trace command). These are implemented internally using software breakpoints.
Software breakpoints are set by simply overwriting the instruction, at which
the program should stop, by a trap instruction or illegal instruction. When
the processor reaches the instruction, a exception occurs and gdbserver
handles it.
Now the problem is that gdbserver always uses the same trap/illegal
instruction code. The functions in mem-break.c do not provide any way to
allow using different kinds of trap instructions depending on some
additional parameters. On most architectures this is OK, but on ARM there
are two instruction sets - ARM (32 bit) and Thumb (mixed 16 and 32 bit).
Depending on the instruction set used at a specific address, the trap
instruction should be different.
I was wondering if anybody was already considering to extend the code in
mem-break.c to add support for different kinds of breakpoints.
Best Regards,
Michal Lesniewski