Bug 21372 - “Cannot access memory at address” after catch syscall on Raspbian
Summary: “Cannot access memory at address” after catch syscall on Raspbian
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: 7.12
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-11 15:13 UTC by Roman M
Modified: 2017-04-12 09:09 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
gdb_slave_player-7.7.1.typescript (1.79 KB, text/plain)
2017-04-11 15:13 UTC, Roman M
Details
gdb_slave_player-7.12.typescript (1.72 KB, text/plain)
2017-04-11 15:14 UTC, Roman M
Details
gdb_slave_player-7.12.typescript (now the full one) (1.82 KB, text/plain)
2017-04-12 09:09 UTC, Roman M
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman M 2017-04-11 15:13:54 UTC
Created attachment 9983 [details]
gdb_slave_player-7.7.1.typescript

I’m new to gdb and Linux, so please excuse me if my situation will appear to be not a bug.
I’m investigating a performance issue with my Python script on a Raspberry Pi 3. It runs official Raspbian operating system that is adaptation of Debian for Raspberry Pi mini-PC. I need to set catchpoint on a certain system call (gettimeofday, also tried futex), so the need arises in using gdb and not the Python debugger.
I installed python2.7-dbg package in order to have Python extensions for gdb:

sudo apt-get install python2.7-dbg

After that I run my script under gdb and issue “catch syscall gettimeofday”, see gdb_slave_player-7.7.1.typescript file attached. After 1st breakpoint hit and issuing the “continue” command 2 times, the following error message appears:

Cannot access memory at address 0x76e3b964

If I examine the /proc/<PID>/maps file, I see that this address is indeed not a part of my Python’s process address space.
After this error I see that my application is not running. If I issue “continue” to gdb again, the following message is displayed:

Cannot execute this command while the selected thread is running.

And my script is still not running.
If I run that Python script under gdb without issuing “catch syscall”, the program works well and gdb doesn’t output any errors.

I suppose this “Cannot access memory at address 0x76e3b964” error is a bug. My expectation is that after “catch syscall” Python process runs without errors and breakpoint is hit when corresponding system function is called.

Additional information:

GDB version: GNU gdb (Raspbian 7.7.1+dfsg-5+rpi1) 7.7.1

GDB configuration:
This GDB was configured as follows:
   configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --with-expat
             --with-gdb-datadir=/usr/share/gdb (relocatable)
             --with-jit-reader-dir=/usr/lib/gdb (relocatable)
             --without-libunwind-ia64
             --with-lzma
             --with-python=/usr (relocatable)
             --with-separate-debug-dir=/usr/lib/debug (relocatable)
             --with-system-gdbinit=/etc/gdb/gdbinit
             --with-zlib
             --without-babeltrace

("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)

“What compiler (and its version) was used to compile GDB” - I don’t know, I use GDB preinstalled in Raspbian.

uname -a: Linux s21volnaya5 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux


After searching in Internet I found the "Raspbian GDB broken" (https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=104827&p=1146299#p1146299) forum post with instructions on how to compile and build newer GDB version on Raspbian. I tried these steps and succeeded with new GDB version compiling and installation, but the problem remained the same. See gdb_slave_player-7.12.typescript file attached.

GDB version: GNU gdb (GDB) 7.12

GDB configuration:
This GDB was configured as follows:
   configure --host=armv7l-unknown-linux-gnueabihf --target=armv7l-unknown-linux-gnueabihf
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --with-expat
             --with-gdb-datadir=/usr/share/gdb (relocatable)
             --with-jit-reader-dir=/usr/lib/gdb (relocatable)
             --without-libunwind-ia64
             --without-lzma
             --with-python=/usr (relocatable)
             --without-guile
             --with-separate-debug-dir=/usr/lib/debug (relocatable)
             --without-babeltrace

("Relocatable" means the directory can be moved with the GDB installation
tree, and GDB will still find it.)

“What compiler (and its version) was used to compile GDB” - My GCC version is:
gcc (Raspbian 4.9.2-10) 4.9.2

I tried reporting this problem to Raspbian developers, see https://github.com/raspberrypi/linux/issues/1956, but I was told the issue should be reported to GDB developers. So I report this issue here. Please help!
Comment 1 Roman M 2017-04-11 15:14:59 UTC
Created attachment 9984 [details]
gdb_slave_player-7.12.typescript
Comment 2 Roman M 2017-04-12 09:09:09 UTC
Created attachment 9987 [details]
gdb_slave_player-7.12.typescript (now the full one)

Previously uploaded gdb_slave_player-7.12.typescript was incomplete, uploaded a full one