This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/22616] New: gdb will not set program counter $pc to mmap()ed region
- From: "jreiser at BitWagon dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sat, 16 Dec 2017 16:53:49 +0000
- Subject: [Bug gdb/22616] New: gdb will not set program counter $pc to mmap()ed region
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=22616
Bug ID: 22616
Summary: gdb will not set program counter $pc to mmap()ed
region
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: jreiser at BitWagon dot com
Target Milestone: ---
gdb won't set the program counter $pc to point to an mmap()ed region.
Reproducible test case under Linux on armv7l (RaspberryPi-3B in 32-bit mode):
===== gdbbug.c
#include <sys/types.h>
#include <sys/mman.h>
int
main(int argc, char *argv[])
{
int *addr = mmap(0, 4096, PROT_EXEC|PROT_WRITE|PROT_READ,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
*addr = 0xe24dd004; // sub sp,sp,#4
return 0;
}
===== end gdbbug.c
$ uname -a
Linux host.domain 4.14.5-300.fc27.armv7hl #1 SMP Mon Dec 11 17:29:37 UTC 2017
armv7l armv7l armv7l GNU/Linux
$ gcc --version
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
$ gcc -g -o gdbbug gdbbug.c
$ gdb gdbbug
GNU gdb (GDB) 8.0.50.20171216-git
<<snip>>
(gdb) b main
Breakpoint 1 at 0x10418: file gdbbug.c, line 7.
(gdb) run
Starting program: /path/to/gdbbug
Cannot parse expression `.L1199 4@r4'.
warning: Probes-based dynamic linker interface failed.
Reverting to original interface.
Breakpoint 1, main (argc=0x1, argv=0xbefff464) at gdbbug.c:7
7 int *addr = mmap(0, 4096, PROT_EXEC|PROT_WRITE|PROT_READ,
(gdb) n
9 *addr = 0xe24dd004; // sub sp,sp,#4
(gdb) n
10 return 0;
(gdb) x/i $pc ## current value
=> 0x10450 <main+76>: mov r3, #0
(gdb) x/i addr ## mmap()ed region
0xb6ffa000: sub sp, sp, #4
(gdb) set $pc = $_ ## attempt to set $pc; no complaint
(gdb) x/i $pc ## but value did not change
=> 0x1043c <main+56>: str r0, [r11, #-8]
(gdb) set $pc = 0xb6ffa000 ## stronger attempt to set $pc
Attempt to assign to an unmodifiable value. ## very strange
(gdb) x/i $pc ## value did not change
=> 0x1043c <main+56>: str r0, [r11, #-8]
(gdb)
=====
gdb was built from git tip:
=====
$ git log
commit 09da3ecf04d75084ea7d9c43e3cc0b18b2443ea3 (HEAD -> master, origin/master,
origin/HEAD)
Author: GDB Administrator <gdbadmin@sourceware.org>
Date: Sat Dec 16 00:00:33 2017 +0000
Automatic date update in version.in
=====
A preliminary version of this bugzilla report was filed as
https://bugzilla.redhat.com/show_bug.cgi?id=1526617
--
You are receiving this mail because:
You are on the CC list for the bug.