PDA

View Full Version : "Bad Address" shown for passed in arguments



lhartzman
12-04-2007, 01:01 PM
I was stepping through some code and into a routine that was being passed 3 "float *" arguments. Upon entry into the function the stack frame display(?) showed the 3 arguments as having a "Bad address". I had examined the 3 arguments from the caller and everything was fine.

Just to double check things I went ahead and put in a printf with the 3 arguments and printed out their addresses. All were fine. Why did TotalView show "bad address" for them?

Thanks.

Les

PeterT-RogueWave
12-05-2007, 03:44 AM
Lee,

I see you've put in a few questions, so I don't know what order you may be seeing these in. I just replied to one about missing local variables with a guess you are debugging code that was compiled with optimization. That may well explain the 'bad addresses' that you see while debugging. Although the printing of the addresses and them showing as okay sounds a bit odd with that explanation. If it's not optimization, we are likely receiving bad debug information from the compiler, or mis-interpreting the debug info we see. Which compiler are you using?

lhartzman
12-05-2007, 09:59 AM
Pete,

I'm using the Intel C/C++ compiler, version 9.0. The 2 flags I'm using are -g and -xW (for P4 -specific code). The -xW flag seems to pull in some additional libraries that aren't linked in otherwise.

Les

lhartzman
12-05-2007, 12:46 PM
I've rebuilt without the -xW optiion (had to add in an extra library to the link stage). The "bad address" is now gone. I think I've also now got more local variables visible in the stack frame pane.

Les