[M3devel] more crashers

Jay K jay.krell at cornell.edu
Sun Aug 16 21:52:03 CEST 2009


Here is the relevant code in m3browser ID.m3:
 
 
C:\dev2\cm3.2\m3-tools\m3markup\src\ID.m3(38):  empty_id  := Add ("");
 
  empty_id  := Add ("");
 
(*-------------------------------------------------------------- exported ---*)
PROCEDURE Add (x: TEXT): T =
  VAR 
    t: T; 
    a: REF ARRAY OF CHAR;
    l: INTEGER;
  BEGIN
    l := Text.Length(x);
...
  END Add;

 
The empty string constant ends up as null.
 
        .stabn  68,0,38,.LM115-.LFBB10
.LM115:
        movl    L_1 at GOT(%ebx), %eax
        leal    24(%eax), %eax
        movl    %eax, (%esp)
        call    ID__Add at PLT
        movl    %eax, -8(%ebp)
        movl    -8(%ebp), %ecx
        movl    MM_ID at GOT(%ebx), %edx
        movl    248(%edx), %eax
        andl    $0, %eax
        orl     %ecx, %eax
        movl    %eax, 248(%edx)
.L136:
        movl    MM_ID at GOT(%ebx), %eax
.LBE16:
        addl    $52, %esp
        popl    %ebx
        popl    %ebp
        ret
 
L_1:
0        .long   RTHooks__TextLitInfo
4        .long   RTHooks__TextLitGetChar
8        .long   RTHooks__TextLitGetWideChar
12        .long   RTHooks__TextLitGetChars
16        .long   RTHooks__TextLitGetWideChars
20        .long   2
24        .long   L_1
        .long   0 
        .zero   4
        .ascii  "ID_M3"
        .zero   1
        .ascii  "ExpandHashTable"
        .zero   1
        .ascii  "ExpandIDs"
        .zero   1
        .ascii  "ExpandChars"
        .zero   1
        .ascii  "Compare"
        .zero   1

If I change "" to "foo", I get:
 
L_1:
0        .long   RTHooks__TextLitInfo
4        .long   RTHooks__TextLitGetChar
8        .long   RTHooks__TextLitGetWideChar
12       .long   RTHooks__TextLitGetChars
16       .long   RTHooks__TextLitGetWideChars
20      .long   2
24      .long   L_1
        .long   3
        .ascii  "foo"
        .zero   1
        .ascii  "ID_M3"
 
and it still crashes.
 
 
It seems to hit ID__Add twice when only once would be expected.
 

 - Jay


----------------------------------------
> From: jay.krell at cornell.edu
> To: hosking at cs.purdue.edu
> Date: Sun, 16 Aug 2009 19:33:34 +0000
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] more crashers
>
>
> Could be. I've also seen it on PPC_DARWIN a while ago. I only recall seeing it on sparc and ppc.
> It doesn't always occur.
>
>
> Here is the m3browser crash on a system that can be debugged.
> See why I want the full paths in the debug info?
>
>
> C:\Users\jay\Desktop>\cygwin\bin\ssh xobsd.
> $ cd /cm3
> $ cd bin
> $ export DISPLAY=192.168.1.120:0.0
> $ gdb ./m3browser
> GNU gdb 6.3
> This GDB was configured as "i386-unknown-openbsd4.5"...
> (gdb) r
> Starting program: /home/jay/cm3/bin/m3browser
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to process 31063, thread 0x7eafe800]
> 0x01592fd4 in Text__Length (M3_Bd56fi_t=0x0) at ../src/text/Text.m3:16
> 16 t.get_info (i);
> (gdb) bt
> #0 0x01592fd4 in Text__Length (M3_Bd56fi_t=0x0) at ../src/text/Text.m3:16
> #1 0x09fd9464 in ID__Add (M3_Bd56fi_x=0x0) at ../src/ID.m3:48
> #2 0x1c01e644 in Main_M3 (M3_AcxOUs_mode=1) at ../src/Main.m3:37
> #3 0x0156f1bc in RTLinker__RunMainBody (M3_DjPxE3_m=0x3c003ec0)
> at ../src/runtime/common/RTLinker.m3:399
> #4 0x0156e576 in RTLinker__AddUnitI (M3_DjPxE3_m=0x3c003ec0)
> at ../src/runtime/common/RTLinker.m3:113
> #5 0x0156e604 in RTLinker__AddUnit (M3_DjPxE5_b=0x1c01e54d)
> at ../src/runtime/common/RTLinker.m3:122
> #6 0x1c004676 in main (argc=1, argv=0xcfbf6a3c, envp=0xcfbf6a44)
> at _m3main.mc:4
>
>
> - Jay
>
>
> ________________________________
>> From: hosking at cs.purdue.edu
>> To: jay.krell at cornell.edu
>> Date: Sun, 16 Aug 2009 15:26:49 -0400
>> CC: m3devel at elegosoft.com
>> Subject: Re: [M3devel] more crashers
>>
>> Could this be endianness-related?
>>
>> On 16 Aug 2009, at 15:21, Jay K wrote:
>>
>>
>> I see the assertion failure on PPC_LINUX too.
>> I tried VAR defaultStackSize := 1024 * 1024; (not sure why there was any suspicion of stack size).
>>
>>
>> Debugging doesn't work PPC_LINUX.
>>
>>
>> jay at plin:/cm3/bin$ gdb ./cm3
>> GNU gdb 6.8-debian
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "powerpc-linux-gnu"...
>> break ma(gdb) break main
>> Breakpoint 1 at 0x86fc4: file _m3main.mc, line 2.
>> (gdb) r
>> Starting program: /home/jay/cm3/bin/cm3
>> Warning:
>> Cannot insert breakpoint 1.
>> Error accessing memory address 0x86fc4: Input/output error.
>>
>>
>> No problem with C:
>>
>>
>> jay at plin:/cm3/bin$ echo "main(){}"> 1.c
>> jay at plin:/cm3/bin$ gcc -g 1.c
>> jay at plin:/cm3/bin$ gdb ./a.out
>> GNU gdb 6.8-debian
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "powerpc-linux-gnu"...
>> (gdb) break main
>> Breakpoint 1 at 0x10000448: file 1.c, line 1.
>> (gdb) r
>> Starting program: /home/jay/cm3/bin/a.out
>> Breakpoint 1, main () at 1.c:1
>> 1 main(){}
>> (gdb)
>>
>>
>> jay at plin:/cm3/bin$ gcc -gstabs+ 1.c
>> jay at plin:/cm3/bin$ gdb ./a.out
>> GNU gdb 6.8-debian
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "powerpc-linux-gnu"...
>> (gdb) break main
>> Breakpoint 1 at 0x10000448: file 1.c, line 1.
>> (gdb) r
>> Starting program: /home/jay/cm3/bin/a.out
>> Breakpoint 1, main () at 1.c:1
>> 1 main(){}
>>
>>
>> jay at plin:/cm3/bin$ gcc -gstabs 1.c
>> jay at plin:/cm3/bin$ gdb ./a.out
>> GNU gdb 6.8-debian
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law. Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "powerpc-linux-gnu"...
>> (gdb) break main
>> Breakpoint 1 at 0x10000448: file 1.c, line 1.
>> (gdb) r
>> Starting program: /home/jay/cm3/bin/a.out
>> Breakpoint 1, main () at 1.c:1
>> 1 main(){}
>> (gdb)
>>
>>
>> - Jay
>>
>>
>> ----------------------------------------
>> From: jay.krell at cornell.edu
>> To: m3devel at elegosoft.com
>> Subject: more crashers
>> Date: Sun, 16 Aug 2009 10:06:15 +0000
>>
>>
>> This is head on SOLgnu:
>> I'll try another and debug and see if fix is easy.
>>
>> -bash-3.00$ ./m3browser
>>
>> ***
>> *** runtime error:
>> *** Segmentation violation - possible attempt to dereference NIL
>> *** pc = 0xfe484f04 = String16_M3 + 0xe0 in ../src/text/String16.m3
>> ***
>>
>> -bash-3.00$ ./visobliq
>> Internal Obliq interpreter installed...
>> Establishing 'templates'
>> (Created frame 'templates')
>> let
>> Templates =
>> {boolean=> ... ,
>> browser=> ... ,
>> button=> ... ,
>> choice=> ... ,
>> filebrowser=> ... ,
>> form=> ... ,
>> frame=> ... ,
>> hscroll=> ... ,
>> menu=> ... ,
>> numeric=> ... ,
>> text=> ... ,
>> textedit=> ... ,
>> typein=> ... ,
>> video=> ... ,
>> vscroll=> ... }
>> Establishing 'vowidgets'
>> (Created frame 'vowidgets')
>> ok
>> Establishing 'vocheckpt'
>> (Created frame 'vocheckpt')
>> ok
>> Establishing 'volib'
>> (Created frame 'volib')
>> Segmentation Fault (core dumped)
>> -bash-3.00$
>>
>>


More information about the M3devel mailing list