VC debugging technology tips

zhaozj2021-02-16  51

In the development of a large project, I encountered multi-thread polling operation error. In order to solve the problem, I have answered some relevant information, combined with some experience in actual procedure, summarize the tips in several debugging, I hope to go to the peers They have help.

Get thread name and thread ID in multi-threaded program

Since execution in multiple threads is uncertain, it is a more difficult thing for multi-threaded debugging, and the C compiler provides the ability to directly obtain system-level information. There is one for each thread. The data structure called TIB [1] stores its own information, and achieves the purpose of determining the error position and error reasons by directly acquiring information of TIB during the adjustment process.

According to Matt Pietrek, in May 1996, the TIB concept raised in the Win32 system has a TIB, and the FS register points to the address of the TIB. And by reviewing some related program code, the following is a piece of code from the CodeGuru, which contains a function of the active thread TIB address and the specific application function of TIB:

(to be continued)

转载请注明原文地址:https://www.9cbs.com/read-22014.html

New Post(0)