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

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.

主站蜘蛛池模板: 基隆市| 贞丰县| 甘南县| 依兰县| 沙洋县| 蕉岭县| 大足县| 天门市| 盐山县| 桓仁| 四子王旗| 乌拉特后旗| 浦东新区| 淄博市| 郓城县| 扬中市| 专栏| 石阡县| 伊金霍洛旗| 山阳县| 厦门市| 中卫市| 炎陵县| 神农架林区| 哈尔滨市| 若羌县| 凌海市| 监利县| 灵宝市| 丹棱县| 南郑县| 河北省| 海兴县| 容城县| 抚顺县| 浮山县| 乌兰察布市| 芦溪县| 聂拉木县| 安西县| 共和县|