GDB调试

作者: 可不期诺Cappuccino | 来源:发表于2022-03-31 15:16 被阅读0次

1.Debugged program settings

set args [Arguments]
show args

2.break command

Creates a breakpoint at a specified line, address or function.

Syntax

break
b
break [Function Name]
break [File Name]:[Line Number]
break [Line Number]
break *[Address]
break [...] if [Condition]
break [...] thread [Thread-id]
b [...]

Examples

Using function name:

(gdb) b main
Breakpoint 1 at 0x401395: file 0.cpp, line 4.
(gdb)

Using function address:

(gdb) info address main
Symbol "main(int, char**)" is a function at address 0x40138c.
(gdb) break *0x40138c
Breakpoint 2 at 0x40138c: file 0.cpp, line 4.
(gdb)

Using file name and line number:

(gdb) info line main
Line 4 of "0.cpp" starts at address 0x40138c <main(int, char**)>
and ends at 0x401395 <main(int, char**)+9>.
(gdb) break 0.cpp:4
Breakpoint 3 at 0x401395: file 0.cpp, line 4.

Using line number only:

(gdb) info source
Current source file is 0.cpp
Compilation directory is C:\MinGW\bin
Located in c:\mingw\bin\0.cpp
Source language is c++.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb) break 4
Breakpoint 4 at 0x40138c: file 0.cpp, line 4.

3. Shared library commands

info sharedlibrary command

info sharedlibrary
info share

set solib-search-path command

set solib-search-path [Directories]
show solib-search-path

set sysroot command

set sysroot [Directory]
set sysroot remote:/
set sysroot remote:[Remote directory]
set solib-absolute-prefix [Directory]
show sysroot

相关文章

  • 2. gdb的使用

    参考链接1. GDB调试2. gdb调试方法3. gdb调试示例 1. 说说 gdb gdb 是一款 UNIX 系...

  • gcc常用命令

    gdb相关 gcc加-g才能使用gdb调试gdb -tui a.out打开调试界面run/stop/continu...

  • GDB调试记录

    gdb attach 15343 # 调试某个进程 GNU gdb (GDB) 7.12Copyrigh...

  • gdb调试基本方法

    gdb调试基本方法 gdb调试常用命令 在GDB中运行程序 断点(BreakPoint) 观察点(WatchPoi...

  • GDB命令

    gdb test 启动gdb调试test可执行文件gdb att 进程名 调试某个进程b [行数]/[函数名...

  • Xcode debug Hotspot(一)——创建Xcode项

    概述 前面安装gdb调试hotspot里面,我记录了自己安装gdb调试hotspot的过程。后来我发现,使用gdb...

  • 【实践】gdb调试golang程序入门及gdb命令列表

    1. 摘要 本文讲解gdb调试GOLANG程序的入门配置,以及gdb命令详解备忘。 2. gdb调试go程序入门...

  • 用gdb调试代码

    title: 用gdb调试代码tags: gdbdate: 2017-08-09 15:09:22 gdb调试 开...

  • PWN入门到放弃

    Linux下的pwn常用到的工具有: gdb:Linux调试中必要用到的 gdb-peda:gdb方便调试的工具,...

  • 使用GDB调试C++程序

    GDB调试利器 GDB, the GNU Project debugger, allows you to see ...

网友评论

      本文标题:GDB调试

      本文链接:https://www.haomeiwen.com/subject/omknjrtx.html