gdb教程:1. How do I use gdb?

gdb断点调试教程 gdb断点调试教程1、C++示例代码1.1、C++示例源码1.2、编译C++示例源码1.3、调试C++示例源码2、gdb断点调试详细教程2.1、设置断点2.1.1、指定行处设置断点2.1.2、指定函数处设置断点2.2、查看断点信息2.3、禁用断点2.4、解除禁用断点2.4、删除断点2.4.1、根据断点编号删除断点2.4.2、根据行号删除断点2.4.3、根据起始点编号删除起始点间所有断点(包括起始点)3、gdb断点调试总结 本教程基于C++语言,在Linux环境下,通过示例代码讲解gdb断点调试。 通过本教程 阅读详情

1. How do I use gdb?

When you compile your program, you must tell the compiler to produce a program that is compatible with the debugger. The debugger needs special information to run properly. To do this, you must compile your program with the debugger flag, -g. This step is critical. Without it, the debugger won't have the program symbol information. That means it won't know what your functions and variables are called, and it won't understand when you ask it about them.

 

1.1 How do I compile with debugging symbols?

Pass the -g flag to your compiler:

prompt > gcc -g program.c -o programname

NOTE: If you have a larger program with several files, each must be compiled with the -g flag, and it must also be set when you link.


1.2 How do I run programs with the debugger?

First start the debugger with your program name as the first argument.

prompt> gdb programname

Next use the run command in gdb to start execution. Pass your arguments to this command.

(gdb) run arg1 "arg2" ...


1.3 How do I restart a program running in the debugger?

Use the kill command in gdb to stop execution. The you can use the run command as shown above to start it again.

(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) run ...


1.4 How do I exit the debugger?

Use the quit command.

(gdb) quit

NOTE: You may be asked if you want to kill the program. Answer yes.

(gdb) quit
The program is running. Exit anyway? (y or n) y
prompt >


1.5 How do I get help on debugger commands?

Use the help command. Gdb has a description for every command it understand, and there are many, many more then this tutorial covers. The argument to help is the command you want information about. If you just type "help" with no arguments, you will get a list of help topics similar to the following:

(gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help" followed by command name for full documentation.
Command name abbreviations are allowed if unambiguous.

 

四足机器人通用运动控制策略:强化学习与PD参数优化 运动控制是机器人实现稳定行走和复杂动作的核心技术,其关键在于精确调节关节的刚度和阻尼特性。PD控制器作为基础控制单元,通过比例(P)和微分(D)增益参数直接影响系统响应速度与稳定性。在四足机器人领域,强化学习(RL)通过模拟环境自主学习,能够有效解决传统控制方法难以适应不同形态机器人的痛点。该技术通过非对称Actor-Critic架构,结合状态估计网络和自适应参数采样策略,实现了跨平台的通用运动控制。典型应用包括工业检测、灾害救援等需要高适应性移动能力的场景,其中PD增益优化和形态参数自适应采样成为提升硬件 阅读详情

相关推荐

【技术分享】ArcGIS Pro底图色彩优化实战:从DEM到山体阴影的进阶调色技巧

本文深入探讨了在ArcGIS Pro中优化地形底图色彩的进阶技巧。通过分析DEM与山体阴影的直方图,详细讲解了如何运用图层混合、亮度、对比度及伽马值等核心参数进行精细化调色,从而将灰暗平淡的地图转化为层次分明、视觉美观的专业成果。

5b6n7m8的博客 777

GDB使用简介

本文内容是我个人觉得在使用 gdb 时经常会用到的一些东西,根据一些参考链接中的内容整理而来,如需更全面的内容请查看参考链接。

cao0507的博客 707

OpenCv案例(七): 基于OpenCvSharp计算图像的清晰度(自动对焦)

自动对焦,其实是对相机成像的清晰值得计算,若对焦不清晰,成像的清晰度低,视觉效果模糊。若是在工业检测行业,对焦不准确,可能会造成严重后果;对焦准确的图像,其清晰度高,对比度鲜明,层次明显。

qq_37835727的博客 7130

use gdb debug bash4.4 source code

前言 需要在bash4.4源码工程上填点新功能, 首先遇到了调试问题。 以前用gdb调试程序,调试和运行效果是一样的。 但是bash有点不同, 如果直接用gdb带着编译好的bash起来,运行流程和系统直接调用bash的效果不同。 如果在bash代码中大量打印syslog日志(可能也不是大量,可能加的地方不对头, bash本来就是命令解释器,如果调用syslog也算是执行了命令)...

博客标题不能为空 552

保姆级教程:在iQuant平台从零写一个Python量化策略(附完整代码示例)

本文提供了一份详细的iQuant平台Python量化策略开发教程,从环境准备到策略实现、回测优化,再到实盘运行,每个步骤都配有完整代码示例和常见问题解决方案。适合量化交易新手快速上手,掌握双均线策略等核心开发技巧。

weixin_42783709的博客 493

AI编程实战:用Spec Coding与Codex半小时重构全栈项目

这次我们来看一个能显著提升全栈开发效率的实战方法:利用 AI 编程工具 Codex 和 Spec Coding 工作流,将原本需要数周甚至一个月的全栈项目重构工期,压缩到半小时级别。这不是概念探讨,而是基于现有工具链的、可立即上手的工程实践。 对于前端开发者或全栈工程师而言,面对老旧项目重构、技术栈升级或从零搭建新项目时,最大的痛点往往是重复性、模式化的代码编写工作。手动编写 CRUD 接口、页面组件、状态管理和联调测试,耗时费力且容易出错。而 AI 辅助编程的核心价值,正是在于将开发者从这些“体力活”中解

weixin_33525298的博客 299

Learn to use GDB (1)

What is gdb? gdb在linux下是一款非常强大的程序调试工具,有的时候会有比IDE更强大的代码调试功能。 GDB, the GNU Project debugger, allows you to see what is going on 'inside' another program while it executes -- or what another program

167

开关电源辅助电源设计全流程拆解

地类型定义包含电路功率地(PGND)高压侧地,与主功率电路地相连整流桥负极、原边电感地、UC3842的功率地信号地(SGND)低压侧地,与控制/采样电路地相连副边整流管地、TL431地、MCU/运放地。

lyzh971103的博客 1494

Summary of GDB commands for x86-64 Systems

原文: http://csapp.cs.cmu.edu/2e/docs/gdbnotes-x86-64.pdf Summary of GDB commands for x86-64 Systems Starting: gdb gdb <file> Running and stopping Command Effect quit Exit gdb run Run program run 1 2 3 Run program with command-line argum

324

如何安装最新版本的 SAP ABAP Development Tool ( ADT ) ,并且能够随时升级

下载链接:https://tools.hana.ondemand.com/#abap 首先安装 Eclipse IDE for Java Developers 找到适合自己操作系统的 Eclipse 安装包: 安装之后,打开Eclipse: Install -> New Softwares, 输入 url:https://tools.hana.ondemand.com/latest 全部安装: 安装完毕之后,新建一个 ABAP Project,本地 SAP GUI 里添加的系统,会自动带出来:

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 4312

YOLOv11 改进 - Mamba | 集成Mamba-YOLO(AAAI 2025),Mamba-YOLOv11-B 替换骨干,破解全局依赖建模难题,实现高效实时检测

本文介绍Mamba YOLO,为图片物体识别提供了“又快又准”的新方案。传统CNN架构运行快但难以捕捉远距离关联物体,Transformer架构精度高但计算量呈平方级增长,而SSM虽计算量为线性级且能抓全局关联,但用于图片识别时细节定位不准。为此,Mamba YOLO做了三项关键优化:引入ODMamba骨干网络,解决自注意力的二次复杂度问题,且无需预训练;设计ODMamba宏观结构确定最佳阶段比例和缩放大小;采用多分支结构的RG块建模通道维度,解决SSM在序列建模中的不足。在COCO数据集测试中,其小版本推

魔改工程师的博客 867

GDB - How do I use watchpoints

5. How do I use watchpoints? Watchpoints are similar to breakpoints. However, watchpoints are not set for functions or lines of code. Watchpoints are set on variables. When those variables are read o...

maimang1001的专栏 318

第7次CCF PTA编程培训师资认证-T1 真题解析(2024下)

B。

lan_in的博客 518

gdb教程:4. How do I use breakpoints?

Breakpoints are a way of telling gdb that you want it to stop your program at certain lines of code. You can also have it stop when your program makes specific function calls. Once the program is stop

静故了群动 1264

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

gdb教程:3. How do I use the call stack?

The call stack is where we find the stack frames that control program flow. When a function is called, it creates a stack frame that tells the computer how to return control to its caller after it has

静故了群动 1174

InTheHand.Net.Personal+BlueTooth4,蓝牙开发

项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。

gdb教程:5. How do I use watchpoints?

Watchpoints are similar to breakpoints. However, watchpoints are not set for functions or lines of code. Watchpoints are set on variables. When those variables are read or written, the watchpoint is t

静故了群动 934

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

GDB使用教程

1、GDB介绍 2、debug和release的区别(参考) 3、基本使用hello world(参考) 4、GDB调试命令总结(参考) 5、在cmake中使用GDB 1、GDB介绍 GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具。或许,各位比较喜欢那种图形界面方式的,像VC、BCB等IDE的调试,但如果你是在UNIX平台下做软件,你会发现GDB这个调试工具有比...

蓬莱道人的博客 8286

How do I use gcc, g++, and gdb?

How do I use gcc, g++, and gdb?The C compiler on eniac is gcc. Its C++ counterpart is g++.To compile a C or C++ program:% gcc file.c or% g++ file.c This compiles file.c into an executable binary named

旧人赋荒年 629

GDB: don't know how to run

solution: $ gdb --version checking gdb configuration "This GDB was configured as xxx" -----------------------------------information---------------------------------- Syntax: gdb file-to-

yoic的专栏 2530

gdb教程:2. How do I watch the execution of my program?

Gdb functions somewhat like an interpreter for your programs. You can stop your program at any time by sending it signals. Normally this is done using key combinations like Ctrl-C for the interrupt si

静故了群动 996

gdb调试时的问题Missing separate debuginfos, use: debuginfo-install glibc-XXX

在CentOS6.4下使用gdb进行调试的时候, 使用bt(breaktrace)命令时,会弹出如下的提示: 头一天提示: Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.i686 问题没解决,第二天提示: Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.i686 但是直接按提示使用 debuginfo-insta

无知人生,记录点滴 9万+

gdb调试详解

一、gdb调试coredump文件 二、gdb调试多线程       【Note】:

青萍之末的博客 1万+

GDB Tutorial (GDB 调试教程)

GDB Tutorial (GDB 调试教程)

程永强 914

GDB的使用

linux下gdb的用法

weixin_58165485的博客 8047
上一篇: Linux环境变量的设置和查看
下一篇: gdb教程:2. How do I watch the execution of my program?
centos-com
博客等级 码龄23年 44粉丝 343原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值