This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

placing a breakpoint at a physical address on x86 with gdb


hi,

I would like to place a breakpoint at a physical address only within a
single process: the idea is that I would like to be able to place a
single breakpoint to catch every call to a given function which could be
mapped at different virtual addresses within a single process.

As far as I can tell, x86 debug registers are of no help since they are
specified to interpret the breakpoint address before any virtual to
physical address translation happens. So, I would need to place multiple
local breakpoints, one for each address at which my function is mapped. 

Another way would be to map my function multiple times in memory but
manage to mark each mapping to shared the same underlying physical
memory and then insert an int3 breakpoint in the underlying physical
memory. However, I do not see any way to do this with the existing mmap
syscall: its MAP_PRIVATE flag will make each mapping independent of the
others (which is not what I want) while its MAP_SHARED will potentially
modify the underlying file when I insert the int3.

Yet another alternative would be to create a shared memory segment with
shm_open, copy the code of my function in there, create multiple memory
mappings with mmap (MAP_SHARED) on that shared memory segment and insert
an int3 in the shared memory segment whenever needed.

Is there anyone who could think of other, simpler, alternatives ?

Mathieu
-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]