Sign in to follow this  
ChrisPepper1989

Heap Corruption, Addresses and Map files how to use them?

Recommended Posts

Hi Everyone,

I'm sure ive done this before but i cant for the life of me remember how! when you get a nice Heap Corruption and it gives you an address is it not possible to match that up with something in a vs generated map file? to help locate where it happens? or am i just imagining this? im sure there is a way of using that address?

I know you can also add a breakpoint on an adress in visual studio, can anybody tell me if there is a equivalent in WinDbg? I'm a complete noob at kernel debugging and i havent got familiar with the WinDBG environment at all!

I'm currently trying the define trick mentioned on [url="http://epsilon-delta.net/articles/vc6_debug.html#id5"]here[/url] to see if this can help me track it down.

i would appreciate any help!

Thank you, Chris

- EDIT -

dur! i remember now in my old work it used to dump the map address in the debug window, and in this situation if i click "Retry" a very map looking address pops up in the winDebug! hopefully this will help me find the error!

- EDIT -

Share this post


Link to post
Share on other sites
The map file would only contain the locations of actual code or read-only data segments etc, and that's before any DLLs are rebased as they are loaded, if necessary. It doesn't contain the location of memory that you dynamically allocated on the heap, for example.

Perhaps we can give more help about the direct problem instead.
You're probably more likely to solve the heap corruption by looking at the nature of how and when the memory is corrupted etc. I.e what it is overwritten with, and what was that piece of memory being used for, which parts of your code have run and which haven't.
I'd also go quickly over the code to look for any suspect things like using ZeroMemory(this, sizeof(*this)); on a non-POD class, and look for possible buffer overruns, maybe adding a few asserts. Check for not obeying the rule of three on any classes. Make sure that you allocate enough memory in the places where you allocate memory, check your sizeof's etc.
If you can give more detail, we might find the problem for you and you may learn enough in the process to do the same next time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this