[CODE] GDB Help.

From: Justin Adler (spam@WORLD-DOMINATION.COM.AU)
Date: 07/11/02


Hello All.

   When the MUD i program for crashes, i try to use GDB to debug and fix.
Now, this is fine ... but i don't understand the following core
information.

   A mob crashed the mud when it was being freed, and a corpse was going
to be replaced.

   Now, this mob has been killed lots of times before, so i'm not so
suspicious it was the mob, as opposed to a memory leak from some bad
trigger.

   Now if it was a memory leak, GDB tells me that. This time, it's not
telling me that. GDB looks to be fine! Can someone read the following core
dump and explain to me why short_descr failed to be freed?

I just don't get it .... the string that was trying to be freed looks
legit...

-Jussy-


[visions@bb4 visions]$ gg
GNU gdb 4.17.0.4 with Linux/x86 hardware watchpoint and FPU support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `bin/visions 1200'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_files.so.1...done.
Reading symbols from /lib/libnss_nis.so.1...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libnss_dns.so.1...done.
Reading symbols from /lib/libresolv.so.2...done.
#0  0x4007994f in chunk_free (ar_ptr=0x400ce420, p=0x8a65218) at
malloc.c:2959
malloc.c:2959: No such file or directory.
(gdb) bt
#0  0x4007994f in chunk_free (ar_ptr=0x400ce420, p=0x8a65218) at
malloc.c:2959
#1  0x400797c1 in __libc_free (mem=0x8a65220) at malloc.c:2872
#2  0x807e338 in free_char (ch=0x8e16e90) at db.c:2578
#3  0x8096679 in extract_char (ch=0x8e16e90, save_room=-1) at
handler.c:1058
#4  0x808f3ba in execute_deaths () at fight.c:819
#5  0x804a9f4 in heartbeat (pulse=733210) at comm.c:1005
#6  0x804a815 in game_loop (mother_desc=3, client_desc=4) at comm.c:933
#7  0x8049a7b in init_game (port=1200, client_port=1201) at comm.c:403
#8  0x80499eb in main (argc=2, argv=0xbffffda8) at comm.c:370
(gdb) frame 2
#2  0x807e338 in free_char (ch=0x8e16e90) at db.c:2578
2578          free (ch->short_descr);
(gdb) list
2573        if (ch->name && ch->name != mob_proto[i].name)
2574          free (ch->name);
2575        if (ch->title && ch->title != mob_proto[i].title)
2576          free (ch->title);
2577        if (ch->short_descr && ch->short_descr != mob_proto
[i].short_descr)
2578          free (ch->short_descr);
2579        if (ch->long_descr && ch->long_descr != mob_proto
[i].long_descr)
2580          free (ch->long_descr);
2581        if (ch->description && ch->description != mob_proto
[i].description)
2582          free (ch->description);
(gdb) print *ch
$1 = {nr = 993, mob = 0x8e17020, pc = 0x81bffa4, in_room = -1, was_in_room
= -1, name = 0x8a65208 "",
  short_descr =
0x8a65220 "a /cRs/cwp/cRo/cwt/cRt/cwe/cRd/cw /cRF/cwl/cRe/cwn/cRi/cwg/cRa/c
wl/cR /cwb/cRi/cwr/cRd/cx",
  long_descr = 0x8a65280 "A small /cRs/cwp/cRo/cwt/cRt/cwe/cRd
F/cwl/cRe/cwn/cRi/cwg/cRa/cwl b/cRi/cwr/cRd/c0 flitters about.\r\n",
  description = 0x8a652f0 "   Flapping her wings about, flitting her head
from side to side, the bird\r\nmerrily keeps hunting for food...\r\n",
title = 0x0, exit_text = 0x8a653a8 "corpse", sex = 2 '\002', class =
0 '\000', level = 2 '\002',
  race = 3 '\003', weight = 1, height = 198, energy = 26, energy_gain =
22, energy_saved = 0, energy_bonus = 0,
  real_abils = {str = 11 '\013', intel = 11 '\013', wis = 11 '\013', dex =
11 '\013', con = 11 '\013', cha = 11 '\013'},
  aff_abils = {str = 11 '\013', intel = 11 '\013', wis = 11 '\013', dex =
11 '\013', con = 11 '\013', cha = 11 '\013'},
  hit = -21, max_hit = 71, move = 77.4000015, max_move = 100, armor = 0,
wounds = 0, gold = 0, bank_gold = 0, exp = 133,
  hitroll = 0 '\000', damroll = 0 '\000', fighting = 0x0, hunting = 0x0,
riding = 0x0, ridden_by = 0x0,
  position = 0 '\000', carry_weight = 0, carry_items = 0 '\000', timer =
0, alignment = 0, idnum = -1, act = 630984,
  affected_by = {1024, 0, 0, 0}, race_innate = 0, apply_saving_throw = {0,
0, 0, 0, 0}, speaking = 0, delay = {num = 0,
    brk = 0, hit = 1, buf = 1, cmd = -1, scmd = 0, vict = 0x0}, affected =
0x0, equipment = {0x0 <repeats 22 times>},
  carrying = 0x0, desc = 0x0, id = 115274, proto_script = 0x0, script =
0x0, next_in_room = 0x0, next = 0x8e16af8,
  next_fighting = 0x0, followers = 0x0, master = 0x0, wounder_id = 0,
spell_power = 0, offences = 0x0, poisons = 0x0,
  mission = 0x0}
(gdb) print ch->short_descr
$2 =
0x8a65220 "a /cRs/cwp/cRo/cwt/cRt/cwe/cRd/cw /cRF/cwl/cRe/cwn/cRi/cwg/cRa/c
wl/cR /cwb/cRi/cwr/cRd/cx"
(gdb) print mob_proto[i].short_descr
$3 = 0x90ecdc0 "a /cyf/cmr/cci/cMen/ccd/cml/cyy /cWko/cLa/cWla/c0"
(gdb) quit
[visions@bb4 visions]$

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