r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3]

Maxim
12-Oct-2010
[5232]
step 2 is source it  ;-)
BrianH
12-Oct-2010
[5233x2]
Yup :)
Step three is experiments at the console, calling it with test data.
Maxim
12-Oct-2010
[5235]
Q:  does reflect unbind the blocks it returns?
BrianH
12-Oct-2010
[5236]
It unbinds function code blocks, but intentionally binds object word 
blocks.
Maxim
12-Oct-2010
[5237x3]
is there a way to get a bound copy of a function's body?  sometimes, 
its nice to be able to figure out why a sub-function isn't doing 
what its supposed to...


this could be subject to protection schemes... so that a protected 
member cannot be shown via its function body.
this is also true of the stack function... it should not cross any 
protection... since doing so reveals what *it* calls...
(though I'm not saying it currently does just raising up the issue 
if it wasn't planned already)
Andreas
12-Oct-2010
[5240x2]
http://www.rebol.com/r3/docs/functions/cause-error.html
I took Brian's notes from above and edited some basic CAUSE-ERROR 
docs around them.
BrianH
12-Oct-2010
[5242x2]
No bound copy of a function body, for security reasons. The kind 
of hot-patching that was possible in R2 was always a security hole. 
Plus, it's not task-safe. For that matter, BODY-OF always returns 
a copy or constructed value, never the original, and code that currently 
uses it relies on this.
BODY-OF doesn't return the original for objects or modules either.
Maxim
12-Oct-2010
[5244x2]
the copy I don't mind... that's cool, its the fact that it always 
unbinds (which is what you seem to say).  its not a security hole 
if the functions aren't hidden or protected in some way.


I just want to know what a function within a function actually is 
calling... if its unbound... well I can't make any real inspection 
tool or debugger... right now I can go a lot further than R2, except 
this ... unless I didn't properly understand you.
its a bit like a dll, you only have access to the dll within a debugger 
if it was compiled with debugging... I'd like that to still be the 
case within rebol.
BrianH
12-Oct-2010
[5246]
There are two ways of hiding values. The tricky way is to use PROTECT/hide 
on a publically visible context. The more common, easier way is to 
use contexts that aren't publically accesible. There is no way that 
a reflector can tell if a bound context is not accessible, but the 
unbind trick prevents that kind of hack. And since inaccesible contexts 
might contain private information like encryption keys that might 
not belong to the person running the R3 process, there is no security 
setting that can make this safe to not do.
Maxim
12-Oct-2010
[5247]
I just finished a very powerfull new version of the search tool... 
it now even allows you to search for any value, even unset!. ( I 
just did a search to find all unset words in the whole system and 
it works without a hitch... )


also, if some data in the system is a string, it tries to find a 
formed value of your search value inside of it:-)
Steeve
12-Oct-2010
[5248]
Maxim, I felt the same back In time. A tool like anamonitor is not 
anymore possible. (cry on my face)
BrianH
12-Oct-2010
[5249]
But DRM is. Whether you consider that an advantage or not though...
Maxim
12-Oct-2010
[5250]
well, we can, but its severely limits debugging and frankly there 
is a way to do .   any context should have the possibility of having 
a private/public flag on it... its that simple. whenever you try 
to reflect a private context, it returns unset! (unbound) values.
BrianH
12-Oct-2010
[5251]
It is assumed that people doing debugging have access to the source. 
And in the case of source written in REBOL, that is likely the case 
now.
Steeve
12-Oct-2010
[5252]
Though debuging the source and a runtime session, is not the same 
thing.
Maxim
12-Oct-2010
[5253x2]
but you cannot resolve the run-time in data. since things are bound 
dynamically.  the name of a func is useless... we need to be able 
to trace it back to its context by getting its value.


this doesn't give us the context, but at least we can see what the 
function really is.
if things really need to be private, then anything which comes from 
a private context could just be flagged as such and inspection routines 
wouldn't return their values.
Pekr
12-Oct-2010
[5255]
if we can't have full fledget debugger, then we are crap :-)
Steeve
12-Oct-2010
[5256]
maybe we could have a FUNC idiom that doesn't protect anything for 
debugging purposes ?
Maxim
12-Oct-2010
[5257]
right now, the only thing I can't "anamonitor" is a function body. 
 I can get that function's body, but can't resolve what the functions 
*it* contains really do.  


all the rest works pretty much as is did, actually it works better, 
since we have real inspection routines now.
BrianH
12-Oct-2010
[5258]
If we want to be able to use R3 to show third-party content, then 
full debugging without the original source won't be allowed. It's 
the way of the world now.
Maxim
12-Oct-2010
[5259]
brianh, we can't debug *with* the source right now  :-)
Steeve
12-Oct-2010
[5260]
Ok, but for our own work, we still need to do so.
Maxim
12-Oct-2010
[5261]
hehe
BrianH
12-Oct-2010
[5262]
I can (and do) want the world to be open and all information to be 
free, but it's just not the way the world is now.
Maxim
12-Oct-2010
[5263]
huh? BrianH this has nothing to do with 3rd party.  we can't debug 
functions of any kind right now.  with source, hot chocolate or from 
the movie wizard of Oz.
BrianH
12-Oct-2010
[5264]
And you can debug if you have the source. However, some of the process 
will go through your head, in the form of knowledge of where functions 
are defined. Or you can take portions of the source without the protections 
and debug them independently.
Maxim
12-Oct-2010
[5265]
debugging implies that a tool shows you that information... the name 
of a function or word is irrelevant in REBOL.
BrianH
12-Oct-2010
[5266]
If you need to debug your own source, you can do so. You just can't 
use a debugger to get past the protections.
Maxim
12-Oct-2010
[5267]
for example, if I want to do a real time debugger which shows me 
the current content of the block which is being stepped through by 
a loop... 

I can't since I can't get access to the block which is being used 
by that function...
Steeve
12-Oct-2010
[5268]
Yes Maximn, to do runtime debugging, we must be allowed to construct 
observable functions
BrianH
12-Oct-2010
[5269]
There are other methods of debugging at runtime if you have the source. 
Heck, even good old print statement debugging would work.
Steeve
12-Oct-2010
[5270x2]
it could be simulated with a special mezz. A function which executes 
an indirect DO on one code block instead of building a function.
So that the code block could still be inspected by a debuging tool.
Maxim
12-Oct-2010
[5272]
hum... maybe a way to build a context when building a function, with 
the index of each member of the body block mapped out to its original 
source.
Steeve
12-Oct-2010
[5273]
yep it should work
Maxim
12-Oct-2010
[5274]
then the debugger could inspect the context instead.
BrianH
12-Oct-2010
[5275]
Right, and that kind of thing works now. But allowing a debugger 
to get past the protections just isn't going to happen. We don't 
have a way to know at runtime which person needs to be asked for 
permission to break past a protection like that. Since it certainly 
isn't the user.
Steeve
12-Oct-2010
[5276]
you will just have to furnish mezzs to replace the standard, func, 
funco and funct
Maxim
12-Oct-2010
[5277]
we could be able to do this by switching to a "debug" version of 
the various func creating mezz
BrianH
12-Oct-2010
[5278]
Yes, and replace those functions before the system is protected to 
support the reset.
Maxim
12-Oct-2010
[5279x2]
we could even make those functions able to trigger events based on 
"break points"  then listen on those events in a normal event loop.
so the debugger actually adds a line of code where the break should 
happen... then rebuilds the body block it executes when its called.
BrianH
12-Oct-2010
[5281]
They could even be trace events.