When I use libmmalloc to allocate memory from /dev/zero (e.g., by using
"mmalloc_attach (-1, NULL)" to mmap() it), libmmalloc bus errors when it
tries to write to the allocated region.  The mmalloc library works fine
when I use an ordinary file, however.

I'm using the libmmalloc.a that comes with gdb-5.1, and I'm running under
Linux 2.4.2.  /dev/zero has 0666 permissions.

I believe the bug is that libmmalloc always mmap()s memory with MAP_SHARED,
but it ought to map /dev/zero with MAP_PRIVATE.  A quick search-and-replace
does seem to fix the problem.  I'm guessing that a clean solution
(selecting MAP_SHARED or MAP_PRIVATE based on whether /dev/zero is being
used) should take <10 lines of code.  However, before doing this and
submitting a patch file, I was wondering if there's some subtle reason
the code was written the way it was -- or if I'm the only one who's had
trouble with /dev/zero.

Comments?

-- Scott


_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to