Force software breakpoint on read-only memory

Mathieu Tarral <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <UpeoDeMdWlsVJSDXnbjmxHp8zp3Qx_idZKmlMb5AElmjUCmP7cMVlZJSRhhgpoKUqTPFSVGBAuiyYnlu8PkQnA_1cjC6gGwELiT5pQqXPGY=@protonmail.com>
Hi,

I'm trying to set a software breakpoint on a read-only memory page.
GDB automatically sets the breakpoint as hardware, but I would like to
keep using software breakpoints.

I found the `set breakpoint auto-hw off option in` in the
documentation:
"If the target provides a memory map, GDB will warn when
trying to set software breakpoint at a read-only address."

However, even when I set it, GDB gives me a warning and my command is aborted:

$ gdb -x gdbinit ~/tmp/ntoskrnl.exe
0x80545c9f in ?? ()
(gdb) set breakpoint auto-hw off
(gdb) b NtOpenFile
Breakpoint 1 at 0x4a30b1
(gdb) continue
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot set software breakpoint at read-only address 0x4a30b1

Command aborted.
(gdb)



My stub interacts directly with the guest hardware, from the
hypervisor, so I can bypass the read-only protections.
That's why i wanted to force the software breakpoint
and ignore the memory map.

Is this a bug in GDB ?

Thanks !
--
Mathieu Tarral

Sent with ProtonMail Secure Email.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.