Possible to trap write to address (x86 - linux)

前端 未结 4 1590
悲哀的现实
悲哀的现实 2020-12-13 11:52

I want to be able to detect when a write to memory address occurs -- for example by setting a callback attached to an interrupt. Does anyone know how?

I\'d like to b

4条回答
  •  爱一瞬间的悲伤
    2020-12-13 12:09

    GDB does have that feature: it is called hardware watchpoints, and it is very well supported on Linux/x86:

    (gdb) watch *(int *)0x12345678
    

    If your application crashes GDB, build current GDB from CVS Head.

    If that GDB still fails, file a GDB bug.

    Chances are we can fix GDB faster than you can hack around SIGSEGV handler (provided a good test case), and fixes to GDB help you with future problems as well.

提交回复
热议问题