Skip to Content
C语言核心技术(原书第2版)
book

C语言核心技术(原书第2版)

by Peter Prinz, Tony Crawford
August 2017
Intermediate to advanced
798 pages
17h 44m
Chinese
China Machine Press
Content preview from C语言核心技术(原书第2版)
758
|
第
21
章
寄存器
eip
(
extended instruction pointer
,命令寄存器)包含了等待被执行的下一个机器
命令的地址,对应到
27
行。寄存器
ebp
(
extended base pointer
,基础指针寄存器),指
向当前栈帧。
info args
命令生
成下面的显示结果:
(gdb)
info args
p1 = (int *) 0x22f024
p2 = (int *) 0x22f020
GDB
表明指针的类型是
int *
,
同时也指出其值。
info locals
命
令显示了下面的信息:
(gdb)
info locals
tmp = 0
21.4.9 显示数据
通常情况下,可以使用
print
命令显示变量和表达式的值。除此之外,还可以使用
x
命令
检查未命名的内存区域。
21.4.9.1 显示表达式的值
可以把任何
C
表达式作为
print
或
p
命令的参数:
p [/
format
] [
expression
]
该命令会计算
expression
,并显示结果值。不带参数
expression
的
print
命令,则会再
次显示之前表达式的结果值,但不会重新计算这个之前的表达式。如果需要,也可以指
定不同的输出格式。
使用参数
/format
允许为表达式指定适当的输出格式(请参见
21.4.9.2
节)。如果没有指
定输出格式,
print
会根据数据类型自行选用适当的格式输出。
print
命令中的表达式同样具有副作用,如下面的例子所示。当前栈帧对应程序
circle
中
的函数
circularArea()
:
(gdb)
p r
$1
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

算法精讲视频课程:24篇系列讲座

算法精讲视频课程:24篇系列讲座

罗伯特·塞奇威克, 凯文·韦恩(Kevin Wayne)

Publisher Resources

ISBN: 9787111562207