lkml.org 
[lkml]   [2003]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectmmap(READ ONLY) and core
Date
Hello

I tried this prog that generates core. But I am not able to access the mapped addresses
inside the debugger when I load the core. Does anybody know if this is a kernel
(2.4.20) or gdb problem?

cheers
Pavel


(gdb) print addr
$1 = 0x40014000 <Address 0x40014000 out of bounds>
(gdb) print *addr
Cannot access memory at address 0x40014000


#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
int fd;
char *addr;

if ((fd = open(argv[1], O_RDONLY)) < 0) {
fprintf(stderr, "can't open %s for r/w\n", argv[1]);
exit(1);
}
if (!(addr = mmap(0, 64, PROT_READ, MAP_SHARED, fd, 0))) {
fprintf(stderr, "can't mmap %s\n", argv[1]);
exit(1);
}

*addr = 0;

return 0;
}



____________________________________________________________
Nemáš komu říct, že jsi fakt dobrej? Oskarova nabídka pro studenty - až
600 SMSek a 4 hodiny volání zdarma. Volej Kolej! http://ad2.seznam.cz/redir.cgi?instance=62375%26url=http://www.oskarmobil.cz/services/whatsnew.php#volej
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.026 / U:1.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site