Is DLL always have the same Base Address?

后端 未结 3 1569
死守一世寂寞
死守一世寂寞 2021-01-11 21:58

I\'m studying about windows and DLL stuffs and I have some question about it. :)

I made a simple program that loads my own DLL. This DLL has just simple functions, p

3条回答
  •  醉梦人生
    2021-01-11 22:23

    That's a common problem with DLLs that we encountered when trying to decode stacktraces issued by GNAT runtime (Ada).

    When presented with a list of addresses (traceback) when our executables crash, we are able to perform addr2line on the given addresses and rebuild the call tree without issues.

    On DLLs, this isn't the case (that's why I highly doubt that this issue is ASLR-related, else the executables would have the same random shift), vcsjones answer explains the "why".

    Now to workaround this issue, you can write the address of a given symbol (example: the main program) to disk. When analysing a crash, just perform a difference between the address of the symbol in the mapfile and the address written to disk. Apply this difference to your addresses, and you'll be able to compute the theorical addresses, thus the call stack.

提交回复
热议问题