[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Debugging hash contents

From: <kfogel_at_collab.net>
Date: 2005-01-31 20:03:44 CET

John Peacock <jpeacock@rowman.com> writes:
> My question is, how do people conventionally examine the contents of
> apr hashes from within the debugger? There are times when nothing but
> a printf() equivalent will do, so I am consider writing a debugger
> function, apr_hash_dump, which will just print out the stringified
> hash keys and values. I don't see a better way to understand why the
> hash is not being populated correctly for this one case.

FWIW, to examine hash contents, I usually do fancy casting, with lots
of help from my editor (macros and such). For example:

 (gdb) p (const char *) ((((apr_hash_entry_t **) ctx->config->array)[6])->key)
 $19 = 0x40094569 "config"
 (gdb) p (const char *) ((((apr_hash_entry_t **) ctx->config->array)[6])->val)
 $20 = 0x806a060 "x \006\bX\227\006\bHü\b\b"
 (gdb)

In this case, I didn't know the right type for the value off the top
of my head, so it looks liek nonsense when viewed as a C string. But
whatever, you get the idea.

HTH,
-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 31 20:15:40 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.