Re: building with debugging turned on

John Reppy <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
The runtime system is compiled "-g", which is why you are seeing  
function
parameter names in the stack trace, but the failure is while  
executing ML
code, for which there is no symbolic information.  The ML runtime model
is very different than that of C (no stack), so gdb is going to be  
confused.

Probably the best thing to do now is try to construct a small example  
that
fails and send it to us.  Hopefully Matthias can figure out the problem.

	- John

On Mar 26, 2006, at 9:04 PM, brian wrote:

> Hi John,
>
> OK - I set everything set up.
>
> ignoring, or not ignoring, or passing or not passing the sigchld  
> did not work so I simply created my own heap image which works great.
>
> However gdb acts like it cannot find source files, i.e. I can  
> disassemble, but I cannot step through source.
>
> Are you sure that the default build is with -g  ?
>
> Now it may be that I am in some portion of sml which is not  
> debuggable.
>
> here is the backtrace (and it is not good news):
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_INVALID_ADDRESS at address: 0x3fe46cef
> 0x005c0f90 in ?? ()
> (gdb) bt
> #0  0x005c0f90 in ?? ()
> #1  0x005c0f58 in ?? ()
> warning: Previous frame identical to this frame (corrupt stack?)
> #2  0x0000440c in RunML (msp=0x3036a0) at ../kernel/run-ml.c:191
> #3  0x00002fa0 in main (argc=0, argv=0xbffff680) at ../kernel/ 
> main.c:77
>
> If I can step through source I should be able to figure this out.
>
> Also, do you know if the nlffi stuff is areadybuilt with -g ?
>
> Thanks
>
> Brian
>
> On Mar 26, 2006, at 5:35 PM, John Reppy wrote:
>
>> Just configure gdb to ignore SIGCHLD (I'm pretty sure that is what  
>> is interrupting
>> the system call), but exporting your system as a heap image might  
>> be easier.
>>
>> 	- John
>>
>> On Mar 26, 2006, at 4:38 PM, brian wrote:
>>
>>> OK - almost there...
>>>
>>> I keep getting the following, which is preventing me from  
>>> actually running any of my test routines.
>>>
>>> Standard ML of New Jersey v110.57 [built: Mon Nov 21 09:35:29 2005]
>>> - CM.make("clapack.cm");
>>>
>>> everything proceeds normally, and then :
>>>
>>> [plugin $/make-tool.cm loaded successfully]
>>> [make -f clapack.make SMLNJ_BINDIR=/usr/local/smlnj-110.57/bin  
>>> FFI/clapack.cm]
>>> make: `FFI/clapack.cm' is up to date.
>>>
>>> uncaught exception SysErr [SysErr: Interrupted system call [intr]]
>>>   raised at: <waitpid.c>
>>>              Basis/Implementation/Unix/os-process.sml:47.38-47.40
>>>              ../cm/util/safeio.sml:41.55
>>>              ../cm/tools/main/private-tools.sml:533.13
>>>              ../cm/util/safeio.sml:41.55
>>>              ../cm/util/safeio.sml:41.55
>>>              ../cm/parse/parse.sml:501.47
>>>
>>> Do I need to create my program as a heap image and load it  
>>> instead of sml ?
>>>
>>> Brian
>>>
>>>
>>> On Mar 26, 2006, at 11:26 AM, John Reppy wrote:
>>>
>>>> Each version comes with a copy of the installation  
>>>> instructions.  For example,
>>>>
>>>> 	http://smlnj.org/dist/working/110.58/INSTALL
>>>>
>>>> If you install using the config/install.sh command, then you  
>>>> should be set.  The
>>>> makefile already uses the -g option to compile the runtime, so  
>>>> you'll just need
>>>> to run gdb on it.  For example, if you are in the src/runtime/ 
>>>> objs directory (where
>>>> the runtime is built), do the following
>>>>
>>>> 	gdb ../../../bin/.run/run.ppc-darwin
>>>>
>>>> and then
>>>>
>>>> 	run @SMLload=../../../bin/.heap/sml
>>>>
>>>> at this point, you'll have SML/NJ running under gdb.
>>>>
>>>> 	- John
>>>>
>>>> On Mar 26, 2006, at 10:36 AM, brian wrote:
>>>>
>>>>> Hi John,
>>>>>
>>>>> Right, the problem is I can't seem to find how to add the -g  
>>>>> option to the build.
>>>>>
>>>>> I think I originally installed using the Mac OS X package.
>>>>>
>>>>> Do I need to grab the sources and build from scratch ?
>>>>>
>>>>> I can't seem to find any guidance in the doc's including  
>>>>> installation instructions and my own travels among the README's.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Brian
>>>>>
>>>>> On Mar 23, 2006, at 8:28 PM, John Reppy wrote:
>>>>>
>>>>>> This is what I usually do when confronted with a crash.  You  
>>>>>> should compile
>>>>>> the runtime system with "-g" and then run gdb on it.  Use the  
>>>>>> @SMLload option
>>>>>> to the runtime system to load thee sml heap image (the  
>>>>>> standard one is in
>>>>>> bin/.heap.
>>>>>>
>>>>>> 	- John
>>>>>>
>>>>>> On Mar 23, 2006, at 8:56 PM, brian wrote:
>>>>>>
>>>>>>> Well I can't seem to figure out where these seg faults are  
>>>>>>> coming from with nl-ffi so it's time to do things the hardware.
>>>>>>>
>>>>>>> Is it very reasonable to try and build my program with  
>>>>>>> debugging turned on so I can try to track down the problem  
>>>>>>> using gdb ?
>>>>>>>
>>>>>>> Perhaps there is a better way ?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Brian
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -------------------------------------------------------
>>>>>>> This SF.Net email is sponsored by xPML, a groundbreaking  
>>>>>>> scripting language
>>>>>>> that extends applications into web and mobile media. Attend  
>>>>>>> the live webcast
>>>>>>> and join the prime developer group breaking into this new  
>>>>>>> coding territory!
>>>>>>> http://sel.as-us.falkag.net/sel? 
>>>>>>> cmd=lnk&kid=110944&bid=241720&dat=121642
>>>>>>> _______________________________________________
>>>>>>> Smlnj-list mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/smlnj-list
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------
>>>>>> This SF.Net email is sponsored by xPML, a groundbreaking  
>>>>>> scripting language
>>>>>> that extends applications into web and mobile media. Attend  
>>>>>> the live webcast
>>>>>> and join the prime developer group breaking into this new  
>>>>>> coding territory!
>>>>>> http://sel.as-us.falkag.net/sel? 
>>>>>> cmd=lnk&kid=110944&bid=241720&dat=121642
>>>>>> _______________________________________________
>>>>>> Smlnj-list mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/smlnj-list
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> -------------------------------------------------------
>>>> This SF.Net email is sponsored by xPML, a groundbreaking  
>>>> scripting language
>>>> that extends applications into web and mobile media. Attend the  
>>>> live webcast
>>>> and join the prime developer group breaking into this new coding  
>>>> territory!
>>>> http://sel.as-us.falkag.net/sel? 
>>>> cmd=lnk&kid=110944&bid=241720&dat=121642
>>>> _______________________________________________
>>>> Smlnj-list mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/smlnj-list
>>>
>>>
>
>



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.