From: Nathan Wharton <naw@greptar.com>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<B.A.T.M.A.N@open-mesh.net>
Subject: [B.A.T.M.A.N.] Debug Malloc Problem
Date: Tue, 26 May 2009 13:48:25 -0500 [thread overview]
Message-ID: <4313f3060905261148t14ea24bcq6f2ebca3e1007106@mail.gmail.com> (raw)
Sorry, looks like I didn't reply all on this one:
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.
next reply other threads:[~2009-05-26 18:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-26 18:48 Nathan Wharton [this message]
2009-05-26 18:50 ` [B.A.T.M.A.N.] Debug Malloc Problem Nathan Wharton
2009-05-26 22:13 ` Sven Eckelmann
2009-05-27 0:06 ` Nathan Wharton
2009-05-27 9:28 ` Marek Lindner
2009-05-27 14:20 ` Nathan Wharton
2009-05-27 16:07 ` Nathan Wharton
2009-05-27 16:16 ` Sven Eckelmann
2009-05-27 16:21 ` Nathan Wharton
2009-05-27 16:35 ` Nathan Wharton
2009-05-27 17:13 ` Sven Eckelmann
2009-05-27 17:21 ` Nathan Wharton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4313f3060905261148t14ea24bcq6f2ebca3e1007106@mail.gmail.com \
--to=naw@greptar.com \
--cc=B.A.T.M.A.N@open-mesh.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox