0

I asked one of the similar question here.

However, the hardware debug interrupt seems pretty limited.

The ideal mechanism I would like to get is the ability to monitoring multiple variables, and once any of them changes the corresponding handler process will be triggered.

The platform is x86-64 system and thanks for anyone's help and time spent on this lol~~

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Shore
  • 827
  • 9
  • 24
  • You could put them all in read-only pages, and then use the page fault handler to dispatch. – Nate Eldredge Jul 30 '21 at 02:14
  • 1
    But this certainly is no way to design a program; there is no way that any such solution will be efficient. If you control the program, you should just rewrite it so that the code which would access the variable instead makes an explicit call to the handler. What's the goal here? Are you trying to instrument some piece of third-party binary code, or something like that? – Nate Eldredge Jul 30 '21 at 02:18
  • @nateeldredge thanks a lot. I'm trying to make a program that has multiple trigger handler in varies of variables (to simulate some hardware) in c. of course by inputting a call can solve the problem. But I will be facing extreme complex interaction of different variables. If it is a trigger, then all of them will be automatic...... – Shore Jul 30 '21 at 02:26
  • And you're willing to incur the cost of a CPU exception every time, with the corresponding switch to kernel mode and back? Probably thousands of clock cycles at minimum. – Nate Eldredge Jul 30 '21 at 02:46
  • @nateeldredge Yes it do increase the cost of CPU....... May be I should think of another way...... – Shore Jul 30 '21 at 03:07

0 Answers0