We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a doubt regarding the simulator/debugger tool. In the window displaying the code, one can see that the left-most column would be highlighted green once the line of code is executed. My doubt is, if the code of a particular function is for example the following : void example(char abc){ //Line 1 /*some code*/ } is Line 1 suppose to be executed ? (Will the left column of that particular line be highlighted green?) Interestingly, my observation is that some of the functions in my program has it's first line highlighted while some don't when I execute my program. I am also experiencing weird behavoir when the first line of the function is not executed (ie highlighted green). Using the above example, I call the function .... example(1); .... and pass in a value of 1 as the parameter abc. However, when my program runs to the function code itself, the value of char abc is not 1 eventhough the value passed in is clearly a 1. I might be missing out something. Could anyone possibly provide some reasons for this unexplained behavior. Thank you.
Thank you for your response. Yes I did actually use variable abc within the function itself. But unfortunately the value does not tally. Other than that, I have also observed that certain lines of code in the function are ommited (for no reasons that I know of) when I run my debugger. Meantime I am still working on this problem. Any suggestions are welcomed.
Meantime I am still working on this problem. Any suggestions are welcomed. Set the optimizer level to 1 and see if you can see everything in the debugger. The C51 compiler is an optimizing compiler and is able to figure out if code has no net effect. Similarly, some optimization levels can obfuscate the assembly code associated with a line (or lines) of C code. Jon
I have, on occasion, said unkind words about the compiler when trying to trace things in my ICE. However, in all cases it has been the compiler being 'smart' and combining code which makes the ICE go "huh?". In those cases I have learned just to follow a step ot two in assembly rather than C. I have learned to live with and expect these tricks when using the default optimization and now we are friends again. It would be totally wrong to optimize at different levels for debug and production (you never know what will happen) so there are 3 options: total source compliance in the ICE - slow bulky code optimal optimization - next to impossible ICE stepping default optimization - an excellent compromise. Erik