[M3devel] Pretty-printing REFANYs?

Mika Nystrom mika at async.caltech.edu
Wed Oct 1 20:10:38 CEST 2008


Ok, ignore my previous email :-)

Tony Hosking writes:
>m3gdb makes use of stabs debug information spat out by the backend.   
>They are only in the binary if compiled -g.  There are other ways to  
>get what you are after, as Darko has observed.
>
>On Oct 1, 2008, at 11:03 AM, Darko wrote:
>
>> I've extended one of the modules with a function that formats any  
>> allocated value for printing. If you're interested I can clean them  
>> up a little and post them.
>>
>>
>> On 28/09/2008, at 8:01 AM, Darko wrote:
>>
>>> As far as I know, yes, they're not in the binary. I'd love to be  
>>> proven wrong though, or fix it so they did. I have a module that  
>>> reads the .M3WEB file and maps it to types and a module that will  
>>> read and write any field within a type safely using a numeric  
>>> index. Neither is perfect. You can integrate the two to get what  
>>> you want but I seem to remember having some problems mapping type  
>>> ids (UIDs?) to typecodes at runtime.
>>>
>>>
>>> On 28/09/2008, at 7:49 AM, Mika Nystrom wrote:
>>>
>>>> Right, I am aware of those interfaces.. just wondering what was
>>>> out there.  Do I really need to look at .M3WEB?  I thought
>>>> that m3gdb could figure out things without anything outside
>>>> of the binary...
>>>>
>>>> I'm looking for essentially what m3gdb offers, say prints
>>>> at minimum the name of the type (this I recall is trivial with
>>>> some of the RT* interfaces) but hopefully also with field names
>>>> and values, but doesn't expand references recursively.. something
>>>> like that?
>>>>
>>>>  Mika
>>>>
>>>> Darko writes:
>>>>> You can use RTTipe to read the fields and values within a type.  
>>>>> If you
>>>>> also want the type and field names you can interpret the .M3WEB  
>>>>> file.
>>>>> I have a couple of modules that do something like that but they are
>>>>> not what you would call finished. What level of detail are you  
>>>>> after?
>>>>>
>>>>>
>>>>> On 28/09/2008, at 6:45 AM, Mika Nystrom wrote:
>>>>>
>>>>>> Hello Modula-3 people,
>>>>>>
>>>>>> I am working on a writing an interpreter that I'd like to embed in
>>>>>> various Modula-3 programs.  It so happens that this interpreter
>>>>>> might from time to time be manipulating arbitrary M3 REFs, and  
>>>>>> just
>>>>>> from the point of view of providing information to a human user,
>>>>>> it might be nice to be able to pretty-print these.  Does anyone
>>>>>> have any code that accomplishes this, at least partly?  I'm  
>>>>>> thinking
>>>>>> that since m3gdb can do it, the information must all be in the
>>>>>> binary---somehow.  (Even enumeration names, right?)  And since the
>>>>>> pickler can pickle things... hmm.
>>>>>>
>>>>>> I would greatly appreciate any guidance that's out there...
>>>>>>
>>>>>> Best regards,
>>>>>>    Mika Nystrom
>>>



More information about the M3devel mailing list