-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gdb not able to debug #8516
Comments
The same here. But this is just a "ugly" patch means the /proc/[pid]/mem is fix in WSL. Regards |
Thanks a lot for your reply. Also this not happened on WSL-2 Regards |
I am not sure I understand. You closed this bug because a hack has been found? The fundamental issue is still occurring, any plans to fix it? |
This is happening on WSL2. Please reopen.
|
yes, the hack has been verified and the hack can work. |
I will reopen this issue since you found it reopen. BTW: I am not the developer of this project. ^_^ |
not work for me. |
Life is quite sad, isn't it? The wrong people get to make decisions. Imagine how messed up life will become if random stupid AI get to make decisions like that. |
Ah ok. I understand why you closed it. It's nice that some hack has been found but this shows a fundamental bug in the way WSL handles debugging traps. Thus I would indeed leave a WSL developer work on it properly and close it when the issue has been fixed. |
Hey, guys, any updates on this? This bug is likely blocker for anyone which has to use any fresh versions of debuggers or any another software which wants to read /proc/pid/memory |
I built gdb 13.1 from source (released 2/19/23) and I am able to debug with it on WSL2 (Ubuntu 22.04.2 LTS) though I still get the warnings:
It is unclear to me whether building from source or using 13.1 was the (partial?) fix. |
this "patch" didn't work for me, I don't remember having this issue back with ubuntu 18.04, maybe there's something there. I would switch back to that version, but I can't install valgrind in that version because of the libc6 issue. |
|
not work for me, which gdb version you are using? |
The version is : 13.1 |
Yes it worked, although warnings are still there but not a show stopper anymore. |
Thank you! This is the answer. Other solutions talk about going back to gdb 9.2, but you can not easily do that with Ubuntu 22.04. |
Unfortunately this still not worked for me. Even a hello world can not access breakpoint. NAME STATE VERSION
* Ubuntu-22.04 Running 2
docker-desktop Running 2
docker-desktop-data Running 2
GNU gdb (GDB) 13.1
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. Here is the gdb information. This is GNU gdb (GDB) 13.1
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-pc-linux-gnu".
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 ./hello...
(gdb) b main
Breakpoint 1 at 0x1175: file hello.c, line 3.
e(gdb) run
Starting program: /d/Software/develop/VSCode/tools/example/vscode_c/hello
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x1169
(gdb) disassemble main
Dump of assembler code for function main:
0x0000000000001169 <+0>:
Cannot access memory at address 0x1169
This is through GNU gdb (GDB) 13.1
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-pc-linux-gnu".
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 ./hello...
(gdb) run
Starting program: /d/Software/develop/VSCode/tools/example/vscode_c/hello
process 3265 is executing new program: /usr/bin/bash
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 3265 is executing new program: /d/Software/develop/VSCode/tools/example/vscode_c/hello
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
5, sizeof(p)=8
hello world
[Inferior 1 (process 3265) exited normally]
(gdb) b main
Breakpoint 1 at 0x55c65d2d0175: file hello.c, line 3.
(gdb) run
Starting program: /d/Software/develop/VSCode/tools/example/vscode_c/hello
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x55c65d2d0169 |
How did you get the 'gdb' program ? compile by yourself? |
Yes, I compiled from the souce. I uninstalled the old version of gdb. And the gdb version shows that it is v13.1. |
I think you need to double check your environment. |
Beginner CS student here |
cd gdb-13.1
./configure
make
make install After installing, confirm: ❯ gdb --version
GNU gdb (GDB) 13.1
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. |
I found out that WSL 2 does not have the issue. Since WSL 1 still seems to be supported, I think the bug should remain open but I believe an upgrade to WSL 2 would be a good recommendation. |
I agree with this solution if WSL2 work fine. BTW: I don't verify the solution at my environment. |
This worked for me. Thanks @vingocheng ! for ubuntu 22.04 I did: sudo apt remove gdb
sudo apt install libgmp-dev
wget https://ftp.gnu.org/gnu/gdb/gdb-13.1.tar.xz
tar -xf gdb-13.1.tar.xz
cd gdb-13.1/
./configure
make -j8
sudo make install |
Thanks @stewpend0us , that worked for me! |
I can confirm that the bug still occurs on WSL 1 (and I need WSL 1 because it's faster with NTFS interop). I'd prefer not to build my own GDB but... Erg. Guess I'll have to do that. |
That works for me, too!
then the "layout" command can be used in gdb |
You can install GDB from Ubuntu Support Team PPA if you don't want to rebuild GDB yourself. |
This worked for me for gdb, but not gdbserver, got anything for that one @fazaldegui |
I am still seeing this problem on WSL2:
Installing a newer upstream version of gdb (from the PPA) does fix this for me, but does still have the warnings. |
same, wsl is:
and gdb is:
it's basically unusable. good job, microsoft. only installing gdb daily build from the PPA helps. |
Any fixes yet? |
doesn't look like it, I recently set up a new machine, and met the same issue. |
Yes, my environment is the same as yours. I installed the gdb daily build from the PPA as follows:
It works! |
您好,收到了~感谢您的来信,祝您生活愉快!
|
非常的好 兄弟sudo add-apt-repository ppa:ubuntu-support-team/gdb |
您好,收到了~感谢您的来信,祝您生活愉快!
|
Version
Microsoft Windows [版本 10.0.19042.1706]
WSL Version
Kernel Version
Ubuntu-22.04 default version: 2
Distro Version
Ubuntu-22.04
Other Software
gdb --version GNU gdb (Ubuntu 12.0.90-0ubuntu1) 12.0.90
gcc --version gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Repro Steps
Starting program: /mnt/c/junk/a.out
warning: opening /proc/PID/mem file for lwp 92.92 failed: No such file or directory (2)
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x8001149
Expected Behavior
gdb is expecting to work.
Actual Behavior
as above input, you can find, gdb not able to work.
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: