Skip to content

Long argument in launch.json is truncated #14054

@balint-bognar-goto

Description

@balint-bognar-goto

Environment

  • OS and version: MacOS Sequoia 15.7.1 (24G231)
  • VS Code: 1.106.1
  • C/C++ extension: 1.28.3
  • OS and version of remote machine (if applicable): -
  • GDB / LLDB version: lldb-1500.0.404.7

Bug Summary and Steps to Reproduce

Bug Summary: When I add a cppdbg launch configuration in launch.json with a very long element in the args list and start the debugging session, the argument gets truncated before passed to the target process.

Steps to reproduce:

  1. Take this very basic example C++ program main.cpp:
#include <print>

int main(int argc, char* argv[]) {
    for (int i = 0; i < argc; ++i) {
        std::print("Argument {}: {}\n", i, argv[i]);
    }
    return 0;
}

  1. Compile it with clang++ -std=c++23 main.cpp -o main
  2. Create a cppdbg launch configuration in launch.json with a very long argument (see debugger configuration).
  3. Launch with the configuration and check the output, the long argument is truncated to 2028 characters (see debugger output).
  4. There is an error message as well at the start of the debug console with the rest of the argument (see debugger output).
  5. Launching the same program with the same argument in the terminal (on its own or through lldb) works as expected, the argument is passed in its entirety.
  6. If I split the argument in two, the second argument gets truncated at the same point (this suggests that the problem might be around JSON array parsing).

Debugger Configurations

{
    "version": "0.2.0",
    "configurations": [
    {
        "name": "(lldb) Launch",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/main",
        "args": ["0000000001-0000000002-0000000003-0000000004-0000000005-0000000006-0000000007-0000000008-0000000009-0000000010-0000000011-0000000012-0000000013-0000000014-0000000015-0000000016-0000000017-0000000018-0000000019-0000000020-0000000021-0000000022-0000000023-0000000024-0000000025-0000000026-0000000027-0000000028-0000000029-0000000030-0000000031-0000000032-0000000033-0000000034-0000000035-0000000036-0000000037-0000000038-0000000039-0000000040-0000000041-0000000042-0000000043-0000000044-0000000045-0000000046-0000000047-0000000048-0000000049-0000000050-0000000051-0000000052-0000000053-0000000054-0000000055-0000000056-0000000057-0000000058-0000000059-0000000060-0000000061-0000000062-0000000063-0000000064-0000000065-0000000066-0000000067-0000000068-0000000069-0000000070-0000000071-0000000072-0000000073-0000000074-0000000075-0000000076-0000000077-0000000078-0000000079-0000000080-0000000081-0000000082-0000000083-0000000084-0000000085-0000000086-0000000087-0000000088-0000000089-0000000090-0000000091-0000000092-0000000093-0000000094-0000000095-0000000096-0000000097-0000000098-0000000099-0000000100-0000000101-0000000102-0000000103-0000000104-0000000105-0000000106-0000000107-0000000108-0000000109-0000000110-0000000111-0000000112-0000000113-0000000114-0000000115-0000000116-0000000117-0000000118-0000000119-0000000120-0000000121-0000000122-0000000123-0000000124-0000000125-0000000126-0000000127-0000000128-0000000129-0000000130-0000000131-0000000132-0000000133-0000000134-0000000135-0000000136-0000000137-0000000138-0000000139-0000000140-0000000141-0000000142-0000000143-0000000144-0000000145-0000000146-0000000147-0000000148-0000000149-0000000150-0000000151-0000000152-0000000153-0000000154-0000000155-0000000156-0000000157-0000000158-0000000159-0000000160-0000000161-0000000162-0000000163-0000000164-0000000165-0000000166-0000000167-0000000168-0000000169-0000000170-0000000171-0000000172-0000000173-0000000174-0000000175-0000000176-0000000177-0000000178-0000000179-0000000180-0000000181-0000000182-0000000183-0000000184-0000000185-0000000186-0000000187-0000000188-0000000189-0000000190-0000000191-0000000192-0000000193-0000000194-0000000195-0000000196-0000000197-0000000198-0000000199-0000000200"],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb"
    }
    ]
}

Debugger Logs

ERROR: Driver. Received command '00000185-0000000186-0000000187-0000000188-0000000189-0000000190-0000000191-0000000192-0000000193-0000000194-0000000195-0000000196-0000000197-0000000198-0000000199-0000000200'. It was not handled. Command '0000000186-0000000187-0000000188-0000000189-0000000190-0000000191-0000000192-0000000193-0000000194-0000000195-0000000196-0000000197-0000000198-0000000199-0000000200' not in Command Factory
...
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
...
=thread-selected,id="1"
Argument 0: /Users/bbognar/Dev/args/main
Argument 1: 0000000001-0000000002-0000000003-0000000004-0000000005-0000000006-0000000007-0000000008-0000000009-0000000010-0000000011-0000000012-0000000013-0000000014-0000000015-0000000016-0000000017-0000000018-0000000019-0000000020-0000000021-0000000022-0000000023-0000000024-0000000025-0000000026-0000000027-0000000028-0000000029-0000000030-0000000031-0000000032-0000000033-0000000034-0000000035-0000000036-0000000037-0000000038-0000000039-0000000040-0000000041-0000000042-0000000043-0000000044-0000000045-0000000046-0000000047-0000000048-0000000049-0000000050-0000000051-0000000052-0000000053-0000000054-0000000055-0000000056-0000000057-0000000058-0000000059-0000000060-0000000061-0000000062-0000000063-0000000064-0000000065-0000000066-0000000067-0000000068-0000000069-0000000070-0000000071-0000000072-0000000073-0000000074-0000000075-0000000076-0000000077-0000000078-0000000079-0000000080-0000000081-0000000082-0000000083-0000000084-0000000085-0000000086-0000000087-0000000088-0000000089-0000000090-0000000091-0000000092-0000000093-0000000094-0000000095-0000000096-0000000097-0000000098-0000000099-0000000100-0000000101-0000000102-0000000103-0000000104-0000000105-0000000106-0000000107-0000000108-0000000109-0000000110-0000000111-0000000112-0000000113-0000000114-0000000115-0000000116-0000000117-0000000118-0000000119-0000000120-0000000121-0000000122-0000000123-0000000124-0000000125-0000000126-0000000127-0000000128-0000000129-0000000130-0000000131-0000000132-0000000133-0000000134-0000000135-0000000136-0000000137-0000000138-0000000139-0000000140-0000000141-0000000142-0000000143-0000000144-0000000145-0000000146-0000000147-0000000148-0000000149-0000000150-0000000151-0000000152-0000000153-0000000154-0000000155-0000000156-0000000157-0000000158-0000000159-0000000160-0000000161-0000000162-0000000163-0000000164-0000000165-0000000166-0000000167-0000000168-0000000169-0000000170-0000000171-0000000172-0000000173-0000000174-0000000175-0000000176-0000000177-0000000178-0000000179-0000000180-0000000181-0000000182-0000000183-0000000184-000

Other Extensions

No response

Additional Information

Same issue reportedfor VSCode (but never reposted here despite VSCode developers suggested it): microsoft/vscode#235054

Thanks if you can look into this! I would love to see this bug fixed ofc, but I'm also interested in possible workarounds, e.g. if I can launch a debugging session where the target process receives its arguments through xargs or any other way which bypasses this limitation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdebuggerhelp wantedCan be fixed in the public (open source) repo.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions