Skip to content
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: Warning: Cannot insert breakpoint 1. Cannot access memory at address 0x555555555131 #1136

Closed
1 task done
ibuclaw opened this issue Jan 16, 2023 · 3 comments
Closed
1 task done
Labels

Comments

@ibuclaw
Copy link

ibuclaw commented Jan 16, 2023

Expected Behavior

What should have happened is ... gdb works

Real Behavior

What ended up happening was ... gdb doesn't work, fails with a message like:

Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x555555555131

Can be reproduced running with ssh terminal access:

# cat > test.c << EOF
int main()
{
    return 0;
}
EOF
# gcc -g test.c
# gdb a.out
# gdb a.out 
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 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-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 a.out...
(gdb) start
Temporary breakpoint 1 at 0x1131: file test.c, line 3.
Starting program: /tmp/cirrus-ci-build/a.out 
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x555555555131

(gdb) 

Related Info

This is a (tick one of the following):

  • Task issue
    • container image: ubuntu:22.04

The container image ubuntu:1804 does not have the same problem, which might mean they're running on different hosts.

@ibuclaw ibuclaw added the bug label Jan 16, 2023
@RDIL
Copy link
Contributor

RDIL commented Jan 16, 2023

So, you are trying to run GDB in a remotely connected task?

@ibuclaw
Copy link
Author

ibuclaw commented Jan 16, 2023

So, you are trying to run GDB in a remotely connected task?

Yes, there are a number of tests in our testsuite that verify the dwarf info generated for a compiled module can be used by gdb for debugging the program.

@edigaryev
Copy link
Contributor

This seems to be a bug in the GDB, which at some point removed the ptrace(2) fallback when /dev/[pid]/mem is not available (see bminor/binutils-gdb@05c06f3), but this seems to be now fixed in bminor/binutils-gdb@dd09fe0. However, this commit didn't made it to the release yet.

Source: microsoft/WSL#8356 (comment).

You can work around this by requesting a privileged container using a kvm option:

task:
  container:
    image: ubuntu:22.04
    kvm: true

  install_script:
    - apt-get update
    - apt-get -y install gdb gcc

  compile_script: ...

  debug_script: ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants