Selecting source code automatically

Stackdriver Debugger uses source context information to display the correct version of your source code on the Debug page. The source context information is captured in a source-context.json file, which is generated from a Git repository and deployed with your application.

Before you begin

Setup on Google Cloud Platform

Follow the steps below to select your source code automatically:

Java

  1. Commit your latest changes.
  2. Run the following in the root directory of your local Git repository:
  3. gcloud debug source gen-repo-info-file --output-directory="WEB-INF/classes/"
  4. Deploy (or redeploy) your app from the Git repository, including the source-context.json file.

The correct version of your source code now appears automatically on the Debugger page.

Python

  1. Commit your latest changes.
  2. Run the following in the root directory of your local Git repository:
  3. gcloud debug source gen-repo-info-file --output-directory=[MODULE_PACKAGE_DIR]

    [MODULE_PACKAGE_DIR] is the top level of your app directory.

  4. Deploy (or redeploy) your app from the Git repository, including the source-context.json file.

The correct version of your source code now appears automatically on the Debugger page.

Node.js

  1. Commit your latest changes.
  2. Run the following in the root directory of your local Git repository:
  3. gcloud debug source gen-repo-info-file --output-directory=[MODULE_PACKAGE_DIR]

    [MODULE_PACKAGE_DIR] is the top level of your app directory.

  4. Deploy (or redeploy) your app from the Git repository, including the source-context.json file.

The correct version of your source code now appears automatically on the Debugger page.

.Net Core

  1. Commit your latest changes.
  2. Run the following in the root directory of your local Git repository:
  3. gcloud debug source gen-repo-info-file --output-directory=[MODULE_PACKAGE_DIR]

    [MODULE_PACKAGE_DIR] is the top level of your app directory.

  4. Deploy (or redeploy) your app from the Git repository, including the source-context.json file.

The correct version of your source code now appears automatically on the Debugger page.

App Engine standard environment: Python 2 and Java 8

When you deploy your app, a WEB-INF/classes/source-context.json file is automatically generated and uploaded with your application.

Was this page helpful? Let us know how we did:

Send feedback about...

Stackdriver Debugger