Hi,

For those who want to use debug with mapped files,  The problem come 
from the
function "jdb_stackrep_jdebug_"
in the file : jpath '~system\extras\util\debugs.ijs'

dfs=. jdb_getdefs 0 >@{ exl
dfs=. dfs -. MNUVXY
dfs=. ~. wat, ((MNUVXY e. LOCALNAMES)#MNUVXY), dfs

assigning mapped variable to a variable copy the address and not the 
values, thus, changing that second variable after will affect the first 
real variable , thus  breaking your mapped files in memory.

Example:

load 'jmf'

    createjmf_jmf_ 'c:\test.jmf';50000
    map_jmf_ 'T1';'c:\test.jmf';'';0
    T1 =: i. 10
    T1
          0 1 2 3 4 5 6 7 8 9
   
    vTemp =: T1
    vTemp =: vTemp + 1
  
    T1
           1 2 3 4 5 6 7 8 9 10
  


you can quick fix that by commenting those lines, and adding dfs =. 0 $ 0

NB.dfs=. jdb_getdefs 0 >@{ exl
NB.dfs=. dfs -. MNUVXY
NB.dfs=. ~. wat, ((MNUVXY e. LOCALNAMES)#MNUVXY), dfs
dfs =. 0 $ 0

but variables won't show in the debugger. (it is no big deal for us)

a real fix will be to make a deep copy of the variable in the debug.

regards

JP.



Gilles Kirouac wrote:
>   Unfortunately no trick, but the bug can be produced under J32-602 
> for MS-Win with up to date library. As Jean-Philippe says, the bug 
> is only present when a J error is catched by the debugger.
>
>  ~ Gilles
>
> ---------- Original Message -----------
> From: Jean-Philippe Doiron <[email protected]>
> To: Programming forum <[email protected]>
> Sent: Wed, 28 Jan 2009 10:50:35 -0500
> Subject: [Jprogramming] Debug with J mapped files.
>
>   
>> There is a little something annoying while working with mapped files. 
>> (in J64-602) ,
>>
>> Every time you open the debugger and a line containing a mapped file 
>> crash (debug), the mapped file get corrupted.
>>
>> example to duplicate this behavior:
>>
>> load the following script..
>> call create''
>> open debugger (ctrl-K)
>> call test ''
>>
>> variable T1 and mapped file c:\test.jmf get corrupted
>> 100$0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16....
>> instead of
>> 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16....
>>
>> a trick to avoid that will save us lot of backup files.
>>
>> kind regards
>>
>> JP.
>>
>> P.S : J503a debugger keep a valid T1, but with a # of 80 instead of 
>> 100, lost 20 INT.
>>
>> ---------------- BEGIN script -------------------------
>>
>> load 'jmf'
>> load 'debug'
>>
>> create =: 3 : 0
>>     createjmf_jmf_ 'c:\test.jmf';50000
>>     map_jmf_ 'T1';'c:\test.jmf';'';0
>>     T1 =: i. 100
>>     unmapall_jmf_''
>> )
>>
>> test =: 3 : 0
>>     map_jmf_ 'T1';'c:\test.jmf';'';0
>>     101{T1
>> )
>>
>> ---------------- END script -------------------------
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>     
> ------- End of Original Message -------
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>   

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to