Running PHPUnit in debug mode gives 'Unable to open 'BaseTestRunner.php': File not found' error - visual-studio-code

I am running Homestead on Windows 10 machine with Virtual Box. I have VSCode running on the Windows machine and I want to be able to debug code in the VM.
I have followed this setup:
https://tighten.co/blog/debugging-configure-xdebug-and-laravel-homestead-and-vs-code-and-phpunit
Once I am listening for Xdebug I run my code in the VM using phpunit test/Feature/AdminTest.php and this fails with
Unable to open 'BaseTestRunner.php': File not found
(file:///c:/g/Sites/Laravel/everyone-in-mind/vendor/phpunit/phpunit/src/Runner/BaseTestRunner.php).
Which is obviously showing me the Windows path.
If I stop the debugger and run again the test runs fine.
Do I need to install something extra to get BaseTestRunner?

When you are debuging a PHPUnittest with xDebug in VSCode with the PHPUnit plugin from Elon Mallin, check that you have disable the option Breakpoints/Everything.
It seems as if PHPUnittest, running from the PHPUnit-plugin, could not find the BaseTestRunner.php file and raised an exection. When you ignore this exception, you can run and debug your test.
see the same question PHpUnit with xdebug Breaks at BaseTestRunner instead of the actual test
It works for me and can now debug the Unittest.

Related

How can I debug a launch configuration?

We have a new team member trying to get started with our Godot project. VSCode is our standard editor. Everyone is using Fedora Linux. You can find the relevant files here:
https://github.com/redhat-gamedev/srt-godot-server/tree/main/.vscode
On my machine, when trying to run the launch configuration, the build task succeeds, and then the program is launched. Everything works fine.
On the new team member's machine, when trying to run the launch configuration, the build task succeeds, and then nothing happens. There are no errors. There is no output.
We tried running VSCode with an increased log level (debug), but the VScode log files don't show anything meaningful or related. We tried executing the equivalent launch command from the terminal/shell and it works fine. There are no errors, but the resulting built program executes successfully. Interestingly, running code --verbose does produce a ton of output but nothing super specific to the execution of the steps in the launch configuration. Also, code --verbose --log debug does not cause messages spit out of VSCode to be at the DEBUG log level. Everything is still INFO:
[4183395:0112/092541.932947:INFO:CONSOLE(616)] "%cTRACE color: #888 [File Watcher (parcel)] [CHANGED] ...
How can I debug a launch configuration in VSCode to see what's going on? Is there a way to make the launch configuration system of VSCode be more verbose?

"Terminate" in eclipse's console view leaves node.exe running

I recently started developing for Node.js/Express with Nodeclipse. I added a run configuration for package.json with goal start. This works as expected, the start command from package.json is executed (node ./bin/www). I can see this command in Eclipse's console view and I can see two node.exe processes appear in Windows Task-Manager. HTTP requests to http://localhost:3000/ are logged in the console.
However, klicking the red "Terminate"-Button in Eclipse's console view leaves the node.exe processes running. Subsequent attempts to start the app fail because the port is already in use.
I do not have this problem when I start the app with npm start in Windows cmd. Stopping the execution with Ctrl+C will also exit the node.exe processes.
This is my IDE-Setup:
Eclipse Luna SR2 (4.4.2) under Windows 7 x64 with jre1.8.0_45
Eclipse was setup this way: extracted eclipse-platform-4.4.2-win32-x86_64.zip (from here), installed Eclipse Marketplace Client, then installed Nodeclipse via Drag&Drop from nodeclipse.org
Node.js version v0.12.2 (for Windows x64)
express-generator (version 4.12.1) is installed globally
How can I make the Terminate button in the console view actually terminating the node.exe processes?
It seems that Eclipse only kills the npm script that is used to start up node. The thing is that Eclipse forcibly kills that script, giving it no chance to send any signals to the node.exe process.
This bug explains why this works this way.
Step 1:
Run command-line as an Administrator. Then run the below mention command. type your port number in yourPortNumber
netstat -ano | findstr :yourPortNumber
Red coloured circled area shows the PID (process identifier)
Step 2 :
Then you execute this command after identify the PID.
taskkill /PID typeyourPIDhere /F
P.S. Run the first command again to check if process is still available or not. You'll get empty line if process is successfully ended.

PHPunit and netbeans debugging not stopping at breakpoints

I have am trying to debug some PHPunit tests in netbeans, but it doesn't stop at my break-points.
I can, however, debug the site in the browser and it stops at my breakpoints.
I have modified file->project properties->run configuration->advanced to "do not open web browser".
I use the following script to initiate phpunit :
export XDEBUG_CONFIG="idekey=netbeans-xdebug";
phpunit $#
What could be the problem?
ps. I have had it working in the past, but it stopped working and I had to reinstall xdebug. I am using ubuntu 11.10
Thanks.
This usually happens when your port is not set to listen on xdebug's default listener port 9000.
Here's some instructions on mac for netbeans but it should do the trick even if you're running windows.
http://netbeans.org/kb/docs/php/configure-php-environment-mac-os.html

How to do remote debugging in Eclipse CDT without running `gdbserver` manually on the target every time?

Before each debugging cycle I have to run gdbserver on remote target (Linux). So I was thinking to make script that would call python program that would connect over ssh and would run gdbserver.
I cant find any options to run command before debug and I also try to change .gdbinit file but I am unable tu run python script whit that. Since I am using crosscompiler I cant to get other gdb whit such support.
You don't need to run Python to invoke an external command from GDB. This (in .gdbinit) should work:
shell ssh remote-host gdbserver :12345 /path/to/binary/on/remote &
target remote remote-host:12345
If you do need more complicated ssh setup and need Python for that, you can certainly get it with
shell python your_script.py
If you can't get any external program called from your gdbinit, I see one way of doing it within Eclipse that might work (I didn't tested) but it is not really straightforward...
Create an External Tool configuration that launches your gdbserver program (Python or whatever command line script)
Create a C/C++ application launcher that launch your application to debug
Create a launch group that will call the two previously configured configurations.
Launch the group in debug mode
Eclipse 4.7.0 can connect to SSH and launch gdbserver automatically with the automatic launcher set when creating a new debug connection, without the need for any custom scripts.
I have explained the setup in great detail at: Remote debugging C++ applications with Eclipse CDT/RSE/RDT

Remote GDB with Eclipse

I'm trying to debug an application remotely with Eclipse CDT.
I got gdbserver and gdb running so I can debug via command line.
I'd like to integrate this stuff into Eclipse. I create a .gdbinit file in my home directory which is corretly loaded by Eclipse. However when i start the debug process I get
"the remote target does not support run"
From the command line, I can use "continue" instead, which work. However I cannot use this alternative from CDT since it is somehow automated.
How can I get Eclipse to use continue instead of run, or how can I make my gdbserver to accept run instead of continue?
If your gdb is recent enough to support the alias command, then you can include the line....
alias run = continue
in your .gdbinit file.