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

connection between debug server and debugger is not working on macOS, although it works on the terminal #1067

Open
omarArm opened this issue Dec 18, 2024 · 0 comments

Comments

@omarArm
Copy link

omarArm commented Dec 18, 2024

Describe the bug
I am trying to use the Cortex-Debug extension to have a nice UI while using pyOCD as a debug server. The problem is that I always receive one of three errors, they all happen with the same configuration. They appear to switch between each other randomly.
The three errors are the following:

  1. Failed to launch GDB: Remote connection closed (from target-select extended-remote localhost:50000)
  2. Failed to launch GDB: Could not read registers; remote failure reply 'E01' (from target-select extended-remote localhost:50000)
  3. Failed to launch GDB: Malformed response to offset query, timeout (from target-select extended-remote localhost:50000)

Note that everything works just fine if I am using the terminal instead of the vscode extension. Worth mentioning that I use different port numbers though (3333 instead of 50000)

To Reproduce

  1. Set up a default launch.json for pyOCD
  2. Start a debug session

Expected behavior

To start a debug session on VScode with no problems

Environment:

  • Cortex-Debug Version 1.12.1
  • OS: macOS, Sequoia 15.1.1, M2 chip
  • GDB Version: GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git
  • Compiler Toolchain Version: GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git
  • pyOCD version: 0.36.0

launch.json

{
            "cwd": "${workspaceFolder}",
            "executable": "${workspaceFolder}/armgcc/debug/led_blinky_cm0.elf",
            "name": "Debug with PyOCD",
            "request": "launch",
            "type": "cortex-debug",
            "runToEntryPoint": "main",
            "showDevDebugOutput": "raw",
            "servertype": "pyocd",
            "serverArgs": []
}

Debug Console

Cortex-Debug: VSCode debugger extension version 1.12.1 git(652d042). Usage info: https://github.com/Marus/cortex-debug#usage
"configuration": {
    "cwd": "/Users/omaelk01/Library/CloudStorage/OneDrive-Arm/Documents/workspace/led_blinky",
    "executable": "/Users/omaelk01/Library/CloudStorage/OneDrive-Arm/Documents/workspace/led_blinky/armgcc/debug/led_blinky_cm0.elf",
    "name": "Debug with PyOCD",
    "request": "launch",
    "type": "cortex-debug",
    "runToEntryPoint": "main",
    "showDevDebugOutput": "raw",
    "servertype": "pyocd",
    "serverArgs": [],
    "gdbServerConsolePort": 60000,
    "pvtAvoidPorts": [],
    "chainedConfigurations": {
        "enabled": false
    },
    "debuggerArgs": [],
    "swoConfig": {
        "enabled": false,
        "decoders": [],
        "cpuFrequency": 0,
        "swoFrequency": 0,
        "source": "probe"
    },
    "rttConfig": {
        "enabled": false,
        "decoders": []
    },
    "graphConfig": [],
    "preLaunchCommands": [],
    "postLaunchCommands": [],
    "preAttachCommands": [],
    "postAttachCommands": [],
   "preRestartCommands": [],
    "postRestartCommands": [],
    "preResetCommands": [],
    "postResetCommands": [],
    "toolchainPrefix": "arm-none-eabi",
    "extensionPath": "/Users/omaelk01/.vscode/extensions/marus25.cortex-debug-1.12.1",
    "registerUseNaturalFormat": true,
    "variableUseNaturalFormat": true,
    "pvtVersion": "1.12.1",
    "__sessionId": "b60f7ef9-3dcd-48d5-8e9c-1171b8f0b7d7",
    "pvtShowDevDebugOutput": "raw"
}
Reading symbols from arm-none-eabi-objdump --syms -C -h -w /Users/omaelk01/Library/CloudStorage/OneDrive-Arm/Documents/workspace/led_blinky/armgcc/debug/led_blinky_cm0.elf
Reading symbols from arm-none-eabi-nm --defined-only -S -l -C -p /Users/omaelk01/Library/CloudStorage/OneDrive-Arm/Documents/workspace/led_blinky/armgcc/debug/led_blinky_cm0.elf
Launching GDB: arm-none-eabi-gdb -q --interpreter=mi2
1-gdb-version
Launching gdb-server: pyocd gdbserver --port 50000 --telnet-port 50001
    Please check TERMINAL tab (gdb-server) for output from pyocd
Finished reading symbols from objdump: Time: 23 ms
Finished reading symbols from nm: Time: 39 ms
-> =thread-group-added,id="i1"
-> ~"GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git\n"
-> ~"Copyright (C) 2023 Free Software Foundation, Inc.\n"
-> ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
-> ~"\nType \"show copying\" and \"show warranty\" for details.\n"
-> ~"This GDB was configured as \"--host=aarch64-apple-darwin20.6.0 --target=arm-none-eabi\".\n"
-> ~"Type \"show configuration\" for configuration details.\n"
-> ~"For bug reporting instructions, please see:\n"
-> ~"<https://bugs.linaro.org/>.\n"
-> ~"Find the GDB manual and other documentation resources online at:\n    <"
-> ~"http://www.gnu.org/software/gdb/documentation/>.\n\n"
-> ~"For help, type \"help\".\n"
-> ~"Type \"apropos word\" to search for commands related to \"word\".\n"
-> 1^done
2-gdb-set mi-async on
-> 2^done
3-interpreter-exec console "set print demangle on"
-> 3^done
4-interpreter-exec console "set print asm-demangle on"
-> =cmd-param-changed,param="print asm-demangle",value="on"
-> 4^done
5-enable-pretty-printing
-> 5^done
6-interpreter-exec console "source /Users/omaelk01/.vscode/extensions/marus25.cortex-debug-1.12.1/support/gdbsupport.init"
-> 6^done
7-interpreter-exec console "source /Users/omaelk01/.vscode/extensions/marus25.cortex-debug-1.12.1/support/gdb-swo.init"
-> =cmd-param-changed,param="language",value="c"
-> =cmd-param-changed,param="language",value="auto"
-> 7^done
8-interpreter-exec console "set output-radix 0xa"
-> ~"Output radix now set to decimal 10, hex a, octal 12.\n"
Output radix now set to decimal 10, hex a, octal 12.
-> 8^done
9-interpreter-exec console "set input-radix 0xa"
-> ~"Input radix now set to decimal 10, hex a, octal 12.\n"
Input radix now set to decimal 10, hex a, octal 12.
-> 9^done
10-file-exec-and-symbols "/Users/omaelk01/Library/CloudStorage/OneDrive-Arm/Documents/workspace/led_blinky/armgcc/debug/led_blinky_cm0.elf"
-> 10^done
11-target-select extended-remote localhost:50000
-> 11^error,msg="Remote connection closed"
12-interpreter-exec console "set mem inaccessible-by-default off"
Failed to launch GDB: Remote connection closed (from target-select extended-remote localhost:50000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant