Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mathieu Lacage <Mathieu.Lacage@sophia.inria.fr>
To: gdb@sourceware.org
Subject: placing a breakpoint at a physical address on x86 with gdb
Date: Fri, 12 Jan 2007 11:42:00 -0000	[thread overview]
Message-ID: <1168602087.2789.35.camel@garfield.inria.fr> (raw)

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
-- 


             reply	other threads:[~2007-01-12 11:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12 11:42 Mathieu Lacage [this message]
2007-01-12 12:48 ` Mathieu Lacage
2007-01-12 13:46   ` help string for "break" command Mathieu Lacage
2007-01-12 13:49     ` Daniel Jacobowitz
2007-01-12 14:20       ` Mathieu Lacage
2007-01-12 14:26         ` Daniel Jacobowitz
2007-01-12 14:27         ` Bob Rossi
2007-01-12 14:34           ` Mathieu Lacage
2007-01-12 18:11       ` mathieu lacage
2007-01-12 23:26         ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1168602087.2789.35.camel@garfield.inria.fr \
    --to=mathieu.lacage@sophia.inria.fr \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox