Looks like this one didn't go to all either. Sorry for the mess.
On Tue, May 26, 2009 at 10:47 AM, Nathan Wharton naw@greptar.com wrote:
On Fri, May 22, 2009 at 11:31 PM, Marek Lindner lindner_marek@yahoo.de wrote:
I am getting set up to do remote debugging. I'll see what I can find doing that.
Yeah, that would be another option.
ok, here is what I found on the debug malloc problem I am having:
In the function debugMalloc:
chunkHeader = (struct chunkHeader *)memory; chunk = memory + sizeof(struct chunkHeader); chunkTrailer = (struct chunkTrailer *)(memory + sizeof(struct chunkHeader) + length);
chunkHeader->length = length; chunkHeader->tag = tag; chunkHeader->magicNumber = MAGIC_NUMBER;
chunkTrailer->magicNumber = MAGIC_NUMBER;
=> pthread_mutex_lock(&chunk_mutex);
I get the following results:
(gdb) p chunkHeader $26 = (struct chunkHeader *) 0x308c8 (gdb) p chunk $27 = (unsigned char *) 0x308d8 "\020\322\n" (gdb) p chunkTrailer $28 = (struct chunkTrailer *) 0x308dd (gdb) p *chunkHeader $29 = {next = 0x40096c34, length = 5, tag = 15, magicNumber = 305419896} (gdb) p *chunkTrailer $30 = {magicNumber = 878082050} (gdb) p length $31 = 5
I think the magic number is not getting into the chunk trailer correctly because it is not aligned. chunkHeader is aligned because it was returned by malloc chunk is aligned because the size of the header is 16 chunkTrailer is not aligned because it is chunk + 5
Hope this helps. If not, and that shouldn't be a problem, I'll see what else I can find.
I added the following patch: ========================================= --- batmand-r1269/batman/allocate.c 2009-05-20 13:54:18.000000000 -0500 +++ batmand-r1269.mod/batman/allocate.c 2009-05-26 12:25:07.000000000 -0500 @@ -206,6 +206,10 @@ struct chunkHeader *chunkHeader; struct chunkTrailer *chunkTrailer; unsigned char *chunk; + uint32_t remainder = length % 4; + + if (remainder > 0) + length += 4 - remainder;
/* printf("sizeof(struct chunkHeader) = %u, sizeof (struct chunkTrailer) = %u\n", sizeof (struct chunkHeader), sizeof (struct chunkTrailer)); */
========================================= And I don't get any debug malloc problems anymore.
I do, however, still get the kernel crashes when using batgat.