Tracing tool - JavaScript ServiceList
Charles Ferguson (8243) 427 posts |
(quoting myself from another thread)
(quoting myself from http://gerph.org/riscos/ramble/testingdebugging-2.html#JSSL) My friend Chris was having fun debugging what’s going on with file paths, so I suggested that maybe JSSL might be able to help with that. I spoke a little about this in the Rambles (linked above) but I don’t think it ever went to more than a few people for playing with. It turns out that it didn’t compile on my system any more, and wasn’t 32bit safe (though handily had an `ASSERT {CONFIG} = 26` to warn me)… And it was just one veneer routine and it was very simple to fix. Example run on my system:
So I’ve built it, and it works on my version of RISC OS (which is honestly pretty freakin’ surprising to me). In the interests of following up on ‘debug tools are important’… would this be of interest to anyone? I can’t promise that it’ll work on any given system… but it worked back in ‘04, and all I’ve changed is to tweak a small bit of 32bitness. It’s utterly alpha level, and there’s huge caveats to using it – essentially you can hook many parts of the OS, so that gives you the amazing ability to blow the system away. Plus it’s hooking with interpreted Javascript, so you’ll see a little bit of a slow down. I would expect that there are much better tools about, given that it was some years ago that I wrote it, but if there’s interest, I can probably put it somewhere for people to try. |
David Feugey (2125) 2709 posts |
Guess ;) |
Rick Murray (539) 13840 posts |
Looks like an interesting tool. It’s a shame we don’t have something equal to DiagnosticDump, but it would be a start. I like the example tracking OS_Byte use. I’m imagining that could be adapted to, say, track events or vectors or ServiceCalls? |
Alan Robertson (52) 420 posts |
I’m pretty sure there are plenty of software gathering digital dust on your hard disc that we would all find interesting. |
Charles Ferguson (8243) 427 posts |
The example of counting usage is actually one of the more redundant ones, as I believe druck (or ARM Club; sorry my memory sucks) already have dedicated tools that track these, which are almost certainly more efficient and less intrusive. According to the docs, vectors, events, services, and wimp post filters are supported, with specific handlers for spritev eventv and upcallv. I’ll dig out the examples later, and ‘cos it only builds manually I’ll need to put some CI around it – fortunately building it inside a docker container should be dead easy. Then I need to work out where to push it; I have an artifactory server that I use with my gitlab, but I don’t trust making that publically accessible. |
Chris Johns (8262) 242 posts |
It’s certainly helped me track an odd behavior down .. the only thing to beware of is you can’t log all your file operations to a file.. :) |
Charles Ferguson (8243) 427 posts |
I’ve decided on plain old ‘dump it into a webserver’ as a solution to the artifact storage. … contains a copy of the JSSL module, ‘documentation’, and whatever examples I had lying around. Chris’ tested it on a real RISC OS, so it must work. Read the caveats.
Turns out that you can (I gave Chris bad information ‘cos I didn’t remember)! The interpreter code locks itself so that you don’t reenter it, so if you do write to a file whilst trapping the vectors, it’ll go through as if you weren’t there. I only discovered this whilst re-writing parts of the documentation. |
Andrew Rawnsley (492) 1445 posts |
Sounds like you thought of everything! :) |