This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/9846] New: gdb reads incorrect data in the commpage in Mac OS X 10.4
- From: "adam dot rosenfield+bugzilla at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 15 Feb 2009 03:18:24 -0000
- Subject: [Bug gdb/9846] New: gdb reads incorrect data in the commpage in Mac OS X 10.4
- Reply-to: sourceware-bugzilla at sourceware dot org
gdb is not reading the correct data from the commpage in Mac OS X 10.4, located
at virtual addresses 0xffff1600 to 0xffff16ff in all processes. For more
information on the commpage, see
<http://osxbook.com/book/bonus/chapter7/binaryprotection/index.html>.
Steps to reproduce:
Compile the following program on Mac OS X, which reads 256 bytes of memory from
address 0xffff1600 (the comm page) as a string and as a hexdump. Then, run in
gdb and examine the memory at 0xffff1600 and compare.
$ cat dsmos.c
#include <stdio.h>
int main(void)
{
int offset;
printf("%.256s\n", (char*)0xffff1600);
for(offset = 0; offset < 256; offset++)
{
printf("%02x ", *(unsigned char*)(0xffff1600 + offset));
if(offset % 16 == 15)
printf("\n");
}
return 0;
}
$ gcc dsmos.c -g -o dsmos
$ ./dsmos
Your karma check for today:
There once was was a user that whined
his existing OS was so blind,
he'd do better to pirate
an OS that ran great
but found his hardware declined.
Please don't steal Mac OS!
Really, that's way uncool.
(C) Apple Computer, Inc.
59 6f 75 72 20 6b 61 72 6d 61 20 63 68 65 63 6b
20 66 6f 72 20 74 6f 64 61 79 3a 0a 54 68 65 72
65 20 6f 6e 63 65 20 77 61 73 20 77 61 73 20 61
20 75 73 65 72 20 74 68 61 74 20 77 68 69 6e 65
64 0a 68 69 73 20 65 78 69 73 74 69 6e 67 20 4f
53 20 77 61 73 20 73 6f 20 62 6c 69 6e 64 2c 0a
68 65 27 64 20 64 6f 20 62 65 74 74 65 72 20 74
6f 20 70 69 72 61 74 65 0a 61 6e 20 4f 53 20 74
68 61 74 20 72 61 6e 20 67 72 65 61 74 0a 62 75
74 20 66 6f 75 6e 64 20 68 69 73 20 68 61 72 64
77 61 72 65 20 64 65 63 6c 69 6e 65 64 2e 0a 50
6c 65 61 73 65 20 64 6f 6e 27 74 20 73 74 65 61
6c 20 4d 61 63 20 4f 53 21 0a 52 65 61 6c 6c 79
2c 20 74 68 61 74 27 73 20 77 61 79 20 75 6e 63
6f 6f 6c 2e 0a 20 20 20 28 43 29 20 41 70 70 6c
65 20 43 6f 6d 70 75 74 65 72 2c 20 49 6e 63 2e
$ gdb dsmos
(gdb) break main
(gdb) run
(gdb) x/256xb 0xffff1600
0xffff1600 <___longcopy+1024>: 0x55 0x89 0xe5 0x57 0x8b 0x7d
0x08 0x8b
0xffff1608 <___longcopy+1032>: 0x55 0x0c 0x31 0xc0 0x83 0xfa
0x50 0x7f
0xffff1610 <___longcopy+1040>: 0x3b 0x83 0xfa 0x10 0x7d 0x10
0x85 0xd2
0xffff1618 <___longcopy+1048>: 0x74 0x2c 0x88 0x07 0x47 0x4a
0x75 0xfa
0xffff1620 <___longcopy+1056>: 0xeb 0x24 0x88 0x07 0x47 0x4a
0xf7 0xc7
0xffff1628 <___longcopy+1064>: 0x03 0x00 0x00 0x00 0x75 0xf4
0x89 0xd1
0xffff1630 <___longcopy+1072>: 0xc1 0xea 0x02 0x89 0x07 0x83
0xc7 0x04
0xffff1638 <___longcopy+1080>: 0x4a 0x75 0xf8 0x83 0xe1 0x03
0x74 0x06
0xffff1640 <___longcopy+1088>: 0x88 0x07 0x47 0x49 0x75 0xfa
0x8b 0x45
0xffff1648 <___longcopy+1096>: 0x08 0x5f 0x5d 0xc3 0x89 0xf9
0xf7 0xd9
0xffff1650 <___longcopy+1104>: 0x83 0xe1 0x0f 0x74 0x08 0x29
0xca 0x88
0xffff1658 <___longcopy+1112>: 0x07 0x47 0x49 0x75 0xfa 0x89
0xd1 0x83
0xffff1660 <___longcopy+1120>: 0xe2 0x3f 0x83 0xe1 0xc0 0x66
0x0f 0xef
0xffff1668 <___longcopy+1128>: 0xc0 0x01 0xcf 0x81 0xf9 0x00
0x00 0x10
0xffff1670 <___longcopy+1136>: 0x00 0x73 0x2e 0xf7 0xd9 0xeb
0x09 0x90
0xffff1678 <___longcopy+1144>: 0x90 0x90 0x90 0x90 0x90 0x90
0x90 0x90
0xffff1680 <___longcopy+1152>: 0x66 0x0f 0x7f 0x04 0x0f 0x66
0x0f 0x7f
0xffff1688 <___longcopy+1160>: 0x44 0x0f 0x10 0x66 0x0f 0x7f
0x44 0x0f
0xffff1690 <___longcopy+1168>: 0x20 0x66 0x0f 0x7f 0x44 0x0f
0x30 0x83
0xffff1698 <___longcopy+1176>: 0xc1 0x40 0x75 0xe4 0xe9 0x70
0xff 0xff
0xffff16a0 <___longcopy+1184>: 0xff 0xf7 0xd9 0xeb 0x0b 0x90
0x90 0x90
0xffff16a8 <___longcopy+1192>: 0x90 0x90 0x90 0x90 0x90 0x90
0x90 0x90
0xffff16b0 <___longcopy+1200>: 0x66 0x0f 0xe7 0x04 0x0f 0x66
0x0f 0xe7
0xffff16b8 <___longcopy+1208>: 0x44 0x0f 0x10 0x66 0x0f 0xe7
0x44 0x0f
0xffff16c0 <___longcopy+1216>: 0x20 0x66 0x0f 0xe7 0x44 0x0f
0x30 0x83
0xffff16c8 <___longcopy+1224>: 0xc1 0x40 0x75 0xe4 0x0f 0xae
0xf8 0xe9
0xffff16d0 <___longcopy+1232>: 0x3d 0xff 0xff 0xff 0x00 0x00
0x00 0x00
0xffff16d8 <___longcopy+1240>: 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00
0xffff16e0 <___longcopy+1248>: 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00
0xffff16e8 <___longcopy+1256>: 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00
0xffff16f0 <___longcopy+1264>: 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00
0xffff16f8 <___longcopy+1272>: 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00
Expected results: the output of gdb's `x' command should match the program's output
Environment:
$ uname -a
Darwin adam-rosenfields-computer.local 8.11.1 Darwin Kernel Version 8.11.1: Wed
Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386 i386 i386
$ gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-696) (Sat Oct 20 18:16:54 GMT 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".
--
Summary: gdb reads incorrect data in the commpage in Mac OS X
10.4
Product: gdb
Version: 6.3
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: gdb
AssignedTo: unassigned at sourceware dot org
ReportedBy: adam dot rosenfield+bugzilla at gmail dot com
CC: gdb-prs at sourceware dot org
GCC host triplet: i386-apple-darwin
http://sourceware.org/bugzilla/show_bug.cgi?id=9846
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.