error reading variable on Windows Docker Containers

Jonah Graham
Fri Nov 15 17:20:00 GMT 2019

Hello folks,

I have a strange error using GDB on a Windows Docker container and I don't
know where to start in diagnosing the problem.

Simply, when trying to print characters or strings I get "error reading
variable". For example:

(gdb) p 'Z'
$1 = 90 '<error reading variable>
instead of:
$1 = 90 'Z'

Full log below. This is running a Windows Docker container (FROM using msys2's distribution of

Full command and output:

gdb -ex "p 'Z'" -ex "p/x 'Z'" -ex "p \"abcd\"" -ex "quit"
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
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 "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word".
$1 = 90 '<error reading variable>
$2 = 0x5a
$3 = <error reading variable>

What I expect, and what I get on the same version of Windows Pro (1809)
with the identical GDB when running on the host OS is:

$1 = 90 'Z'
$2 = 0x5a
$3 = "abcd"

Any guidance greatly welcome.

PS for those of you who might wonder why, I am in the process of setting up
regression tests on Windows for a VS Code Debug Adapter for GDB by the
Eclipse CDT project: I am
hoping to run these tests in a container to improve reproducibility. At the
moment our tests pass, except the ones for variables.

Thank you,

Jonah Graham
Kichwa Coders

More information about the Gdb mailing list