Path: chuka.playstation.co.uk!scea!sumner From: sumner@austin.metrowerks.com (Joel Sumner) Newsgroups: scea.yaroze.programming.codewarrior,scee.yaroze.programming.codewarrior Subject: Re: Disappearing variables - a better example Date: Mon, 29 Dec 1997 12:29:18 -0600 Organization: Metrowerks Lines: 69 Message-ID: References: <684q0b$9ij5@chuka.playstation.co.uk> <685bje$9ij6@chuka.playstation.co.uk> NNTP-Posting-Host: mtwks167.metrowerks.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Yet Another NewsWatcher 2.4.0 Xref: chuka.playstation.co.uk scea.yaroze.programming.codewarrior:267 scee.yaroze.programming.codewarrior:126 I don't think it's CW trashing the variables. I think it's a problem with the debugger showing global variables. The debugger problem is known and we will have a fix out in about 2 weeks. To isolate the below crash, you can do the following: 1) Generate an XMAP file (go to Linker settings and turn on "Generate MAP file") 2) Rebuild the project and open the XMAP file. Look for bb0 and bb1 variables. This will tell you where they were linked in memory 3) Run the program in the debugger and use the memory window to look at that variable, or select the memory and do a "view memory as..." operation and use a type of "char *". You can then step through the code and see the variable change (if it changes). -Joel In article <685bje$9ij6@chuka.playstation.co.uk>, "Mario Wynands" wrote: >OK, here is some more slightly less obscure source that we should all be >familiar with. > >#include >#include "pad.h" > > >u_long pad_status; // Controller status bitfield >u_long pad_type; > >volatile u_char *bb0, *bb1; // Low level buffers > >void InitialisePad (void) >{ > pad_status = 0; > pad_type = 0; > GetPadBuf(&bb0, &bb1); >} > > >void UpdatePad(void) >{ > pad_status = (~(*(bb0+3) | *(bb0+2) << 8 | *(bb1+3) << 16 | *(bb1+2) << >24)); > pad_type = (~(*(bb0) | *(bb0+1) << 8 | *(bb1) << 16 | *(bb1+1) << 24)); >} > >int PadStatus(void) >{ > return pad_status; >} > >int PadType(void) >{ > return pad_type; >} > > > >UpdatePad crashes on the first line with a "bus error on data load" error, >which seems to indicate to me that something is seriously wrong. > >Any ideas as to why Codewarrior may be trashing my variables? > > >Mario -- PlayStation Development Tools Dude Metrowerks