error reading variable on Windows Docker Containers

Jonah Graham jonah@kichwacoders.com
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
mcr.microsoft.com/windows/servercore:1809) using msys2's distribution of
mingw-w64-x86_64-gdb.


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 <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 "x86_64-w64-mingw32".
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".
$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: https://github.com/eclipse-cdt/cdt-gdb-adapter. 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


~~~
Jonah Graham
Kichwa Coders
www.kichwacoders.com



More information about the Gdb mailing list