Jump to content
  • Advertisement
Sign in to follow this  
Idov

SymFromAddr returns weird displacement...

This topic is 2787 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi!
I'm using SymFromAddr (C++/Windows) and although it returns "true" and it seems
to find a symbol name (I don't know if it's the correct one), it returns a very large displacement value (such as 18446744073709551615 = 2 ^64 - 1) or sometimes just 0.

MSDN says:
Displacement [out, optional]
The displacement from the beginning of the symbol, or zero.

why am I getting these values and what does displacement = 0 mean?

thanks :)

Share this post


Link to post
Share on other sites
Advertisement
Have you considered that the number might be signed? In other words, that it's not a "very large displacement value" but a negative number? The 0 probably means that the symbol doesn't exist or isn't loaded or something along those lines.

Share this post


Link to post
Share on other sites
Quote:
Original post by LessBread
Have you considered that the number might be signed? In other words, that it's not a "very large displacement value" but a negative number? The 0 probably means that the symbol doesn't exist or isn't loaded or something along those lines.


But displacement is a DWORD64 (which is defined as unsigned __int64)
and SymFromAddr returns true so I suppose it can't be an error...

Share this post


Link to post
Share on other sites
The documentation says:
Quote:

Remarks
All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

Does this have any implications for your program?

Share this post


Link to post
Share on other sites
Quote:
Original post by rip-off
The documentation says:
Quote:

Remarks
All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

Does this have any implications for your program?


no, my program is single-threaded...

Share this post


Link to post
Share on other sites
hmmm... it's seems to have been a bug in the dbgHelp DLL.
I was using version 5.1, but when I switched to 6.12 - it stopped happening. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!