This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/15299] Verify breakpoint bytes when removing the breakpoint
- From: "jan.kratochvil at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Mon, 25 Mar 2013 12:22:28 +0000
- Subject: [Bug gdb/15299] Verify breakpoint bytes when removing the breakpoint
- Auto-submitted: auto-generated
- References: <bug-15299-4717 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=15299
--- Comment #8 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2013-03-25 12:22:28 UTC ---
(In reply to comment #7)
> Hmm... Maybe I can write a GDB plugin that doing many "stepi" and checks each
> instruction working with RAM on the subject of whether it is trying to read or
> write from/to position of software breakpoints. And if it do so, plugin
> interrupts this "stepi-check_opcode" loop.
I see it overcomplicated. Just patch default_memory_remove_breakpoint in
gdb/mem-break.c so that it:
* Temporarily sets show_memory_breakpoints.
* Uses target_read_memory to fetch the data from inferior.
* Compares the read in bytes with what gdbarch_breakpoint_from_pc returns
and if it does not match it prints some warning and prevents the current
call of target_write_raw_memory with shadow_contents.
* Restores show_memory_breakpoints (see make_show_memory_breakpoints_cleanup).
And it should be configurable as it will be a performance hit primarily with
remote targets.
See also several *-tdep.c files using set_gdbarch_memory_remove_breakpoint as
they have something more specific than default_memory_remove_breakpoint.
> Why does my program in assembler
> does not overwrite the bytes of software breakpoint?
* GDB inserts breakpoint:
* GDB saves original (old) instruction.
* GDB writes there breakpoint
* Your code overwrites the breakpoint by new instruction.
* GDB removes breakpoint:
* GDB writes there the original (old) instruction.
- Your new instruction is lost.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.