VimDebug icon indicating copy to clipboard operation
VimDebug copied to clipboard

Breakpoints failing without an error

Open kablamo opened this issue 14 years ago • 5 comments

The problem

You can't set a breakpoint in Perl unless the file has been loaded by the debugger. If you're code dynamically loads libraries, and you try to set a breakpoint in a library that hasn't been loaded yet, VimDebug.vim makes it appear that you successfully set the breakpoint. However, when you do a 'continue', the debugger will not stop at the breakpoint.

The fix

A fix for this would mean an error is displayed and VimDebug.vim should not show that a breakpoint was set (no >> in the margin).

Priority

I suppose there isn't tons of code out there that loads libraries dynamically but Catalyst is an important use case where that does happen.

Larger issues

Not being able to set breakpoints for libraries that haven't yet loaded is also a problem more generally for VimDebug usability. We may have to depend on users editing their code and inserting this line of code: $DB::single=1; This causes the Perl Debugger to enter "single step mode" when this command is encountered and it has no effect when Perl is run without the -d flag.

I suppose one solution to this may be to have the b command insert '$DB::single=1'. Obviously this is not gonna work for other debuggers. I don't yet know how this issue is handled by ruby or python.

kablamo avatar Feb 23 '11 09:02 kablamo

For Perl at least, maybe the implementaion can directly manipulate the %{'_<'.$filename} hash? (see perl5db.pl)

lucs avatar Feb 23 '11 12:02 lucs

It seems the debugger doesn't let us modify the hashes for files other than the file thats currently being stepped through. Maybe long term we have to contribute patches to perl5db.pl.

kablamo avatar Feb 24 '11 03:02 kablamo

Meh. That may prove to be painful :-(

lucs avatar Feb 24 '11 04:02 lucs

This command will set a breakpoint on the first line of a subroutine that hasn't yet been loaded.
b postpone subroutine 1 Thats pretty awesome. But I don't know a good way to detect the name of the current sub from vim.

Actually from reading perl5db.pl docs the perl debugger has some pretty awesome features.

kablamo avatar Feb 26 '11 06:02 kablamo

It might be possible to use b load <filename> and add defined breakpoints after the file loaded. I realise that it doesn't sound very nice. But it might do the trick.

yko avatar Oct 27 '12 19:10 yko