microsoft / microsoft/vscode-cpptools

targetArchitecture in launch.json not working

Offen
#1,643 3 Kommentare 1 Reaktion 1 zugewiesene Person Auf GitHub ansehen

@WardenGnaw arbeitet bereits daran.

Seit 08.3.2018.

debugger
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.