[DGD] strange segfault

pete at ana.sk pete at ana.sk
Fri Jun 28 10:48:29 CEST 2002


I got strange segfault in dump_object kfun
(-DDUMP_FUNCS defined in Makefile), and it's 
happening only on some objects and only at second 
call to dump_object. Most probably its nothing 
serious, but just for case it may be i caught some 
output from gdb (in attachment) about it. It's dgd 
1.2.47, with some changes i made for me (i admit) 
but none of those changes should affect object or 
control structres. Command leading to this segfault 
was code 
dump_object(find_object("/usr/Lib/obj/player")); 
excuted twice (first one is done without problem, 
second makes segfault).

Pete



-------------- next part --------------
inherits:
  /kernel/lib/auto (0, 0)
  /usr/Lib/lib/lib (1, 6)
  /usr/Lib/lib/api/heartbeat (2, 6)
  /usr/Lib/lib/api/text (2, 7)
  /usr/Lib/lib/object (2, 8)
  /usr/Lib/lib/container (25, 16)
  /usr/Lib/lib/api/combat (44, 18)
  /usr/Lib/lib/living (44, 19)
  /usr/Lib/lib/api/player (52, 21)
  /usr/Lib/lib/api/command (52, 22)
  /usr/Lib/lib/api/channel (52, 23)
  /usr/Lib/obj/player (52, 24)
progsize: 1871
string constants:
...
function definitions:
  0: 00000000 typechecked static void create(varargs int)
  1: 00000028 nomask void __is_player()
  2: 00000034 nomask string query_name()
  3: 00000041 nomask string query_Name()
  4: 0000004e typechecked nomask void set_name(string)
  5: 0000006c typechecked string query_short_desc(varargs int)
  6: 00000088 typechecked string query_short_Desc(varargs int)
  7: 000000a4 typechecked static void set_short_desc(string)
  8: 000000b6 string query_long_desc()
  9: 000000ca typechecked static void set_long_desc(string)
 10: 000000dc typechecked string query_very_short_desc(varargs int)
 11: 000000ec typechecked string query_very_short_Desc(varargs int)
 12: 000000fc typechecked static void set_very_short_desc(string)
 13: 0000010e string ** query_primary_ids()
 14: 00000175 typechecked static void set_primary_ids(string)
 15: 00000187 string * query_prefix_ids()
 16: 00000196 typechecked static void set_prefix_ids(string)
 17: 000001a8 string * query_suffix_ids()
 18: 000001b7 typechecked static void set_suffix_ids(string)
 19: 000001c9 typechecked nomask void set_user(object)
 20: 0000037f int query_brief()
 21: 0000038c typechecked void set_brief(int)
 22: 0000039f string * query_aliases()
 23: 000003cf typechecked string * query_alias(string)
 24: 00000415 typechecked int set_alias(string, string)
 25: 00000472 void reset_aliases()
 26: 000004a7 nomask void heart_beat()
 27: 000004ca nomask void save_player()
 28: 00000507 typechecked nomask void restore_player(string)
 29: 00000569 typechecked void input(string)
 30: 00000696 int prompt()
 31: 000006a2 void cmd_event_quit()
 32: 000006e7 void conn_event_quit()
 33: 00000734 void conn_event_linkdead()
variable definitions:
  0: private static int linkdead_time
  1: private static int creating_state
  2: int created
  3: string name
  4: string Name
  5: int flags
  6: int brief_mode
  7: mapping command_aliases
funcalls:
  0: create(11, 0)
  1: dump_value(1, 12)
  2: query_clone(4, 2)
  3: set_primary_ids(11, 14)
  4: set_short_desc(11, 7)
  5: init_object(4, 3)
  6: simple_mapping_of_arrays_copy(1, 25)
  7: simple_2darray_copy(1, 24)
  8: explode_words(3, 14)
  9: get_string_alt(3, 12)
 10: is_reserved_word(3, 4)
 11: contains_reserved_chars(3, 7)
 12: query_short_desc(11, 5)
 13: escape_chars(3, 16)
 14: get_string_fun(3, 21)
 15: query_primary_ids(11, 13)
 16: query_very_short_desc(11, 10)
 17: query_object_flags(4, 19)
 18: query_environment(4, 6)
 19: query_prefix_ids(11, 15)
 20: query_suffix_ids(11, 17)
 21: query_long_desc(11, 8)
 22: move_object_to(4, 26)
 23: cmd_event_move(7, 19)
 24: set_object_flags(4, 20)
 25: explode_words(3, 14)
 26: query_inventory(5, 3)
 27: get_object_list_groups(3, 18)
 28: internal_get_objects(5, 11)
 29: text_to_cardinal_number(3, 2)
 30: text_to_order_number(3, 1)
 31: get_string_alt(3, 12)
 32: cardinal_number_to_text(3, 0)
 33: get_object_list_desc(3, 19)
 34: implode_list(3, 15)
 35: query_inventory_desc(5, 4)
 36: get_objects_desc(5, 13)
 37: query_very_short_desc(11, 10)
 38: get_string_var(3, 17)
 39: query_inventory_take_message(5, 5)
 40: query_inventories(5, 2)
 41: query_inventory_flags(5, 6)
 42: query_environment(4, 6)
 43: set_inventory_flags(5, 8)
 44: in_fight(6, 0)
 45: query_user(7, 3)
 46: cardinal_number_to_text(3, 0)
 47: query_short_desc(11, 5)
 48: query_short_Desc(11, 6)
 49: query_living_flags(7, 10)
 50: get_output_string(3, 13)
 51: start_fight(6, 1)
 52: query_default_aliases(3, 20)
 53: set_heart_beat(4, 37)
 54: query_user(7, 3)
 55: query_environment(4, 6)
 56: move_object_to(4, 26)
 57: emote_to_channel(10, 10)
 58: get_string_var(3, 17)
 59: query_living_flags(7, 10)
 60: set_living_flags(7, 11)
symbols:
  0: (162) typechecked static void set_suffix_ids(string)
  1: (1) int query_living_flags()
  2: (133) nomask void __is_player()
  3: (51) static int set_heart_beat(mixed)
  4: (4) nomask string query_owner()
  5: (5) typechecked static nomask object get_object(string)
  6: (6) typechecked static object clone_object(varargs string, string)
  7: (7) typechecked nomask void _F_start_event(string, mixed *)
  8: (6) typechecked static nomask int is_container(object)
  9: (9) nomask object _Q_next()
 10: (10) static string * query_reserved_words()
 11: (11) typechecked void object_released(object, string)
 12: (10) typechecked static int is_reserved_word(string)
 13: (12) static string * query_reserved_chars()
 14: (14) typechecked static nomask void raw_output(string)
 15: (115) typechecked static void stop_commands(object)
 16: (16) typechecked void input(string)
 17: (17) typechecked static string get_output_string(varargs string, int, int)
 18: (18) nomask void __is_container()
 19: (14) typechecked static string get_string_alt(varargs string, mixed)
 20: (20) string * query_suffix_ids()
 21: (72) typechecked object internal_get_objects(varargs string, string, mixed, int)
 22: (5) typechecked static nomask string get_object_type_name(string)
 23: (23) typechecked static void set_prefix_ids(string)
 24: (147) int query_object_flags()
 25: (22) typechecked object ** get_object_list_groups(varargs object *, string, int)
 26: (19) typechecked static mixed get_string_var(varargs mixed, mapping)
 27: (27) typechecked static void run_prepared_command(object, int)
 28: (25) typechecked string * get_object_list_desc(varargs object *, string, int, object, object)
 29: (29) typechecked int set_alias(string, string)
 30: (30) typechecked static string exit_to_short(string)
 31: (31) typechecked nomask void _F_rsrc_incr(string, int)
 32: (32) nomask void _F_release(mixed)
 33: (33) object query_user()
 34: (34) void show_prompt()
 35: (35) typechecked static void end_fight(object)
 36: (123) typechecked static void remove_player_from_channel(object, string)
 37: (37) typechecked static string * explode_words(string)
 38: (38) typechecked static string get_subjective_pronoun(object *)
 39: (39) typechecked static mixed * tell_to_channel(object, object *, string, string)
 40: (40) typechecked mixed ** simple_2darray_copy(mixed **)
 41: (106) typechecked static object load_player(string)
 42: (42) typechecked static nomask int is_world_object(object)
 43: (68) typechecked int query_inventory_flags(varargs string)
 44: (180) void conn_event_linkdead()
 45: (45) typechecked static nomask string base_object_name(object)
 46: (46) typechecked static void set_inventory_flags(string, int)
 47: (47) typechecked int move_object_to(varargs mixed, string)
 48: (94) typechecked void room_message(varargs string, object *, object *, int)
 49: (30) typechecked static string get_possessive_pronoun(object *)
 50: (26) static mixed get_string_fun(varargs mixed, mixed)
 51: (51) static nomask object _this_user()
 52: (52) typechecked void raw_message(string)
 53: (53) void cmd_event_look_at()
 54: (31) typechecked static string get_reflexive_pronoun(object *)
 55: (55) typechecked static nomask int is_item(object)
 56: (53) typechecked int cmd_event_moved_from(string, object, object, string)
 57: (57) static nomask void destroy()
 58: (56) typechecked void cmd_event_moved_to(string, object, object, string)
 59: (169) typechecked string * query_alias(string)
 60: (105) typechecked static object find_player(string)
 61: (58) typechecked int cmd_event_fall_from_container(string, object, string)
 62: (62) string * query_inventories()
 63: (62) typechecked object * query_inventory(varargs string)
 64: (64) typechecked string query_room_list_Desc(varargs int)
 65: (65) typechecked nomask void _F_subscribe_event(object, string, string, int)
 66: (66) typechecked static string dump_value(varargs mixed, mapping)
 67: (63) typechecked string query_inventory_desc(varargs string)
 68: (67) typechecked string query_inventory_take_message(varargs string)
 69: (69) int prompt()
 70: (70) typechecked static nomask int is_living(object)
 71: (71) typechecked void release_object(varargs object, string)
 72: (72) static nomask object this_room()
 73: (28) typechecked static string get_objective_pronoun(object *)
 74: (73) typechecked object * get_objects(string, varargs int, string, mixed)
 75: (144) typechecked string query_short_Desc(varargs int)
 76: (76) mapping query_environment()
 77: (114) typechecked static void run_scheduled_commands(object)
 78: (100) static object query_this_player()
 79: (61) typechecked int cmd_event_manipulate(string)
 80: (79) typechecked void cmd_event_look_in(varargs string, int)
 81: (80) typechecked int cmd_event_move_from(string, object, object, string)
 82: (82) typechecked void set_brief(int)
 83: (171) void cmd_event_quit()
 84: (45) typechecked void object_received(object, string)
 85: (81) typechecked int cmd_event_move_to(string, object, string)
 86: (86) typechecked static nomask mixed * io_ps_is(mixed *)
 87: (87) typechecked static string escape_chars(string, string)
 88: (1) typechecked nomask mixed _F_call_limited(mixed, mixed *)
 89: (170) typechecked nomask void restore_player(string)
 90: (32) static void init_object()
 91: (138) nomask string query_Name()
 92: (88) typechecked nomask void _F_next(object)
 93: (93) typechecked static int text_to_order_number(string)
 94: (74) typechecked string get_objects_desc(varargs string)
 95: (85) typechecked int cmd_event_manipulate_inventory(string, string)
 96: (96) nomask void __is_world_object()
 97: (95) int cmd_event_kill()
 98: (98) static mapping query_default_aliases()
 99: (99) nomask int query_clone()
100: (49) typechecked static nomask mixed * io_ps_pi(mixed *)
101: (110) typechecked static int execute_command(string)
102: (13) typechecked static int is_reserved_char(int)
103: (103) typechecked static nomask int is_npc_living(object)
104: (107) typechecked static void drop_player(string)
105: (50) typechecked static nomask mixed * io_ps_pis(mixed *)
106: (106) nomask void _F_destruct()
107: (8) typechecked static nomask int is_container_item(object)
108: (119) typechecked static int is_channel_auto_silencable(string)
109: (92) int query_fighting()
110: (110) typechecked static nomask mixed * io_ps_i(mixed *)
111: (167) void reset_aliases()
112: (112) nomask void __is_living()
113: (113) typechecked int put_object_in(varargs mixed, string)
114: (114) typechecked nomask int is_command_object(object)
115: (115) typechecked int is_object(varargs string, string, object)
116: (158) typechecked static void set_very_short_desc(string)
117: (7) typechecked static nomask int is_room(object)
118: (118) typechecked static int is_channel_automatic(string)
119: (118) typechecked static int is_channel_private(string)
120: (120) typechecked static nomask mixed * io_ps_arr(mixed *)
121: (134) nomask string query_name()
122: (126) typechecked static mixed * emote_to_channel(object, object *, string, string)
123: (123) typechecked static string cardinal_number_to_text(int)
124: (124) typechecked static string get_opposite_exit(string)
125: (125) typechecked static object * get_channel_users(string)
126: (117) typechecked static void execute_immediately(string)
127: (120) typechecked static void add_player_to_channel(object, string)
128: (128) typechecked static string * get_approximate_exits(string)
129: (160) string ** query_primary_ids()
130: (130) typechecked static nomask int is_player(object)
131: (131) static nomask object this_player()
132: (154) typechecked static void set_long_desc(string)
133: (133) typechecked static nomask void output(string)
134: (134) typechecked static int contains_reserved_chars(string)
135: (135) typechecked static void set_living_flags(int)
136: (136) typechecked static int silence_channel(object, string)
137: (137) static nomask object this_user()
138: (138) typechecked static void setup_inventory(string, varargs int, string, string)
139: (139) nomask object _Q_prev()
140: (140) nomask void _F_create()
141: (71) typechecked string receive_object(varargs object, string)
142: (142) typechecked static void show_history(object, string)
143: (143) typechecked static void start_fight(object, object)
144: (139) typechecked string query_short_desc(varargs int)
145: (145) typechecked static nomask void room_output(varargs string, object *, object *, int)
146: (146) typechecked static int in_fight(varargs object, object)
147: (147) typechecked static void set_short_desc(string)
148: (127) typechecked static void create(varargs int)
149: (152) string query_long_desc()
150: (150) typechecked static void purge_player(string)
151: (47) typechecked int take_object_from(varargs mixed, string)
152: (152) typechecked static void remove_heart_beat(object)
153: (153) typechecked nomask void set_name(string)
154: (154) static string * query_channels()
155: (93) typechecked void message(string)
156: (157) typechecked string query_very_short_Desc(varargs int)
157: (157) typechecked string query_very_short_desc(varargs int)
158: (158) typechecked static nomask int is_standard_exit(string)
159: (159) typechecked nomask void _F_callout(string, int, mixed *)
160: (160) static nomask object * players()
161: (161) typechecked mapping simple_mapping_of_arrays_copy(mapping)
162: (162) typechecked static nomask int is_player_body(object)
163: (38) typechecked static void set_object_flags(int)
164: (164) typechecked static string exit_to_long(string)
165: (165) nomask void heart_beat()
166: (165) string * query_aliases()
167: (99) typechecked static void set_this_player(object)
168: (17) typechecked static string implode_list(varargs string *, string, string)
169: (166) typechecked nomask void set_user(object)
170: (170) typechecked static object create_player(string)
171: (97) typechecked int cmd_event_move(string, object, string)
172: (9) typechecked static int text_to_cardinal_number(string)
173: (173) int query_brief()
174: (174) typechecked static void set_primary_ids(string)
175: (161) string * query_prefix_ids()
176: (176) typechecked nomask void _F_prev(object)
177: (177) int query_gender()
178: (125) typechecked static object * get_channel_listeners(object, string)
179: (179) nomask void save_player()
180: (172) void conn_event_quit()
32 variables, 7 ints/floats, 5 int/float defs

inherits:
... (same as above) ...
progsize: 1871
string constants:
... (same as above) ...
function definitions:
... (same as above) ...
variable definitions:
... (same as above) ...
funcalls:
  0: create(11, 0)
  1: dump_value(1, 12)
  2: query_clone(4, 2)
  3: set_primary_ids(11, 14)
  4: set_short_desc(11, 7)
  5: init_object(4, 3)
  6: simple_mapping_of_arrays_copy(1, 25)
  7: simple_2darray_copy(1, 24)
  8: explode_words(3, 14)
  9: get_string_alt(3, 12)
 10: is_reserved_word(3, 4)
 11: contains_reserved_chars(3, 7)
 12: query_short_desc(11, 5)
 13: escape_chars(3, 16)
 14: get_string_fun(3, 21)
 15: query_primary_ids(11, 13)
 16: query_very_short_desc(11, 10)
 17: query_object_flags(4, 19)
 18: query_environment(4, 6)
 19: query_prefix_ids(11, 15)
 20: query_suffix_ids(11, 17)
 21: query_long_desc(11, 8)
 22: move_object_to(4, 26)
 23: cmd_event_move(7, 19)
 24: set_object_flags(4, 20)
 25: explode_words(3, 14)
 26: query_inventory(5, 3)
 27: get_object_list_groups(3, 18)
 28: internal_get_objects(5, 11)
 29: text_to_cardinal_number(3, 2)
 30: text_to_order_number(3, 1)
 31: get_string_alt(3, 12)
 32: cardinal_number_to_text(3, 0)
 33: get_object_list_desc(3, 19)
 34: implode_list(3, 15)
 35: query_inventory_desc(5, 4)
 36: get_objects_desc(5, 13)
 37: query_very_short_desc(11, 10)
 38: get_string_var(3, 17)
 39: query_inventory_take_message(5, 5)
 40: query_inventories(5, 2)
 41: query_inventory_flags(5, 6)
 42: query_environment(4, 6)
 43: set_inventory_flags(5, 8)

Program received signal SIGSEGV, Segmentation fault.
d_get_funcdefs (ctrl=0x0) at sdata.c:745
745         if (ctrl->funcdefs == (dfuncdef *) NULL && ctrl->nfuncdefs != 0) {
(gdb) l 
740      * DESCRIPTION: get function definitions
741      */
742     dfuncdef *d_get_funcdefs(ctrl)
743     register control *ctrl;
744     {
745         if (ctrl->funcdefs == (dfuncdef *) NULL && ctrl->nfuncdefs != 0) {
746             ctrl->funcdefs = ALLOC(dfuncdef, ctrl->nfuncdefs);
747             sw_readv((char *) ctrl->funcdefs, ctrl->sectors,
748                      ctrl->nfuncdefs * (Uint) sizeof(dfuncdef), ctrl->funcdoffset);
749         }
(gdb) bt
#0  d_get_funcdefs (ctrl=0x0) at sdata.c:745
#1  0x080a2154 in showctrl (ctrl=0x402be474) at debug.c:97
#2  0x080a48ce in kf_dump_object (f=0xbfffbd98) at debug.c:665
#3  0x08065321 in i_interpret (f=0xbfffbd98, pc=0x402d7d2e "Y:\037I")
    at interpret.c:1809
#4  0x0806601a in i_funcall (prev_f=0xbfffc018, obj=0x40154200, lwobj=0x0, 
    p_ctrli=2, funci=0, nargs=1) at interpret.c:2153
#5  0x080663eb in i_call (f=0xbfffc018, obj=0x40154200, lwobj=0x0, 
    func=0x402dc0d6 "exec", len=4, call_static=0, nargs=1) at interpret.c:2251
#6  0x08098f79 in kf_call_other (f=0xbfffc018, nargs=3) at std.c:152
#7  0x08065321 in i_interpret (f=0xbfffc018, pc=0x402b98dd "4\0374H")
    at interpret.c:1809
#8  0x08065571 in i_interpret (f=0xbfffc018, pc=0x402b98be "+ý\004\bü\b")
    at interpret.c:1848
#9  0x0806601a in i_funcall (prev_f=0xbfffc208, obj=0x401542c8, lwobj=0x0, 
    p_ctrli=7, funci=4, nargs=3) at interpret.c:2153
#10 0x080663eb in i_call (f=0xbfffc208, obj=0x401542c8, lwobj=0x0, 
    func=0x402d895a "cmd_code", len=8, call_static=0, nargs=3)
    at interpret.c:2251
#11 0x08098f79 in kf_call_other (f=0xbfffc208, nargs=5) at std.c:152
#12 0x08065321 in i_interpret (f=0xbfffc208, 
    pc=0x402b6b0f "Y:\037O\"\t\001\003") at interpret.c:1809
#13 0x0806601a in i_funcall (prev_f=0xbfffc4a8, obj=0x401542c8, lwobj=0x0, 
    p_ctrli=8, funci=2, nargs=2) at interpret.c:2153
...
(gdb) list *0x080a2154
0x80a2154 is in showctrl (debug.c:97).
92              for (i = 0; i < ctrl->nfuncalls; i++) {
93                  control *c2;
94                  dfuncdef *f;
95
96                  c2 = OBJR(ctrl->inherits[UCHAR(ctrl->funcalls[2 * i])].oindex)->ctrl;
97                  f = d_get_funcdefs(c2) + UCHAR(ctrl->funcalls[2 * i + 1]);
98                  printf("%3u: %s(%d, %d)\n", i,
99                         d_get_strconst(c2, f->inherit, f->index)->text,
100                        UCHAR(ctrl->funcalls[2 * i]),
101                        UCHAR(ctrl->funcalls[2 * i + 1]));
(gdb) list *0x080a48ce 
0x80a48ce is in kf_dump_object (debug.c:665).
660             n = f->sp->oindex;
661         } else {
662             n = f->sp->u.array->elts[0].oindex;
663             arr_del(f->sp->u.array);
664         }
665         showctrl(o_control(OBJR(n)));
666         fflush(stdout);
667         *f->sp = nil_value;
668         return 0;
669     }


More information about the DGD mailing list