[M3devel] source paths to generics?

Rodney M. Bates rodney_bates at lcwb.coop
Wed Jun 29 19:01:08 CEST 2016



On 06/29/2016 04:44 AM, Jay K wrote:
> I haven't fully verified this, but it appears for example if I debug a generic, or fail an assert in a generic,
> the source file I am told about is the instantiated i3/m3 file.
>
> This isn't particularly useful for the programmer or convenient for the compiler, right?
>
> The programmer would rather see the .ig/.mg files, and this is easy to provide in the compiler?
> I guess it is slightly easier in the compiler, but easy to do better?

Yes.  m3gdb does this, in many cases:
------------------------------------------------------------------------------------------------------------
(m3gdb) b VarArray.mg:136
Breakpoint 2 at 0x4073c3: file ../AMD64_LINUX/IntIntVarArray.m3 => ../src/VarArray.mg, line 136.
(m3gdb) c
Continuing.

Breakpoint 2, New (InitElemValue=-9223372036854775808, InitialAlloc=
     RECORD Lo = 9223372036854775807; Hi = -9223372036854775808;  END, ExpansionFactor=1.10000002)
     at ../AMD64_LINUX/IntIntVarArray.m3 => ../src/VarArray.mg:136
136	      LExpansionFactorR := MAX ( ExpansionFactor , MinExpansionFactorR )
(m3gdb)

------------------------------------------------------------------------------------------------------------

It has a bug though.  Setting a breakpoint to a .mg file before any execution has
started appears to work, but the breakpoint won't trigger.

I have not looked at cases like runtime errors without m3gdb.

This does raise the question, however, that you might very well want to distinguish
different instantiations of the same generic when setting a breakpoint.

This is a good example of where a debugger needs to have awareness of your language.
Modula-3 instantiations, being separate compilation units and having separate
generic and instantiation files is a model that, AFAIK, does not occur in other
languages.

>
> I should look into make it so?
>
> My real agenda is I want to see:
>    ../src/foo.mg
>
> instead of
>   I386_DARWIN/foo.m3
>
> I don't want the target variation, but other points seem true also, right?
>
> Right? The line numbers match between them, and the generic syntax is so close to "normal" that a programmer not used to it won't be confused, right?
>
> I'll try to poke around more.
>
>   - Jay
>
>   		 	   		
> _______________________________________________
> M3devel mailing list
> M3devel at elegosoft.com
> https://m3lists.elegosoft.com/mailman/listinfo/m3devel
>

-- 
Rodney Bates
rodney.m.bates at acm.org



More information about the M3devel mailing list