microsoft / microsoft/vscode-cpptools

targetArchitecture in launch.json not working

Open
#1,643 3 comments 1 reaction 1 assignee View on GitHub

@WardenGnaw is already working on this.

Since Mar 8, 2018.

debugger
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

From @salvioli on March 5, 2018 23:42

Issue Type

Bug

Description

I have the following 32 bit executable compiled for i386:

kernel-x86_64-007: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped

When I launch qemu with the command (to wait for a gdb client incoming connection):

qemu-system-x86_64 -kernel ./build/kernel-x86_64-007 -S -gdb tcp::9001

with the following configuration of launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "targetArchitecture": "x64", // ====== (test 1)
            "miDebuggerServerAddress": "localhost:9001",
            "program": "build/kernel-x86_64-007",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                // ====== (test 2)
                // {
                //     "description": "Set debuggee architecture",
                //     "text": "set archi i386:x86-64",
                //     "ignoreFailures": true
                // }
            ]
        }
    ]
}

I see the following error as expected because target architecture is not matching with the real one:

Unable to start debugging. Unexpected GDB output from command "-target-select remote localhost:9001". Remote 'g' packet reply is too long (expected 312 bytes, got 536 bytes): 0000000000000000000000000000000000000000000000006306000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0ff0000000000000200000000f000000000000000000000000000000000000000000

if I comment the targetArchitecture line (the line tagged test 1) and uncomment the set archi command below (the command tagged test 2), I succesfully enter a debugging session with no error.

I tried the same with other values for targetArchitecture such as: x86_64 or amd64 but none works.

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9137d24d36d968ea6b2911786bfe103002, 2018-02-13T15:31:21.019Z)
OS version: Linux x64 4.13.0-36-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz (4 x 1696)
Load (avg) 1, 1, 0
Memory (System) 7.67GB (0.21GB free)
Process Argv /usr/share/code/code --unity-launch
Screen Reader no
VM 0%
Extensions (8)
Extension Author (truncated) Version
language-x86-64-assembly 13x 2.2.11
vscode-docker Pet 0.0.25
githistory don 0.4.0
gitlens eam 8.0.2
CppSnippets har 0.0.13
cpptools ms- 0.15.0
rewrap stk 1.8.0
cmake-tools vec 0.10.4
Reproduces without extensions

Copied from original issue: Microsoft/vscode#45097

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.