microsoft/vscode

Arrow keys (and other) don't work properly with non-standard GDB in integrated terminal

AgainPsychoX opened this issue · 2 comments

Type: Bug

When pressing the keys I get letters:

  • Arrow Up = H
  • Arrow Down = P
  • Arrow Left = K
  • Arrow Right = M
  • Home = G
  • End = O
  • Page Up = I
  • Page Down = Q

Log, incl. the GDB type/version:

PS D:\Projects\+embedded\TestGDBStubForESP8266> . "C:\Users\PsychoX\.platformio\packages\toolchain-xtensa\bin\xtensa-lx106-elf-gdb.exe"
C:\Users\PsychoX\.platformio\packages\toolchain-xtensa\bin\xtensa-lx106-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
GNU gdb (GDB) 8.2.50.20190202-git
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-w64-mingw32 --target=xtensa-lx106-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".   
(gdb) HPKM
Undefined command: "HPKM".  Try "help".
(gdb)

I use PowerShell 7 here, but it's the same with PS 5 and regular CMD. I don't have the problem with other apps. Even the popular MinGW GDB works fine. The issue happens without any extensions enabled as well, but following steps to reproduce include PlatformIO to auto-setup the toolchain. It's terminal / specific GDB version issue I guess. Everything works fine outside the VS Code (be it CMD or Powershell spawned from Windows start menu).

Steps to reproduce:

  1. Install PlatformIO extension (to get the problematic GDB easily)
  2. Open new folder, create platformio.ini with:
    [env]
    platform = espressif8266
    board = nodemcuv2 # v3? 
    framework = arduino
    
    It should install the toolchain that includes the GDB version I have issue with.
  3. Open terminal with PowerShell, use . "$env:USERPROFILE\.platformio\packages\toolchain-xtensa\bin\xtensa-lx106-elf-gdb.exe" to start.
  4. Try write something, then use left/right arrows to move the cursor.

VS Code version: Code 1.91.0 (ea1445c, 2024-07-01T18:52:22.949Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.85GB (6.04GB free)
Process Argv --crash-reporter-id 5ed677a1-ca62-442b-ab0a-0140314bf2c5
Screen Reader no
VM 0%
Extensions (39)
Extension Author (truncated) Version
vscode-css-formatter aes 1.0.2
vscode-tailwindcss bra 0.12.5
codeium Cod 1.8.80
vscode-devtools-for-chrome cod 0.0.7
EditorConfig Edi 0.16.4
json-tools eri 1.0.2
rest-client hum 0.25.1
vscode-ansi ili 1.1.7
reg ion 1.1.0
vscode-env Iro 0.1.0
vscord Leo 5.2.12
vscode-autohotkey-plus-plus mar 5.0.5
git-graph mhu 1.30.0
syntax-mcfunction Min 1.0.0
debugpy ms- 2024.6.0
isort ms- 2023.10.1
python ms- 2024.10.0
vscode-pylance ms- 2024.7.1
cpptools ms- 1.20.5
hexeditor ms- 1.10.0
live-server ms- 0.4.14
powershell ms- 2024.2.2
vscode-paste-image mus 1.0.4
material-icon-theme PKi 5.4.2
platformio-ide pla 3.3.3
vscode-css-peek pra 4.4.1
sqlite-viewer qwt 0.5.10
vscode-xml red 0.27.1
nas-vscode rig 0.0.1
glassit s-n 0.2.6
code-spell-checker str 3.0.1
code-spell-checker-polish str 2.1.2
pdf tom 1.2.2
cursor-align yo1 1.1.2
pretty-ts-errors Yoa 0.5.4
markdown-pdf yza 1.5.0
markdown-all-in-one yzh 3.6.2
json Zai 2.0.2
html-css-class-completion Zig 1.20.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelt:31048053
dsvsc021:30996838
da93g388:31013173
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31082723

I'm not sure why that would be the case. @Tyriar I didn't see any xterm.js issues related to this. Are you familiar with the issue?

I tried to do some more investigating, used Process Monitor to see what differs, attaching the raw PML files and CSVs (zipped due to GitHub policy). There are 3 pairs of files: InsideNotWorking (VS Code), OutsideWorking (PowerShell started from Windows menu), Outside2Working (PowerShell started inside the same path as the project, just in case). PML files can be open and viewed in Process Monitor, while the CSV files I exported and reset timestamps and main process PID to ease comparing.

PML.zip

I noticed that the "not working" case (in VS Code) does more in terms of Windows APIs, reading some registry keys about locale and stuff. I don't know if any of this knowledge is useful, but I am just weirded out by this issue.