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

Allow pre-filling launch/attach on command line to adapter #228

Merged
merged 5 commits into from
Jan 26, 2023

Commits on Jan 25, 2023

  1. Factor out common code in attach/launch request methods

    The majority of the code in attach/launch request is the same
    with just small differences based on whether to execute the
    target program or not.
    
    This is a code cleanup that makes it easier to implement eclipse-cdt-cloud#227
    jonahgraham committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    5943488 View commit details
    Browse the repository at this point in the history
  2. better error message on missing program field in launch request

    Prior to this change the error message said "Error: arg is not iterable"
    it now says "The program must be specified in the launch request arguments"
    jonahgraham committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    819e523 View commit details
    Browse the repository at this point in the history
  3. Increase timeout on Windows to 25s in previously missed locations

    Most of the timeouts for tests are the mocha timeouts, but DebugClient
    has its own timeout values. This change synchronizes those values.
    
    This increased timeout is specifically needed for the attachRemote
    test which takes more than 5 seconds to do the initial connection
    on the GitHub actions build regularly.
    
    This is a follow up to commit 3708cea
    part of eclipse-cdt-cloud#222
    jonahgraham committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    6c554c1 View commit details
    Browse the repository at this point in the history
  4. Allow passing command line arguments to adapter without shell

    Remove shell=true when spawning adapter in tests
    
    The shell=true was a workaround so that arguments could be
    passed to node. But it leads to platform specific handling.
    Therefore remove the shell=true which also means the workarounds
    that would have been needed to quote JSON on the command line
    properly are not needed.
    
    Needed to test eclipse-cdt-cloud#227
    jonahgraham committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    9b503f4 View commit details
    Browse the repository at this point in the history
  5. Allow pre-filling launch/attach on command line to adapter

    Start the adapter using the given configuration as a starting point
    for the args in `launch` or `attach` request.
    
    For example, the default GDB can be set like this:
    
    ```sh
        node debugTargetAdapter.js --config='{"gdb":"arm-none-eabi-gdb"}'
    ```
    
    The config can be passed on the command line as JSON, or a response
    file can be used by starting the argument with `@`.
    The rest of the argument will be interpreted as a file name to read.
    For example, to start the adapter defaulting to a process ID to
    attach to, create a file containing the JSON and reference it like this:
    
    ```sh
        cat >config.json <<END
        {
          "processId": 1234
        }
        END
        node debugAdapter.js [email protected]
    
    ```
    
    Similar to `--config`, the `--config-frozen` sets the provided
    configuration fields in the args to the `launch` or `attach` request
    to the given values, not allowing the user to override them.
    Specifying which type of request is allowed (`launch` or `attach`)
    can be specified with the `request` field.
    
    For example, the adapter can be configured for program to be frozen
    to a specific value.
    This may be useful for starting adapters in a container and exposing
    the server port.
    
    ```sh
        node debugAdapter.js --server=23221 --config-frozen='{"program":"/path/to/my.elf"}'
    ```
    
    Fixes eclipse-cdt-cloud#227
    jonahgraham committed Jan 25, 2023
    Configuration menu
    Copy the full SHA
    5551015 View commit details
    Browse the repository at this point in the history