Messages in this thread | | | From | Pavel Krauz <> | Subject | mmap(READ ONLY) and core | Date | Fri, 17 Oct 2003 15:25:15 +0200 (CEST) |
| |
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/
| |