Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break points not working #659

Closed
marlboroman3 opened this issue Sep 22, 2021 · 9 comments
Closed

Break points not working #659

marlboroman3 opened this issue Sep 22, 2021 · 9 comments

Comments

@marlboroman3
Copy link

Similar to issue #652, my debugger suddenly refuses to stop at any breakpoint. I am executing in a Codeigniter 3 framework, on WAMP with Apache 2.4.39. In the execution logs provided, I have a single breakpoint set on line 66 of index.php. I'll work on reproducing the fault with a simpler setup.

VSCode: v1.60.1
PHP Debug: v1.18.0
Xdebug: v3.0.4
PHP: 7.4.19

php.ini:

zend_extension = c:\wamp64\bin\php\php7.4.19\ext\php_xdebug-3.0.4-7.4-vc15-x86_64.dll
xdebug.log = c:\temp\xdebug.log
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.max_nesting_level = 256

Checking the zend extension DLL exists:

C:\>dir c:\wamp64\bin\php\php7.4.19\ext\php_xdebug-3.0.4-7.4-vc15-x86_64.dll
 Volume in drive C is Windows
 Volume Serial Number is C2BC-737E

 Directory of c:\wamp64\bin\php\php7.4.19\ext

21/05/2021  10:31 AM           306,176 php_xdebug-3.0.4-7.4-vc15-x86_64.dll
               1 File(s)        306,176 bytes
               0 Dir(s)  197,648,015,360 bytes free

launch.json:

    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "log": true
        },
    ]
}

Debug console:

xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/wamp64/www/foo/index.php" language="PHP" xdebug:language_version="7.4.17RC1" protocol_version="1.0" appid="15916"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
xd(1) <- feature_set -i 1 -n resolved_breakpoints -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>
xd(1) <- feature_set -i 2 -n notify_ok -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>
xd(1) <- feature_set -i 3 -n extended_properties -v 1
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>
<- threadEvent
ThreadEvent {
  seq: 0,
  type: 'event',
  event: 'thread',
  body: { reason: 'started', threadId: 1 }
}
xd(1) <- breakpoint_set -i 4 -t line -f file:///c:/wamp64/www/foo/index.php -n 66
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><notify xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" name="breakpoint_resolved"><breakpoint type="line" resolved="resolved" filename="file:///C:/wamp64/www/foo/index.php" lineno="66" state="enabled" hit_count="0" hit_value="0" id="159160002"></breakpoint></notify>
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4" id="159160002" resolved="resolved"></response>
xd(1) <- breakpoint_get -i 5 -d 159160002
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_get" transaction_id="5"><breakpoint type="line" resolved="resolved" filename="file:///C:/wamp64/www/foo/index.php" lineno="66" state="enabled" hit_count="0" hit_value="0" id="159160002"></breakpoint></response>
<- breakpointEvent
BreakpointEvent {
  seq: 0,
  type: 'event',
  event: 'breakpoint',
  body: {
    reason: 'changed',
    breakpoint: { id: 1, verified: true, line: 66 }
  }
}
xd(1) <- run -i 6
xd(1) -> <?xml version="1.0" encoding="iso-8859-1"?><response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="6" status="break" reason="ok"><xdebug:message filename="file:///C:/wamp64/www/foo/index.php" lineno="66"></xdebug:message></response>
<- stoppedEvent
StoppedEvent {
  seq: 0,
  type: 'event',
  event: 'stopped',
  body: { reason: 'breakpoint', threadId: 1, allThreadsStopped: false }
}
-> threadsRequest
{ command: 'threads', type: 'request', seq: 8 }
<- threadsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 8,
  command: 'threads',
  success: false,
  message: 'TypeError: moment is not a function\n' +
    '    at c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:114\n' +
    '    at Array.map (<anonymous>)\n' +
    '    at PhpDebugSession.threadsRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:34)\n' +
    '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\debugSession.js:438:22)\n' +
    '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:407:15)\n' +
    '    at PhpDebugSession.handleMessage (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:61:18)\n' +
    '    at PhpDebugSession._handleData (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:155:34)\n' +
    '    at Socket.<anonymous> (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:80:44)\n' +
    '    at Socket.emit (events.js:315:20)\n' +
    '    at addChunk (internal/streams/readable.js:309:12)',
  body: {
    error: {
      id: 1104,
      format: '{_stack}',
      variables: {
        _exception: 'moment is not a function',
        _stack: 'TypeError: moment is not a function\n' +
          '    at c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:114\n' +
          '    at Array.map (<anonymous>)\n' +
          '    at PhpDebugSession.threadsRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:34)\n' +
          '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\debugSession.js:438:22)\n' +
          '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:407:15)\n' +
          '    at PhpDebugSession.handleMessage (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:61:18)\n' +
          '    at PhpDebugSession._handleData (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:155:34)\n' +
          '    at Socket.<anonymous> (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:80:44)\n' +
          '    at Socket.emit (events.js:315:20)\n' +
          '    at addChunk (internal/streams/readable.js:309:12)'
      },
      sendTelemetry: true
    }
  }
}
-> threadsRequest
{ command: 'threads', type: 'request', seq: 9 }
<- threadsResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 9,
  command: 'threads',
  success: false,
  message: 'TypeError: moment is not a function\n' +
    '    at c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:114\n' +
    '    at Array.map (<anonymous>)\n' +
    '    at PhpDebugSession.threadsRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:34)\n' +
    '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\debugSession.js:438:22)\n' +
    '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:407:15)\n' +
    '    at PhpDebugSession.handleMessage (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:61:18)\n' +
    '    at PhpDebugSession._handleData (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:155:34)\n' +
    '    at Socket.<anonymous> (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:80:44)\n' +
    '    at Socket.emit (events.js:315:20)\n' +
    '    at addChunk (internal/streams/readable.js:309:12)',
  body: {
    error: {
      id: 1104,
      format: '{_stack}',
      variables: {
        _exception: 'moment is not a function',
        _stack: 'TypeError: moment is not a function\n' +
          '    at c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:114\n' +
          '    at Array.map (<anonymous>)\n' +
          '    at PhpDebugSession.threadsRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:34)\n' +
          '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\debugSession.js:438:22)\n' +
          '    at PhpDebugSession.dispatchRequest (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:407:15)\n' +
          '    at PhpDebugSession.handleMessage (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:61:18)\n' +
          '    at PhpDebugSession._handleData (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:155:34)\n' +
          '    at Socket.<anonymous> (c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\node_modules\\vscode-debugadapter\\lib\\protocol.js:80:44)\n' +
          '    at Socket.emit (events.js:315:20)\n' +
          '    at addChunk (internal/streams/readable.js:309:12)'
      },
      sendTelemetry: true
    }
  }
}

Xdebug log:

[15916] [Step Debug] INFO: Connecting to configured address/port: localhost:9000.
[15916] [Step Debug] INFO: Connected to debugging client: localhost:9000 (through xdebug.client_host/xdebug.client_port). :-)
[15916] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/wamp64/www/foo/index.php" language="PHP" xdebug:language_version="7.4.17RC1" protocol_version="1.0" appid="15916"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>

[15916] [Step Debug] <- feature_set -i 1 -n resolved_breakpoints -v 1
[15916] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="resolved_breakpoints" success="1"></response>

[15916] [Step Debug] <- feature_set -i 2 -n notify_ok -v 1
[15916] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="notify_ok" success="1"></response>

[15916] [Step Debug] <- feature_set -i 3 -n extended_properties -v 1
[15916] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="extended_properties" success="1"></response>

[15916] [Step Debug] <- breakpoint_set -i 4 -t line -f file:///c:/wamp64/www/foo/index.php -n 66
[15916] [Step Debug] -> <notify xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" name="breakpoint_resolved"><breakpoint type="line" resolved="resolved" filename="file:///C:/wamp64/www/foo/index.php" lineno="66" state="enabled" hit_count="0" hit_value="0" id="159160002"></breakpoint></notify>

[15916] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="4" id="159160002" resolved="resolved"></response>

[15916] [Step Debug] <- breakpoint_get -i 5 -d 159160002
[15916] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_get" transaction_id="5"><breakpoint type="line" resolved="resolved" filename="file:///C:/wamp64/www/foo/index.php" lineno="66" state="enabled" hit_count="0" hit_value="0" id="159160002"></breakpoint></response>

[15916] [Step Debug] <- run -i 6
[15916] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="6" status="break" reason="ok"><xdebug:message filename="file:///C:/wamp64/www/foo/index.php" lineno="66"></xdebug:message></response>

xdebug_info() output:
![Screenshot 2021-09-22 at 14-05-22 Xdebug 3 0 4](https://user-images.githubusercontent.com/30033703/134282351-9463bc06-e3a9-49e7-9500-f46a29809b74.png)
![Screenshot 2021-09-22 at 14-05-13 Xdebug 3 0 4](https://user-images.githubusercontent.com/30033703/134282354-d04c1e90-431f-489d-8db0-301af9ab23b5.png)
@marlboroman3
Copy link
Author

Screenshot 2021-09-22 at 14-05-22 Xdebug 3 0 4
Screenshot 2021-09-22 at 14-05-13 Xdebug 3 0 4

@zobo
Copy link
Contributor

zobo commented Sep 22, 2021

Hi!
Thanks for the report. I see an error being reported in the debugger. Will look at it right away.

@zobo
Copy link
Contributor

zobo commented Sep 22, 2021

What I see from the logs is that the beakpoint most definitely happens, so it's not an issue of path mappings of xdebug, but then when VS Code requests a list of threads an error happens in the extension:

  message: 'TypeError: moment is not a function\n' +
    '    at c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0\\out\\phpDebug.js:499:114\n' +
    '    at Array.map (<anonymous>)\n' +

I tried all sorts of combinations but could not yet bring my install to reproduce this.

I have a big ask @marlboroman3 . Could you zip up the extension folder on your PC c:\\Users\\spamh\\.vscode\\extensions\\felixfbecker.php-debug-1.18.0 and attach it here?

Maybe I'll be able to reproduce it like this. I'll keep researching the issue.

Also, after sending me the zip, can you try previous version?
image

Thanks!

@marlboroman3
Copy link
Author

After installing v1.17.0 everything seems to be working fine again.

I have attached the zip of v1.18.0

felixfbecker.php-debug-1.18.0.zip

@zobo
Copy link
Contributor

zobo commented Sep 23, 2021

Wow, this is... strange. I compared your installation and mine and the only two differences are the installation timestamp and that your moment.js is empty.

image

image

There must have been an error during installation. Try to install 1.18 again and see if it's fixed. Maybe there's an issue with some other software, like an anti virus.

You can also download the installation directly from marketplace https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug (right side, Download Extension) and install it directly from .vsix file.

I hope this works, as I can hardly do much about it aside from sending you my installed extension :)

@marlboroman3
Copy link
Author

I have now install v1.19.0 and everything is working. Thanks for all your help.

@zobo
Copy link
Contributor

zobo commented Oct 1, 2021

Great to hear! I hope it's a one-off this that will forever remain a mystery...

@zobo zobo closed this as completed Oct 1, 2021
@avivamientodev
Copy link

Hi Zobo, I have an iMac with macOS Monterrey and I'm experiencing exactly the same problem, yesterday in the afternoon it was working perfectly, I turned off my computer and when I returned to work, the problem was there. Now the only thing that works is using xebug_break() and the Start Debugging option. If you take a look to the attached images, the first one is with the "Listen for Xdebug" option active. Thanks in advance !!

xdebug_01

xdebug_02

@zobo
Copy link
Contributor

zobo commented Jul 28, 2022

Hi. I'm currently traveling so my replies will have some delay. From the two screenshots I can only see that in the first there was no debugging session and in the second Xdebug failed to connect to VS Code.

Please open a new issue, and attach the log from vscode debug console. The issue template should have some instruction on how to enable log: true. Also attach a log where you use xdebug_break() so I can compare how the paths are seen by the deubgger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants