The current Msys2 debugger is at 9.2.3:

gdb     9.2-3   GNU Debugger (MSYS2 version)

As mentioned in another email, the mingw-w64-x86_64-gdb 10.1-2 does handle 
breakpoints correctly, so I'll try a 10.x Msys2 version of gdb when it becomes 
available.

-----Original Message-----
From: Hannes Domani <ssb...@yahoo.de> 
Sent: Tuesday, March 2, 2021 11:04
To: msys2-users@lists.sourceforge.net; Burkhardt, Glenn B Collins 
<glenn.burkha...@collins.com>
Subject: [External] Re: [Msys2-users] gdb can't set breakpoint

 Am Dienstag, 2. März 2021, 13:36:31 MEZ hat Burkhardt, Glenn B Collins via 
Msys2-users <msys2-users@lists.sourceforge.net> Folgendes geschrieben:

> Neither gdb 9.2-3 nor mingw-w64-x86_64-gdb 10.1-2 are able to set breakpoints 
> in code compiled with mingw-w64-x86_64-gcc 10.2.0-6.  Anyone else seen this?  
> Thanks.
>
> $ g++ --version
> g++.exe (Rev6, Built by MSYS2 project) 10.2.0
>
> $ cat t.cpp
> #define __USE_MINGW_ANSI_STDIO 1
> #include <stdio.h>
>
> int main()
> {
>     size_t z = 0;
>
>     printf("%zu\n", z);
> }
>
> Glenn.Burkhardt@AI234087 MSYS ~
> $ g++ -g t.cpp -o t
>
> $ gdb ./t
> GNU gdb (GDB) 9.2
> Copyright (C) 2020 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later 
><https://urldefense.com/v3/__http://gnu.org/licenses/gpl.html__;!!MvWE!TEX72QtS2qc-oTW9x0AP_BzAB4NS_bGSBpHUJqorVVzNeNABvPLDqDFjlEOM7vC5ze9JwA$
> >  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-pc-msys".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <https://urldefense.com/v3/__http://www.gnu.org/software/gdb/bugs/__;!!MvWE!TEX72QtS2qc-oTW9x0AP_BzAB4NS_bGSBpHUJqorVVzNeNABvPLDqDFjlEOM7vD0880wPQ$
>  >.
> Find the GDB manual and other documentation resources online at:
>     
><https://urldefense.com/v3/__http://www.gnu.org/software/gdb/documentation/__;!!MvWE!TEX72QtS2qc-oTW9x0AP_BzAB4NS_bGSBpHUJqorVVzNeNABvPLDqDFjlEOM7vBdnGW48w$
> >.
>
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Traceback (most recent call last):
>   File "<string>", line 3, in <module>
> ModuleNotFoundError: No module named 'libstdcxx'
> /etc/gdbinit:6: Error in sourced command file:
> Error while executing Python code.
> Reading symbols from ./t...
> (gdb) b main
> Breakpoint 1 at 0x14000154d: file t.cpp, line 6.
> (gdb) l
> 1      #define __USE_MINGW_ANSI_STDIO 1
> 2      #include <stdio.h>
> 3
> 4      int main()
> 5      {
> 6          size_t z = 0;
> 7
> 8          printf("%zu\n", z);
> 9      }
> (gdb) b 8
> Breakpoint 2 at 0x140001555: file t.cpp, line 8.
> (gdb) r
> Starting program: /home/glenn.burkhardt/t  [New Thread 42340.0xaee8]
> Warning:
> Cannot insert breakpoint 1.
> Cannot access memory at address 0x140001548  Cannot insert breakpoint 
>2.
> Cannot access memory at address 0x140001555
>
> Command aborted.

This looks like gdb doesn't understand ASLR, like this bug:
https://urldefense.com/v3/__https://sourceware.org/bugzilla/show_bug.cgi?id=26037__;!!MvWE!TEX72QtS2qc-oTW9x0AP_BzAB4NS_bGSBpHUJqorVVzNeNABvPLDqDFjlEOM7vA6x8489Q$
 

But it was fixed for gdb-10.1.


Hannes

_______________________________________________
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to