官术网_书友最值得收藏!

The stack

As we saw in the preceding sections, the stack together with the CPU registers define a task. As mentioned earlier, this stack consists of stack frames, each of which defines the (local) variables, parameters, data, and instructions for that particular instance of task execution. Of note is that although the stack and stack frames are primarily a software concept, it is an essential feature of any modern OS, with hardware support in many CPU instruction sets. Graphically, it can be be visualized like the following:

The SP (ESP on x86) points to the top of the stack, with another pointer (Extended Base Pointer (EBP) for x86). Each frame contains a reference to the preceding frame (caller return address), as set by the OS.

When using a debugger with one's C++ application, this is basically what one sees when requesting the backtrack--the individual frames of the stack showing the initial stack frame leading up until the current frame. Here, one can examine each individual frame's details.

主站蜘蛛池模板: 宁武县| 荔浦县| 龙井市| 晋宁县| 藁城市| 汶川县| 红桥区| 抚远县| 安丘市| 应城市| 定日县| 将乐县| 田阳县| 东乌| 左权县| 密山市| 湖口县| 无棣县| 都江堰市| 宝坻区| 河池市| 沈丘县| 内乡县| 乌兰察布市| 沅陵县| 定陶县| 临沂市| 通化县| 游戏| 嘉义市| 大渡口区| 昌黎县| 阿克陶县| 贵德县| 博爱县| 嘉义市| 丰城市| 科技| 梁山县| 晋州市| 神农架林区|