Debugging with Cloud Shell Editor

The Cloud Shell Editor allows you to easily debug your application. With the editor's inbuilt debugging support, you don't have to worry about any manual setup like setting up port forwarding or injecting language-specific debug arguments. You can create launch configurations, set breakpoints, and inspect variables, all within the editor.

Debugging actions

To access the Cloud Shell Editor's debugging support, navigate to the Debug view with the Debug icon in the Activity bar Debug View icon. Starter templates come with a launch.json file needed to run and debug your application. If your application doesn't have one, you'll be prompted within the Debug View to create one.

Within the Debug View, start a debugging session with the Start icon Start Debugging icon. When prompted, choose the context to run your app in and if applicable, the image registry to use.

Once your debugging session starts, you can manage it with the Debugging action icons: Pause, Step over, Step in, Step out, Restart, Stop.

Debugging start icon along with pause, step over, step in, step out, restart, and stop icons

Setting breakpoints

To set or toggle breakpoints, all you need to do is click in the editor margin, next to the line you'd like to break at. Red circles are active breakpoints while gray ones are inactive breakpoints. If a breakpoint cannot be registered with the debugger when a session starts, it changes to a gray-outlined hollow circle.

Setting a breakpoint at line 8

When running a debugging session, the app stops at the breakpoint and you can inspect the Variables panel in the Debug View to inspect variable values as the app is paused.

Debugging session showing app paused at breakpoint and variable values in scope

Additional Kubernetes debugging support

With the Cloud Shell Editor, you can debug Kubernetes applications on a local cluster (like minikube or Docker Desktop) or a remote cluster on Google Kubernetes Engine or any other Cloud provider. You can also attach a debugger to a Kubernetes pod.

Refer to the Debugging Kubernetes applications using the Cloud Shell Editor guide for more details.