Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Breakpoints stop in wrong place (wrong file) #124

@gstead

Description

@gstead

perl-debug is great and a main reason I switched to vscode. But I can't get breakpoints to break at the right place.

To reproduce:

  1. unzip vscode-perl-debug-breaks-wrong-place.zip in a folder somewhere (zip includes:
$ ls -al vscode-perl-debug-breaks-wrong-place
total 24
drwx------     6 gstead  staff   192B Sep 22 14:27 ./
drwx------+ 4633 gstead  staff   145K Sep 22 14:27 ../
drwxr-xr-x     3 gstead  staff    96B Sep 22 14:27 .vscode/
-rw-------     1 gstead  staff   580B Sep 22 14:27 .vstags
-rw-r--r--     1 gstead  staff   198B Sep 22 12:36 TestPackage.pl
-rw-r--r--     1 gstead  staff   532B Sep 22 12:32 TestPackage.pm
  1. cd to that folder
  2. run code .
  3. set a breakpoint in TestPackage.pm. I suggest somewhere in sub a or sub b
  4. start debugging. After the initial pause, press > to continue (or c in console)
  5. the debugger breaks in TestPackage.pl instead of the breakpoints in TestPackage.pm

If I had to guess, I'd day the debugger breaks on the correct line in TestPackage.pm. But perhaps vscode loads the wrong file and displays the break in the wrong place.

My environment

Mac OS/X Mojave; perl 5.16.3; perlbrew; Perl Debug 0.6.3

vscode details:

Version: 1.38.1
Commit: b37e54c98e1a74ba89e03073e5a3761284e3ffb0
Date: 2019-09-11T13:31:32.854Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0

Things I debugged/checked:

Check 1) confirm the cli debugger works correctly (no vscode):

MacBook-Pro-2:vscode gstead$ perl -d TestPackage.pl

Loading DB routines from perl5db.pl version 1.37
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(TestPackage.pl:3):	$\ = "\n";
  DB<1> f TestPackage.pm
1 	package TestPackage;
2:	use strict;
3:	use warnings;
4:	use Moose;
5
6:	has max => ( is => 'rw', isa => 'Int', default => 100 );
7
8:	has a => ( is => 'rw', isa => 'Int', lazy_build => 1 );
9
10 	sub _build_a {
  DB<4> l 13
13:	    return $num;
  DB<5> b 13
  DB<6> f TestPackage.pl
1:	use strict;
2:	use warnings;
3==>	$\ = "\n";
4
5:	use lib '.';
6:	use TestPackage;
7
8:	my $obj = TestPackage->new;
9:	print '$obj->a: ' . $obj->a;
10:	print '$obj->b: ' . $obj->b;
  DB<7> c
TestPackage::_build_a(TestPackage.pm:13):
13:	    return $num;
  DB<7> p $num
3

  DB<8> c
$obj->a: 3
$obj->b: 0
3=3
Debugged program terminated.  Use q to quit or R to restart,

Check 2) in launch.json I activated "debugRaw": true and "debugLog": true and then monitored the OUTPUT console while debugging. The commands there look correct

  1. I see f TestPackage.pm,
  2. b <line> to set breakpoints, and
  3. when breakpoints trigger I see y 0 and y 1

This is exactly as one would expect.

Check 3) read DEBUGGING.md and then confirmed all debugger tests pass:

MacBook-Pro-2:vscode-perl-debug gstead$ npm test

> perl-debug@0.2.4 test /Users/gstead/wm/vscode-perl-debug
> jest --testTimeout=60000

 PASS  src/tests/filePath.test.ts
 PASS  src/tests/breakpointParser.test.ts
 PASS  src/tests/variableParser.test.ts
 PASS  src/tests/perlversion.test.ts
 PASS  src/tests/remote.test.ts
 PASS  src/tests/multisession.test.ts (6.352s)
 PASS  src/tests/connection.test.ts (7.621s)
 PASS  src/tests/adapter.test.ts (15.641s)

Test Suites: 8 passed, 8 total
Tests:       7 skipped, 55 passed, 62 total
Snapshots:   0 total
Time:        16.994s
Ran all test suites.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions