Hi,

there's a quite old bug in the mem2array command, when called as a target 
subcommand (i.e., <target> mem2array ...). The value read from the target 
never propagates back into the array argument, the array is always unchanged 
when the command completes. I've traced this down to what I think is a context 
problem with subcommands. It seems that a subcommand comes with its own 
"context" and thus scope, which means all variables created by a target 
subcommand are local to its context and are destroyed once the command 
completes. In the case of "<target> mem2array <arrayvar> ...", <arrayvar> 
seems to be locally created instead of using the surrounding scope.

Not being familiar with the inner workings of the Jim stuff, I see two 
possibilities to fix that: Make subcommands share the parent context, or 
change mem2array to return the result vie Jim_SetResult(). The latter is not 
nice since it changes the function signature, the first might have side 
effects or maybe not feasible at all.

Hoping for advice.

BR,
Matthias

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to