Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gdb fail

90 views
Skip to first unread message

jak

unread,
Mar 30, 2023, 1:37:27 PM3/30/23
to
Hi everyone,
I installed msys2 with C compiler on my windows 10 system and its
console works fine. It also works well using the codeblocks gui from
windows and, adding the path to the PATH, I can also compile from the
cmd prompt but gdb doesn't work. Could anyone tell me how to fix the
problem?
This is what it displays when giving the 'l' command from gdb:

Copyright (C) 2023 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:
<https://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"...
Reading symbols from pp...
(gdb) l
1
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/misc/mbrtowc.c: No
such file or directory.
(gdb) l
1 in C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/misc/mbrtowc.c
(gdb)

Scott Lurndal

unread,
Mar 30, 2023, 1:52:23 PM3/30/23
to
That's not a problem with gdb. It can't find the source for the
crt (C Runtime) that comes with mingw. Either you didn't install
it, or you installed it in a different directory.

Try setting a breakpoint on main, then run to breakpoint and
use the 'l' command.

(gdb) b main
(gdb) r
...
(gdb) l

jak

unread,
Mar 30, 2023, 2:54:33 PM3/30/23
to
Scott Lurndal ha scritto:
It gives the same problem. Now I've had a look with the 'show
configuration' command and, of course, all paths are configured by the
installation in msys2:

******************
This GDB was configured as follows:
configure
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-auto-load-dir=$debugdir:$datadir/auto-load
--with-auto-load-safe-path=$debugdir:$datadir/auto-load
--with-expat
-> --with-gdb-datadir=/mingw64/share/gdb (relocatable)
-> --with-jit-reader-dir=/mingw64/lib/gdb (relocatable)
--without-libunwind-ia64
--with-lzma
--without-babeltrace
--without-intel-pt
--with-mpfr
--with-xxhash
-> --with-python=/mingw64 (relocatable)
-> --with-python-libdir=/mingw64/lib (relocatable)
--without-debuginfod
--without-guile
--disable-source-highlight
--enable-threading
-> --with-separate-debug-dir=/mingw64/lib/debug (relocatable)
-> --with-system-gdbinit=/mingw64/etc/gdbinit (relocatable)
******************

Now the question would be: is there a way to split the configuration
when in msys2 environment and when in cmd environment?

Öö Tiib

unread,
Mar 31, 2023, 5:05:17 AM3/31/23
to
It seems to be that gdb is confused about where the c runtime source
code is located. You want to debug C runtime? It seemingly tells to
you that it expects the mbrtowc.c to be:
"C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/misc/mbrtowc.c"
It is not the case? Why? Apparently your C runtime (used in cmd environment
build) was built so that the file was in that location.

jak

unread,
Mar 31, 2023, 5:34:53 AM3/31/23
to
Öö Tiib ha scritto:
The program I'm debugging is just a 'hello world' like, written in C and
gcc compiled with the '-g' option. The file "C:/M/mingw-w64-crt-git/src
/mingw-w64/mingw-w64-crt/misc/mbrtowc.c" on my disk doesn't exist and
neither does its path. I didn't build gcc but installed 'msys2' from
which I installed the development toolchains, which works with
msys2/bash, windows/codeblocks and windows/cmd but windows/cmd/gdb is an
exception and doesn't work fine.

Öö Tiib

unread,
Mar 31, 2023, 8:27:15 AM3/31/23
to
So you want to list code in debugger that is not in mbrtowc.c,
but something else "hello word like", but debugger complains that it can't
find source code for mbrtowc.c?

> The file "C:/M/mingw-w64-crt-git/src
> /mingw-w64/mingw-w64-crt/misc/mbrtowc.c" on my disk doesn't exist and
> neither does its path. I didn't build gcc but installed 'msys2' from

It is not gcc, it is C standard library file there.

> which I installed the development toolchains, which works with
> msys2/bash, windows/codeblocks and windows/cmd but windows/cmd/gdb is an
> exception and doesn't work fine.

What does it mean "works with"? Do the msys2/bash and windows/codeblocks list
you contents of mbrtowc.c when you use list command from those?

0 new messages