From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18614 invoked by alias); 1 Apr 2005 16:41:21 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 18566 invoked from network); 1 Apr 2005 16:41:15 -0000 Received: from unknown (HELO smtp1.libero.it) (193.70.192.51) by sourceware.org with SMTP; 1 Apr 2005 16:41:15 -0000 Received: from localhost (172.16.1.79) by smtp1.libero.it (7.0.027-DD01) id 41BDB2AB017C6574 for gdb@sources.redhat.com; Fri, 1 Apr 2005 18:41:09 +0200 Received: from libero.it (172.16.1.90) by smtp20.libero.it (7.0.027-DD01) id 41D02BD600DA8FA6 for gdb@sources.redhat.com; Fri, 1 Apr 2005 18:41:12 +0200 Date: Fri, 01 Apr 2005 16:41:00 -0000 Message-Id: Subject: gdb + mmap + /dev/mem MIME-Version: 1.0 X-Sensitivity: 3 Content-Type: multipart/mixed; boundary="_=__=_XaM3_.1112373672.2A.666576.42.22129.52.42.007.21546" From: "rtainewbie" To: "gdb" X-XaM3-API-Version: 4.1 (B27pl2) X-type: 0 X-SenderIP: 195.120.224.3 X-SW-Source: 2005-04/txt/msg00005.txt.bz2 --_=__=_XaM3_.1112373672.2A.666576.42.22129.52.42.007.21546 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 803 I am trying to debug a simple application running on GNU-Linux kernel 2.6.8= .1 (see attachment). This application works in a memory region not visible for linux (parameter mem=3DXXX at boot time). I map this region using mmap on /dev/mem device as root user. When I debug it, accessing pointer to this region, the system freezes. So r= eboot is necessary and no debug is possible. The application work correcty but the only solution for debug it is running= a concurrent application that writes the content of this memory region using = printf. Does anybody know an easier and more confortable solution. Thanks a lot. ____________________________________________________________ Navighi a 2 MEGA e i primi 3 mesi sono GRATIS.=20 Scegli Libero Adsl Flat senza limiti su http://www.libero.it --_=__=_XaM3_.1112373672.2A.666576.42.22129.52.42.007.21546 Content-Type: text/x-csrc; name="=?iso-8859-1?Q?mem.c?=" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="=?iso-8859-1?Q?mem.c?=" Content-length: 685 #include #include #include #include int main() { int fd,i; unsigned char * mem1, *mem2; const int size =3D 2 * 1024 * 1024; unsigned long addrphys =3D 254 * 1024 * 1024; =09 mlockall(MCL_CURRENT| MCL_FUTURE); =09 if ((fd =3D open("/dev/mem", 02) ) < 0)=20 { printf("can't open /dev/mem \n"); exit (-1); } =09 mem1 =3D (unsigned char *) mmap((void *)0,size ,PROT_READ | PROT_WRITE,MAP= _SHARED , fd, addrphys); if (mem1) memset(mem1,0, size-1); printf("%d",(int) mem1); if (mem1) { for (i=3D0; i < (size-1); i++) { printf("%x ", *(mem1 +i)); } printf("\n\r"); } =09 munmap((void *)mem1,size ); close(fd); } --_=__=_XaM3_.1112373672.2A.666576.42.22129.52.42.007.21546--