Try removing your compiler optimization flags. One optimization
technique is to combine two variables that are not used at the
same time into one location - this makes data needs smaller and
makes your code harder to debug. Perhaps this is what you're
running up against.
Debugging optimized code can be an interesting experience.
At 12:17 PM 5/14/98 -0500, you wrote:
>I've had the strangest thing happen to me while troubleshooting code
>recently. I worked around it the first time, but tis is something that
>definitely needs fixing.
>
>What is happening is that I'm adding variables and code to an existing
>function (mobile_activity) which when compiled are completely ignored.
>Dong an "info locals" in gdb doesn't show my variables, and if I try to
>print them, I'm told there aren't any variables of that name in this
>context. Strangely, the code shows up as expected when I "list" it, and
>if I pass the variables to functions, they're passed as 0.
>
>Here's a specific example. I'm adding a dragon breath feature where I
>need to check each mob for it's dragon type, which I then pass to the
>dragon_breath() function if the mob is a dragon and fighting. I'm using
>mob
>flags to set dragon type so I don't have to do anything with the mob
>files.
>
>In mobile_activity(), I added int dragon_type. A little ways down,
>dragon_type is found by doing some bit shifting (I'm using 5 mob flag bits
>to allow for 31 dragon types). If the dragon type is valid and the mob is
>fighting, I call dragon_breath(ch, dragon_type).
>
>Now, when this code runs, it acts as if dragon_type is always 0. I've
>doublechecked my math to make sure it's correct. GDB tells me dragon_type
>doesn't exist in mobile_activity.
>
>Any ideas about what's going on here?
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST