View Issue Details

IDProjectCategoryView StatusLast Update
0000491LDMud 3.2LPC Compiler/Preprocessorpublic2007-10-06 21:30
Reporterzippo Assigned Tolars 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.13 
Fixed in Version3.2.16 
Summary0000491: x86_64 crasher before it's done loading
DescriptionThis is for 3.2.14.

% gdb --core=core.1 ~/bin/ldmud-3_2_14_EOTL_0
Using host libthread_db library "/lib/libthread_db.so.1".

warning: core file may not match specified executable file.
Core was generated by `/home/mud/bin/ldmud-3_2_14_EOTL_0 --debug-file ../Debug.log.p --gcollect-outfd'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0 0x000000000048aa86 in read_long (offset=140733193388032) at prolang.y:1403
1403 GET_LONG(l, dest);
(gdb) bt
#0 0x000000000048aa86 in read_long (offset=140733193388032) at prolang.y:1403
0000001 0x0000000000493399 in yyparse () at prolang.y:4930
0000002 0x000000000049074e in compile_file (fd=7) at prolang.y:12804
0000003 0x00000000004a76c5 in load_object (lname=0x6fa0e0 "secure/simul_efun/simul_efun", create_super=0, depth=0,
    chain=0x0) at simulate.c:1876
0000004 0x00000000004a8243 in lookfor_object (str=0x9a3c6d0 "/secure/simul_efun/simul_efun", bLoad=1) at simulate.c:2289
0000005 0x0000000000454053 in eval_instruction (
    first_instruction=0xbe237f "\a9\a:\205\002\002\001d\001&Y4\a;ô\a<\034\001(\a7(ô\035", initial_sp=0x601ee0)
    at interpret.c:15732
0000006 0x00000000004a54b6 in catch_instruction (flags=0, offset=8, i_sp=0x73dc70,
    i_pc=0xbe237f "\a9\a:\205\002\002\001d\001&Y4\a;ô\a<\034\001(\a7(ô\035", i_fp=0x601ed0) at simulate.c:478
0000007 0x0000000000441b4f in eval_instruction (first_instruction=0xbe2373 "S", initial_sp=0x601ee0) at interpret.c:7908
0000008 0x000000000045f64c in apply_low (fun=0xa233c0 "get_simul_efun", ob=0xbaf5a0, num_arg=0, b_ign_prot=1)
    at interpret.c:21684
0000009 0x000000000045f89f in sapply_int (fun=0xa233c0 "get_simul_efun", ob=0xbaf5a0, num_arg=0, b_find_static=1)
    at interpret.c:21796
0000010 0x000000000045fe9f in apply_master_ob (fun=0xa233c0 "get_simul_efun", num_arg=0, external=0) at interpret.c:22084
0000011 0x00000000004aedd1 in get_simul_efun_object (require=1) at simul_efun.c:200
0000012 0x0000000000472194 in main (argc=5, argv=0x7fff16c736d8) at main.c:506
TagsNo tags attached.

Activities

zippo

2006-11-13 18:15

reporter   ~0000520

/* Function : strfage **
** Arguments : string fmt is the format string as described in **
** documentation, time is a integer representing how many **
** seconds. **
** Description: string_time() meets strftime(). **
** Returns : Return a string based on a time value given. If no **
** string is found, 0 is returned. */
string
strfage(string fmt, int t)
{
  int days, hours, minutes, seconds, i, j, k;
  string out;
  if( !stringp(fmt) )
  {
    raise_error("Bad argument 1 to strfage.\n");
    return 0;
  }
  out = "";
  days = t / ( 60 * 60 * 24 );
  t %= ( 60 * 60 * 24 );
  hours = t / ( 60 * 60 );
  t %= ( 60 * 60 );
  minutes = t / 60;
  seconds = t % 60;
  for(i=0,j=strlen(fmt);i<j;i++)
  {
    if( fmt[i] != '%' )
    {
      out += sprintf("%c", fmt[i]);
      continue;
    }
    switch( fmt[i+1] )
    {
      case '%' : out += "%";
                 break;
      case 'D' : if( fmt[i+2] != '[' )
                 {
                   if(days==1) out += " day ";
                   else if(days>1) out += " days ";
                 }
                 else
                 {
                   k = strstr(fmt, "]", i);
                   if(k==-1) raise_error("ERROR strfage(): Error in "
                     "format string.\n");
                   else if(days) out += fmt[i+3..k-1];
                   i = k-1;
                 }
                 break;
      case 'd' : if(days) out += to_string(days);
                 break;
      case 'H' : if( fmt[i+2] != '[' )
                 {
                   if(hours==1) out += " hour ";
                   else if(hours>1) out += " hours ";
                 }
                 else
                 {
                   k = strstr(fmt, "]", i);
                   if(k==-1) raise_error("ERROR strfage(): Error in "
                     "format string.\n");
                   else if(hours) out += fmt[i+3..k-1];
                   i = k-1;
                 }
                 break;
      case 'h' : if(hours) out += to_string(hours);
                 break;
      case 'M' : if( fmt[i+2] != '[' )
                 {
                   if(minutes==1) out += " minute ";
                   else if(minutes>1) out += " minutes ";
                 }
                 else
                 {
                   k = strstr(fmt, "]", i);
                   if(k==-1) raise_error("ERROR strfage(): Error in "
                     "format string.\n");
                   else if(minutes) out += fmt[i+3..k-1];
                   i = k-1;
                 }
                 break;
      case 'm' : if(minutes) out += to_string(minutes);
                 break;
      case 'S' : if( fmt[i+2] != '[' )
                 {
                   if(seconds==1) out += " second";
                   else if(seconds>1) out += " seconds";
                 }
                 else
                 {
                   k = strstr(fmt, "]", i);
                   if(k==-1) raise_error("ERROR strfage(): Error in "
                     "format string.\n");
                   else if(seconds) out += fmt[i+3..k-1];
                   i = k-1;
                 }
                 break;
      case 's' : if(seconds) out += to_string(seconds);
                 break;
      default : raise_error("Incorrect type " + sprintf("%c", fmt[i]) +
                  " to strfage.\n");
                return 0;
                break;
    }
    i++;
  }
  return out;
}

zippo

2006-11-13 18:16

reporter   ~0000521

It barfs at the end of this function. Still digging...

zippo

2006-11-13 18:39

reporter   ~0000522

upd_long() and read_long() both say, in the comments, that they are dealing with 4-byte numbers, but SIZEOF_LONG on my platform is 8.

zippo

2006-11-13 18:42

reporter   ~0000523

Indeed, this fixed it for me:

Index: prolang.y
===================================================================
RCS file: /home/mud/cvsroot/driver/src/prolang.y,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 prolang.y
--- prolang.y 24 Aug 2005 15:46:06 -0000 1.1.1.16
+++ prolang.y 13 Nov 2006 23:39:49 -0000
@@ -1375,7 +1375,7 @@

 /*-------------------------------------------------------------------------*/
 static void
-upd_long (mp_uint offset, long l)
+upd_long (mp_uint offset, int l)

 /* Store the 4-byte number <l> at <offset> in the A_PROGRAM are in
  * a fixed byteorder.
@@ -1389,7 +1389,7 @@
 } /* upd_long() */

 /*-------------------------------------------------------------------------*/
-static long
+static int
 read_long (mp_uint offset)

 /* Return the 4-byte number stored at <offset> in the A_PROGRAM area.

lars

2007-10-06 21:30

reporter   ~0000552

Actually, the type int32 was introduced for that purpose. Ironically, the method ins_long() already used the right type.

Issue History

Date Modified Username Field Change
2006-11-12 22:45 zippo New Issue
2006-11-13 18:15 zippo Note Added: 0000520
2006-11-13 18:16 zippo Note Added: 0000521
2006-11-13 18:39 zippo Note Added: 0000522
2006-11-13 18:42 zippo Note Added: 0000523
2007-10-06 21:30 lars Status new => resolved
2007-10-06 21:30 lars Fixed in Version => 3.2.16
2007-10-06 21:30 lars Resolution open => fixed
2007-10-06 21:30 lars Assigned To => lars
2007-10-06 21:30 lars Note Added: 0000552