in reply to Re^2: RFC: Location via B::Deparse
in thread RFC: Location via B::Deparse
Devel::Trepan 0.70 has just been released. In it, the deparse command will use the current location to deparse. This does handle multiple statements on a single line, inside a subroutine. (I haven't been able to figure out how to get this to work in the main program.)
Just to get this done, I needed to monkeypatch B::Deparse and add some other routines that probably should in another package somewhere.
In order to be able to figure out the exact location in a callsite, e.g.
addresses in showing the call stack and are recorded in the stack in the 0.70 release. I beefed up Devel::Trepan::Disassemble and made a release of that too. The basic idea here is you disassemble the surrounding context to reconstruct the fragment of code. (The call location is marked with an arrow automatically if that is found.)fib($x-1) + fib($x-2)
Better though would be more changes to B::Deparse so that you can pass it an opcode location and it deparse around that. Also, I'd like to see more COP instructions added say found for loops of the 3-part kind: initialize, test and increment.
As with other science and engineering, the more you do, the more you realize there is to do. I may beef up B::CodeLines so that it notes which lines have multiple statements in them.
Finally, I observe that providing really good debugging support, not just in Perl but other languages as well, is often really hard and strays way outside of the "debugger" proper. I think that's one reason you don't find things like this often in debuggers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: RFC: Location via B::Deparse
by rockyb (Scribe) on Nov 11, 2015 at 17:16 UTC |