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 <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-pc-msys".
> 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"...
> 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://sourceware.org/bugzilla/show_bug.cgi?id=26037

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