Re: BREAKing into Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

[quote ghaberek]

abuaf said...

What's the easiest way to contribute the TraceOn functionality patches to euphoria 4.1 source?

ghaberek said...

If this is something you want to implement, you are welcome to open a pull request against the Euphoria repo on GitHub. However, I'll warn you now that your method of using assembly code to inject tracing into the code stack is not going to be accepted. It looks quite dangerous and it's not portable to other platforms as it stands. Anything we implement should work on at least x86/x64 Windows and x86/x64/ARM Linux.

See my quote below. This is *not* how my code works. Essentially in the eu source, trace(1) sets the C var "TraceOn=1;" . This then triggers the debugger to be invoked when the existing "trace on" eu byte code is next hit (what i referred to as "pop up the debugger when the next trace'able code is encounterred"). My code patches the C var "TraceOn=1;" in the eu binary in virtual memory (because there's no api exposing access to this). You can then refer to my comments to provide this access via trivial additions to allow_break() in interpreter's C source; this is then the implementaion - nothing to do with the problematic mission of patching eu byte code; i dont think there is any way to locate at runtime where in the bytecode to patch and how to revector the old byte code to allow continuity. Me thinks I'd have to parse eu's symbolic debug stream wind forward to the next eu instruction bytecode address falling on the next eu source line and patch that ... ugly, and not needed, this is not how eu's debugger works; basically the bytecode has the 'trace on' opcode preceeding each new eu source line (keeping in mind each line corresponds to many byte codes which would be un-atomic otherwise), that the interpreter then polls the C "TraceOn" var and invokes the debugger if true, so all the machinery to internally (via a API to the eu app to) trigger the debugger at an abitrary moment is there; which my code does without an exposed API.

Anyone who wants to wrap their head around my code, pls read my comments very carefully. Anyway i reimplemented it without ASM with eu equivalent and some fluff, but the 'hack' is the same methodology.

abuaf said...

I had a closer look at "external debugger" api, doesn't seem to provide this functionality to queue a "TraceOn=1" trap out to the debugger at the next traceable code, which is great for pin

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu