home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14302 < prev    next >
Encoding:
Text File  |  1992-08-20  |  2.1 KB  |  67 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!munnari.oz.au!uniwa!bilby.cs.uwa.oz.au!nuntius
  3. From: Quinn <quinn@cs.uwa.edu.au>
  4. Subject: Re: MacsBug symbols from assembler code?
  5. Message-ID: <1992Aug21.030941.6506@bilby.cs.uwa.edu.au>
  6. Sender: usenet@bilby.cs.uwa.edu.au
  7. Nntp-Posting-Host: eriodon
  8. Organization: The University of Western Australia
  9. X-Useragent: Nuntius v1.1
  10. References: <1992Aug20.155733.6869@daimi.aau.dk>
  11. Date: Fri, 21 Aug 1992 03:09:41 GMT
  12. Lines: 53
  13.  
  14. In article <1992Aug20.155733.6869@daimi.aau.dk> Peter Andersen,
  15. datpete@daimi.aau.dk writes:
  16. >Am I missing something?
  17.  
  18. Hmm.  I had great fun getting MacsBug symbols working consistently
  19. in my latest Asm project.  Try using the following macro (with
  20. apologies to those people whose systems don't expand tabs
  21. properly)...
  22.  
  23. ----------------------------------------------
  24.     macro
  25.     MacsBug    &Name,&rts:int
  26.     lclc    &oldstr
  27.     gbla    &debug
  28.  
  29.     if &debug then
  30.     
  31.     if &rts then 
  32.     rts                ; force rts in specific cases
  33.     endif
  34.     
  35.     dc.b    &len(&name)+$80        ; length of string + $80 marks symbol
  36. &oldstr    setc    &setting('string')
  37.     string    AsIs
  38.     dc.b    '&upcase(&Name)'    ; define the string AsIs
  39.     string    &oldstr
  40.     align                ; pad to word boundary
  41.     dc.w    0            ; no literals
  42.     
  43.     endif
  44.     
  45.     endm
  46. ----------------------------------------------
  47.  
  48. ... which you invoke as.
  49.         MacsBug         Fred
  50.         MacsBug         Jim,1
  51. at the end of routine Fred that ends in an RTS (or JMP (A0) or
  52. RTD) or routine Jim that doesn't end in one of the above.
  53.  
  54. However theres still the problem of whether MacsBug will actually
  55. see the symbol.  Sometimes it does, sometimes it doesn't.  I'm not
  56. actually sure what it depends on but I think it has something to do
  57. with what code has been executed recently.  One thing that I found
  58. that helps is doing an 'hx' into the heap that the symbol is in.
  59. But if all else fails you can at least search for the symbol string
  60. (-:
  61.  
  62. Quinn "The Eskimo!"      <quinn@cs.uwa.edu.au>     "Support HAVOC!"
  63. Department of Computer Science, The University of Western Australia
  64.   -- MacsBug:  Don't leave home without it.
  65.   -- This macro is for Pascal; converting it to C is left as an
  66.      exercise to the reader.  (-:
  67.