Re: Little problem with creating structures.

From: Ronald Fenner (abbadon@mac.com)
Date: 06/28/02


>
>   clear_object(OLC_OBJ(d));
>   OLC_OBJ(d)->name = strdup("unfinished object");
>   OLC_OBJ(d)->description = strdup("An unfinished object is lying
> here.");
>   OLC_OBJ(d)->short_description = strdup("an unfinished object");
>
>   for(counter=0;counter<MAX_WEAPON_SPELLS;counter++) {
>     OLC_OBJ(d)->wpn_spells[counter].text = strdup("$p leaps to action
> with an attack of its own!");
>     OLC_OBJ(d)->wpn_spells[counter].text2 = strdup("In your hands, $p
> leaps to action with an attack of its own!");
>
if this was a copy and paste you might want to go through and change all
the strdup to str_dup and see if that helps looking over my code base
with olc i did not find a single instance of strdup but tons of str_dup.

> However, when this function is called, the mud crashes with the
> following gdb output:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x6108d3e5 in _libkernel32_a_iname ()
>
>
a backtrace of the stack would be nice since it would show you the line
of YOUR code that initiated the crash and would one could concentrate on
that line and figure out what went wrong. just seeing that you called a
library routine wrong and ended up crashing in kernel space doesn't go
very far to pinpointing the problem.

p.s. in case you don't know how to view the stack of function calls in
GDB it's "bt", this will list out all the function calls and current
line position within the function when it jumped.

Ron

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT