On Sun, 20 Sep 1998, George wrote:
> On Sat, 19 Sep 1998, Tony Robbins [Kupek] wrote:
>
> >Ok, now you know why I'm hating strings. Somehow, in this amount of code:
> >
> >(from read_aliases(), standard alias package)
> > /* get alias file name */
> > log(GET_NAME(ch));
> > get_filename(GET_NAME(ch), pcFileName, ALIAS_FILE);
> >
> >the log() works fine, but get_filename insists that GET_NAME(ch) is
> >NULL/0x0.
>
> Are you sure that it's GET_NAME() that is NULL and not the others?
>
Yes. See debugger output below.
> > CREATE(victim, struct char_data, 1);
> > clear_char(victim);
> > if (load_char(vict, &tmp_store) > -1) {
> > store_to_char(&tmp_store, victim);
> > if (GET_LEVEL(victim) <= GET_LEVEL(ch)) {
> > victim->next = character_list;
> > character_list = victim;
> > victim->desc = NULL;
> > char_to_room(victim, ch->in_room);
> > read_aliases(victim); <---- crashes here.
>
> Looks about normal. GDB backtrace/info locals/list available?
Backtrace says :
#0 get_filename (orig_name=0x0, filename=0xbffff188 "\f@E\001", mode=2)
at utils.c:454
#1 0x80c2f21 in read_aliases (ch=0x859aad8) at alias.c:87
#2 0x8073245 in do_playerlink (ch=0x859a4f0,
argument=0xbffffa9e " load kupek", cmd=188, subcmd=0) at act.wizard.c:3297
#3 0x8086063 in command_interpreter (ch=0x859a4f0,
argument=0xbffffa94 "playerlink load kupek") at interpreter.c:672
#4 0x804a3ce in game_loop (mother_desc=3) at comm.c:807
#5 0x8049aba in init_game (port=4000) at comm.c:402
#6 0x8049a29 in main (argc=3, argv=0xbffffdfc) at comm.c:363
Info locals (inside get_filename)
orig_name = 0x0
mode = 2
prefix = 0x80e1e97 "plrfiles/"
middle = 0x0
suffix = 0x80e1eab "alias"
name = "\200_\021\bH_K\a@\200_\021\b\000\000\000\000pu\r@\020\a@\200_\021\by\035\016\b\\l\030<\n\b\200_\021\b\200_\021\by\035\016\bY\b"
ptr = 0x8115f80 "\204,-"
List
449 break;
450 default:
451 return (0);
452 }
453
454 if (!*orig_name) <--- crashes here. This is a symptom though,
not the bug itself.
455 return (0);
456
457 strcpy(name, orig_name);
458 for (ptr = name; *ptr; ptr++)
On a successful load of a character, the debugger says:
81 FILE *ptFHndl;
82 struct alias_data *pstAliasRec;
83 int iLen;
84
85 /* get alias file name */
86 log(GET_NAME(ch));
87 get_filename(GET_NAME(ch), pcFileName, ALIAS_FILE);
88
89 /* open alias file */
90 ptFHndl = fopen(pcFileName, "r");
At the log statement, ch->player.name is "Belgarath"
ch = (struct char_data *) 0x859a670
pcFileName = "8c\004@8\003@\004\000\000\000p\000@E\237\000@\001\000-EEEEAEA", '\000' <repeats 20 times>,
"\b\204\004\b|I\016\b0\217\004\b\000\000^\220\035\r\b\224\002R\004\b,\223Y\b\220\035\r\b\000\000\000\000\000\000\000\000\217Y\b\000\000"
ptFHndl = (_IO_FILE *) 0x0
pstAliasRec = (struct alias_data *) 0x0
iLen = 307
(gdb) print ch->player.name
$2 = 0x859a9e8 "Belgarath"
pcFileName is garbage like that because it's never initialized, I believe.
Anyway, that's a successful run.
Same lines as before, at the log statement:
Breakpoint 1, read_aliases (ch=0x859ac58) at alias.c:86
86 log(GET_NAME(ch));
(gdb) print ch->player.name
$3 = 0x859afe8 "Kupek"
(gdb) continue
And next, the infamous:
87 get_filename(GET_NAME(ch), pcFileName, ALIAS_FILE);
Program received signal SIGSEGV, Segmentation fault.
get_filename (orig_name=0x0, filename=0xbffff180 "\f@ ", mode=2)
at utils.c:454
454 if (!*orig_name)
Sorry for the huge message, but this is about all the information I've
got. Also, if I change that !*orig_name to orig_name == NULL ||
!*orig_name, I get past this point, but then when playerlink does an act()
involving the linkloaded character, it crashes again. Where is this guy
getting corrupted ?
-B.
+------------------------------------------------------------+
| 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