mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #21338 from wxy/20210304-Learn-to-debug-code-with-the-GNU-Debugger
PRF:published/20210304 Learn to debug code with the GNU Debugger.md
This commit is contained in:
commit
87890643c0
@ -88,7 +88,7 @@ Program received signal SIGSEGV, Segmentation fault.
|
||||
要充分利用 GDB,你需要将调试符号编译到你的可执行文件中。你可以用 GCC 中的 `-g` 选项来生成这个符号:
|
||||
|
||||
```
|
||||
$ g++ -o debuggy example.cpp
|
||||
$ g++ -g -o debuggy example.cpp
|
||||
$ ./debuggy
|
||||
Hello world.
|
||||
Segmentation fault
|
||||
@ -250,7 +250,7 @@ $4 = 02
|
||||
要查看其在内存中的地址:
|
||||
|
||||
```
|
||||
(gdb) print /o beta
|
||||
(gdb) print /o &beta
|
||||
$5 = 0x2
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user