Skip to content

GDB Python type pretty-printer not used in debugger #1983

@borisavz

Description

@borisavz

Type: Bug

I am developing a debugger for a language transpiled to C. I have studied GDB Python API and implemented pretty-printers for stack frames (FrameFilter/FrameDecorator) and custom data types (ValuePrinter) that work as expected both from VSCode debugger and from GDB CLI.

For some reason, type pretty-printer (TypePrinter/TypeRecognizer) does not work when using VSCode debugger, but works as expected from GDB CLI. I have enabled pretty printing (-enable-pretty-printing) and frame filtering (-enable-frame-filters). I did not find any option for specifically enabling type pretty-printers in the VSCode documentation.

I use typedef to denote custom types from my language so they can be observed as special types in GDB Python API. In GDB CLI, ptype should write type with unwrapped typedef-s, while whatis should write either type name (without unwrapping) or pretty-printed type (if type pretty-printer is installed). When I register custom type pretty-printer, both CLI commands behave as expected. VSCode debugger prints typedef name even if type-pretty printer is installed. This means that the behavior is equivalent to whatis without type-pretty printer.

For this reason, I suspect that either VSCode does not properly interact with GCC DAP for type info or that GCC DAP implementation does not properly use type pretty-printers (which I consider as the less likely option).

If needed, I can create a simplified version of custom debugger for reproduction purposes, stripped from unneeded details of my language.

VS Code version: Code 1.93.1 (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z)
OS version: Linux x64 6.8.0-49-generic
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 3399)
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 15.36GB (8.63GB free)
Process Argv --crash-reporter-id d8473509-49e3-47f0-aa6d-823411298eb1
Screen Reader no
VM 0%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE wayland
Extensions (11)
Extension Author (truncated) Version
gcov-viewer Jac 0.6.0
compare Joz 0.0.3
debugpy ms- 2024.12.0
python ms- 2024.14.1
vscode-pylance ms- 2024.11.3
cmake-tools ms- 1.19.52
cpptools ms- 1.22.11
cpptools-extension-pack ms- 1.3.0
llvm RRe 0.2.0
cmake twx 0.0.17
vscode-typhoondsl Typ 0.4.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
f3je6385:31013174
dvdeprecation:31068756
dwnewjupytercf:31046870
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31185841
cf971741:31144450
iacca1:31171482
notype1:31157159
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions