Re: Stupid Compiler Tricks

From: Akuma/Chris Baggett/DOOMer (doomer18@EARTHLINK.NET)
Date: 05/14/98


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.
>


Sounds like a buffer overflow error I had once.
I would type 'show zones' (we had a lot more than the buffer could handle)
and it would always crash.
Attempting to debug (in my early days I didn't know what called
mobile_activity) would give me code from mobile_activity() somewhere
around where it checks IS_NPC().

Attempting to print variables would result in the same error.

All I can say, is go through and check the buffer sizes on things
you may use to page_string() or so.  Increase them, and move on.
Hopefully you'll find it, good luck :-)

Code On
Akuma the Raging Coder

  +----------------------------------------------------------------+
  |     "Yea, though I code in the Valley of the Shadow of No      |
  | Documentation, I will fear no task: for thy C Book is with me" |
  |          "Nothing is IMPOSSIBLE, Just IMPROBABLE"              |
  |     "Easier Said Than Done, But Better Done Than Said..."      |
  +----------------------------------------------------------------+


     +------------------------------------------------------------+
     | 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