Re: Weapon skill questions

From: Admin of The Keep (dkoepke@california.com)
Date: 10/10/96


On Thu, 10 Oct 1996 zizazat@cedarnet.com wrote:

> SA>-     if (!IS_NPC(ch) {
> SA>-        if (GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) != TYPE_PIERCE -
> SA>- TYPE_HIT) {
> 
> SA>If you're not wielding anything, GET_EQ(ch, WEAR_WIELD) is null, so the
> SA>GET_OBJ_VAL macro will segfault.  GDB will catch little mistakes like this
> SA>every time :)
> 
> I should learn how to use GDB I guess. I tried it a few times, but it
> did not make much sense. I do not suppose that anyone has some good tips
> on using such a thing?
> 
> So, should I move the (!wielded) check up to the top or what?

  GDB is simple. :)  The commands you need are 'backtrace', 'list',
  and occassionally 'print'.  Backtrace shows the path the MUD went
  through just before it crashed which often helps you pinpoint exactly
  where the MUD crashed at; list allows you to list a function or a
  line number (for instance, ``list do_score'' will list the do_score
  function, ``list 245'' will list line 245 [with context], ``list'' by
  itself continues listing a few lines at a time...  Print is kind of
  useful depending upon what migfht have caused the crash.  It allows
  you to print out variables.  All ofthis information, of course, is
  availible via the internal help system of GDB.

  As for the latter question, I have two things to say.  The first being
  you do, of course, have to make sure that it's NULL before you try to
  use it; so yes, check that it's got something in it.  Second, if you
  already have 'wielded' why are using GET_EQ(ch, WEAR_WIELD) instead of
  wielded?


  <*=-+Daniel+-=*>
  "Forgive me father, for I am sin."


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST