Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322395 - Debugger does not stop at breakpoints added after starting "Debug as PHP Script"
Summary: Debugger does not stop at breakpoints added after starting "Debug as PHP Script"
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 11:37 EDT by Jacek Pospychala CLA
Modified: 2020-05-14 11:16 EDT (History)
1 user (show)

See Also:


Attachments
patch (5.37 KB, patch)
2010-08-11 11:39 EDT, Jacek Pospychala CLA
no flags Details | Diff
patch v2 (1003 bytes, patch)
2010-08-12 07:23 EDT, Jacek Pospychala CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jacek Pospychala CLA 2010-08-11 11:37:16 EDT
Have an opened php file in editor.
No breakpoints were added in the code.
Perform Debug as PHP Script. Break at first line checkbox - ticked.
The debugger will stop at first line.
Add some breakpoints in editor.
Press Resume button in Debug view.

Actual:
The debug session will be terminated at once. The added breakpoints were ignored.

Expected:
The debugger should stop at added breakpoint(s).

Reproducible for all PHP executables.
Comment 1 Jacek Pospychala CLA 2010-08-11 11:37:55 EDT
[... session is starting. adding initial breakpoints:]
Sending syncrhonic request: AddBreakpointRequest [breakPoint=id: 1 type: 1 file name: /var/www/xx/newfile.php line: 5]
Received response: AddBreakpointResponse [breakPointID=1]

[...session is started. adding dynamic breakpoints:]
PHPDebugTarget: Setting Breakpoint - File /xx/newfile.php Line Number 6
Sending asynchronic request: AddBreakpointRequest [breakPoint=id: -1 type: 0 file name: /xx/newfile.php line: 6]
New message received: AddBreakpointResponse [breakPointID=2]
PHPDebugTarget: Setting Breakpoint - File /xx/newfile.php Line Number 7
Sending asynchronic request: AddBreakpointRequest [breakPoint=id: -1 type: 0 file name: /xx/newfile.php line: 7]
New message received: AddBreakpointResponse [breakPointID=3]
PHPDebugTarget: Setting Breakpoint - File /xx/newfile.php Line Number 8
Sending asynchronic request: AddBreakpointRequest [breakPoint=id: -1 type: 0 file name: /xx/newfile.php line: 8]
New message received: AddBreakpointResponse [breakPointID=4] 

so the cause is that during the debug breakpoints are added to local path (/xx/newfile.php) instead to absolute path (/var/www/xx/newfile.php) 
Apparently, when running as web page breakpoints are added using absolute path (correctly), so the local path is used only when running "as script".
Comment 2 Jacek Pospychala CLA 2010-08-11 11:39:05 EDT
Created attachment 176368 [details]
patch

solution is to add PathMapper for "Debug as Script"-based launches.
And on first launch properly configure mapper to resolve absolute paths of workspace files
Comment 3 Jacek Pospychala CLA 2010-08-11 11:39:57 EDT
patch applied.
Comment 4 Jacek Pospychala CLA 2010-08-12 07:23:02 EDT
Created attachment 176452 [details]
patch v2

there seems an easier solution :-)
Comment 5 Jacek Pospychala CLA 2010-08-12 07:36:12 EDT
So it turned out that problem was caused by my earlier fix to bug 306834. In that case we were hitting the IAE when trying to get workspace files for some remote paths, without checking first if they are valid workspace paths. A valid workspace  file path has at least 2 segments (project/file). If file was found in workspace, then it's absolute path was used.
Unfortunately my check was requiring at least 3 segments so workspace with 2segment paths were not translated to absolute paths.
Comment 6 Gadi Goldbarg CLA 2010-08-23 10:38:44 EDT
Verified fixed.
Kalin Yanev
kalin.a@zend.com