home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / programm / 6064 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.4 KB

  1. Path: sparky!uunet!ug!daniel
  2. Newsgroups: comp.unix.programmer
  3. Subject: Re: need help with UNIX/SPARC/ptrace() single stepping...
  4. Message-ID: <1993Jan28.003904.2840@ug.eds.com>
  5. From: daniel@ug.eds.com (Daniel Dignam)
  6. Date: 28 Jan 93 00:39:03 PDT
  7. References: <C1J6FL.4no@unccsun.uncc.edu>
  8. Nntp-Posting-Host: 134.244.153.166
  9. X-Newsreader: TIN [version 1.1 PL6]
  10. Lines: 26
  11.  
  12. I hacked up something that did something simlar to this once. It provided a way 
  13. of checking tah all writes and reads where to valid memory addresses. I took a 
  14. different approach.
  15.  
  16. Basically, you replace malloc with rou own written on top of memory mapping.
  17. Then write protect the pages. Then every time a write is made you get an access
  18. violation. Trap this, look at the data your given, the faulting address will be
  19. one of these. Once you've logged the reference, return from you signal handler to 
  20. restart the faulting instruction.
  21.  
  22. This seemed to work fine, it was however very slow in our application, so as a 
  23. form of total paranoia it wasn't very useful. But it was an interesting hack.
  24.  
  25. You should be able to read protect pages as well, so this should cover all 
  26. references to allocated memory. It doesn't however cover references to stack, 
  27. or program data. Although the later could be done in a similar manner to 
  28. allocated memory.
  29.  
  30. --
  31.  
  32. Daniel Dignam  
  33.  
  34. Internet: daniel@sdl.ug.eds.com
  35.     UUCP: {uunet,uupsi}!ug!daniel
  36.  
  37.  
  38.