home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!macro32
- From: Arne Vajhxj <ARNE@ko.hhs.dk>
- Newsgroups: vmsnet.internals
- Subject: Re: Why does this code crash with ACCVIO?
- Message-ID: <01GS824V1BIA8WW79H@kopc.hhs.dk>
- Date: 12 Dec 1992 09:43:15 +0100
- Organization: Macro32<==>Vmsnet.Internals Gateway
- X-Gateway-Source-Info: Mailing List
- Lines: 82
-
- > I apologize if the question is trivial/stupid; my VAX architecture knowledge
- > is rusty. I also had trouble deciding which vmsnet newsgroup should I post it
- to:
- > I selected .internals because all other newsgroups seemed less appropriate.
-
- To use that logic, then you must know for a fact, that there is an appropriate
- vmsnet group for your question :-)
-
- > I have the following C code in my program:
- >
- > for (i = 0; (i<SYMBOL_NAME_SIZE - 1) && (*source != '\0'); i++)
- > *dest++ = *source++;
- >
- > which, when compiled (using gcc 1.39) results in :
- >
- > %SYSTEM-F-ACCVIO, access violation, reason mask=04,
- > virtual address=175C4, PC=25C8A,PSL=03C00000
- >
- > The machine code that generates the error is
- >
- > 025C8A: movb (r1), (r0)
- >
- > with r0=95684(=0x175c4), r1=94591.
-
- > TFM says that reason mask 04 (4(dec) = 0100(bin), so that bit 2 is
- > on ?) means that I attempted a read-modify operation---am I right
- > here? But the source and destination addresses do not seem to
- > overlap, so why exactly does my computer complain?
-
- As several other answers has pointed out, then this error is a ordinary
- write access-violation, which means that *dest is not valid for writing.
- Why it is not valid for writing depends a lot on the rest of the code !!!!
-
- > I can manually deposit values at
- > location pointed to by dest/r0 (using debugger 'deposit *dest=...'),
- > so it is not a invalid address.
-
- But now for the interesting !
-
- The above test do NOT test what you think it tests at all !
-
- The debugger is capable of depositing values in NOWRT psects !
-
- Small example:
-
- $ fortran/obj=z sys$input
- PROGRAM Z
- CALL DUMMY(1)
- END
- *
- SUBROUTINE DUMMY(I)
- WRITE(*,*) I
- RETURN
- END
- $
- $ link z
- $ define/nolog/user dbg$process NONE
- $ run/debug z
- set mode noscreen
- dep 512=2
- go
- exit
- $ exit
-
- (And for the less FORTRAN knowledgable: constants are passed by reference and
- the $PDATA psect is NOWRT !)
-
- This little feature has been around for all the VMS versions I have
- used and can be quite usefull.
-
- I once got the explanation that it is due to the fact, that the NOWRT
- psect actually means user-mode:readonly and the debugger runs in
- supervisor-mode !
-
- Does anyone know if this stuff is documented anywhere ?
-
- Arne
-
- Arne Vajhxj local DECNET: KO::ARNE
- Computer Department PSI: PSI%23831001304030::ARNE
- Business School of Southern Denmark Internet: ARNE@KO.HHS.DK
-
-