一、 远程调试环境由宿主机GDB和目标机调试stub共同构成,两者通过串口或TCP连接。使用GDB标准远程串行协议协同工作,实现对目标机上的系统内核和上 层应用的监控和调试功能。调试stub是嵌入式系统中的一段代码,作为宿主机GDB和目标机调试程序间的一个媒介而存在。
就目前而言,嵌入式 Linux系统中,主要有三种远程调试方法,分别适用于不同场合的调试工作:用ROM Monitor调试目标机程序、用KGDB调试系统内核和用gdbserver调试用户空间程序。这三种调试方法的区别主要在于,目标机远程调试stub 的存在形式的不同,而其设计思路和实现方法则是大致相同的。
而我们最常用的是调试应用程序。就是采用gdb+gdbserver的方式进行调试。在很多情况下,用户需要对一个应用程序进行反复调试,特别是复杂的程序。采用GDB方法调试,由于嵌入式系统资源有限性,一般不能直接在目标系统上进行调试,通常采用gdb+gdbserver的方式进行调试。Gdbserver在目标系统中运行,gdb则在宿主机上运行。
要进行GDB调试,目标系统必须包括gdbserver程序,宿主机也必须安装gdb程序。一般linux发行版中都有一个可以运行的gdb,但开发人员不能直接使用该发行版中的gdb来做远程调试,而要获取gdb的源代码包,针对arm平台作一个简单配置,重新编译得到相应gdb。
下载gdb:如果放到了/home/cby目录:
#cd /home/cby
#tar zxvf gdb-6.6.tar.gz
#cd gdb-6.6
#./configure --target=arm-linux --prefix=/home/cby/arm-gdb
#make
#make install
然后建立gdbserver:
#mkdir /home/cby/gdbserver
#cd ../gdbserver
#chmod +x /home/cby/gdb-6.6/gdb/gdbserver/configure
#CC=arm-linux-gcc ../gdb-6.6/gdb/gdbserver/configure /
--host=arm-linux --prefix=/home/cby/gdbserver
#make
#make install
#arm-linux-strip gdbserver
#cp gdbserver /tftpboot
二、调试步骤
1、交叉编译,带参数-gstabs 或 -g 加入调试信息。
假设要调试的程序为hello.c。
#arm-linux-gcc -g hello.c -o hello
2、在Target Board开启gdbserver
#gdbserver <host-ip>:2345 hello (我的host-ip是192.168.0.178)
gdbserver开始监听2345端口(你也可以设其他的值),然后启动hello,你会看到“Process test created:pid=88”
3、回到Host端
#export PATH=$PATH:/home/cby/arm-gdb/bin(arm-linux-gdb的路径)
#arm-linux-gdb hello
最后一行显示:This GDB was configured as “--host=i686-pc-linux-gnu,--target=arm-linux”...
说明此gdb在X86的Host上运行,但是调试目标是ARM代码。
(gdb)target remote <target-board-ip>:2345 (我的target-board-ip is 192.168.0.177)
注意:你的端口号必须与gdbserver开启的端口号一致,这样才能进行通信。
建立链接后,就可以进行调试了。调试在Host端,跟gdb调试方法相同。注意的是要用“c”来执行命令,不能用“r”。因为程序已经在Target Board上面由gdbserver启动了。结果输出是在Target Board端,用超级终端查看。
相关推荐
arm调试-- gdb与gdbserver的安装与使用
将生成的可执行文件和 gdb-7.11.1 /gdb/gdbserver路径下生成的gdbserver复制到开发板中。PC端把可执行文件和源码拷贝到gdb-7.11.1/_install/bin下。2. 解压编译gdb以及gdbserver。1、复制gdbserver。2、运行gdbserver。5、连接gdbserver。4、在PC端运行gdb。(1)gdb PC端。(2)arm终端打印。
gdbserver使用教程
介绍与使用 gdbserver 是一个程序,它允许您在与运行被调试程序的机器不同的机器上运行 GDB。 即gdb和被调试程序分别在两个机器上运行。 ·用法(服务器(目标)端): 首先,您需要将要调试的程序的拷贝放到目标系统上。 如果需要,可以剥离程序以节省空间,因为 gdbserver 不关心符号。 所有符号处理都由运行在主机系统上的 GDB 负责。 要使用服务器,您登录到目标系统,然后运行 gdbserver 程序。 您必须告诉它 (a) 如何与 GDB 通信,(b) 程序的名.
ARM交叉编译gdbserver并远程在线调试
arm-linux平台。5、生成完整的makefile,新建full_install,执行 ./configure --target=arm-linux-gnueabihf --host=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- CC=arm-linux-gnueabihf-gcc --prefix=/home/geyuxi/Documents/full_install。如果--host和--build不同,是交叉编译;
GDB之(8)GDB-Server远程调试
GDB,全称GNU Debugger,是一个在GNU操作系统下的强大的程序调试工具,广泛应用于Unix及类Unix系统中用以调试多种编程语言编写的程序,尤其是C和C++语言。它由Richard Stallman于1980年代创建,至今仍然是开源社区中使用最为广泛的调试器之一。GDB允许程序员看到程序执行时的内部情况,诸如变量值、程序调用栈等信息,能够在程序执行到特定点时暂停,或者在出现错误时停下来。这就好比给程序员一副透视眼镜,能够洞察程序的内部运行机制。
gdb+gdbserver安装,配置和调试
就目前而言,嵌入式Linux系统中,主要有三种远程调试方法,分别适用于不同场合的调试工作:用ROM Monitor调试目标机程序、用KGDB调试系统内核和用gdbserver调试用户空间程序。这三种调试方法的区别主要在于,目标机远程调试stub 的存在形式的不同,而其设计思路和实现方法则是大致相同的。 而我们最常用的是调试应用程序。就是采用gdb+gdbserver的方式进行调试。在很多情况下,用户需要对一个应用程序进行反复调试,特别是复杂的程序。采用GDB方法调试,由于嵌入式系统资源有限性,一般不能直接在目标系统上进行调试,通常采用gdb+gdbserver的方式进行调试。
直流无刷BLDC六步换相“电流环”、“速度环”的关系
4、在电流闭环模式下,电机的电流严格按给定电流运行,负载大小变化时,电流不变,电机速度跟随负载非正常变化,例如速度严重“超速”时,需要“限速”保护,这个任务是“速度环”的,这时“速度环”会根据设定的速度上限,控制触发器,将电机速度迅速将下来,电流降下来,在“限速”保护期间,“电流环”失去对触发器的控制作用;3、在电流闭环模式下,电机的电流严格按给定电流运行,负载大小变化时,电流不变,电机速度跟随负载正常变化,“速度环”对速度大小的控制作用是没有的;6、很多人想当然,“电流环”不工作,电机“电流”哪里来的?
gdb和gdbserver的安装和调试
嵌入式Linux的GDB调试环境由Host和Target两部分组成,Host端使用arm-linux-gdb,Target Board端使用gdbserver。调试时,应用程序在嵌入式目标系统上运行,而gdb调试在Host端。gdb调试的时候,pc机上的gdb向开发板上的gdbserver发出命令,而开发板上的gdbserver就会向应用程序发出信号,使应用程序停下来或者完成其他一些工作!一般Li
光纤弯曲损耗原理、测试与工程规避实战指南
在光纤通信系统中,光信号传输依赖于纤芯内的全反射原理。当光纤发生过度弯曲时,会破坏全反射条件,导致光功率泄漏,产生弯曲损耗。这一物理机制直接影响链路的信噪比与传输稳定性,是光网络设计与运维中的关键考量因素。从技术价值看,理解并控制弯曲损耗对于保障FTTH、数据中心及5G前传等场景的链路预算至关重要。工程实践中,需通过光功率计与光时域反射仪(OTDR)等仪表进行量化测试与精确定位。针对布线中常见的宏弯与微弯问题,需在施工时严格控制弯曲半径、采用抗弯光纤(如G.657系列),并在运维中结合可视故障定位仪(VFL
gdbserver yum 安装_安装GDB和GDBSERVER
安装GDB和GDBSERVER把GDBSERVER装入文件系统在mini2440上使用GDB远程调试哈哈,一直都没有发过有建设性的帖子,今次发个《在mini2440上使用GDB远程调试》,下面的东西虽算不上绝对原创,但是经过我试验和总结的,用NFS作根文件系统配合GDB为我们的开发和学习提供了很大的便利,希望大家会喜欢!arm-linux-gdb移植——PC端1. 到http://www.gnu...
硬件工程师笔记——电子器件汇总大全
本文系统总结了14种常用电子器件的工作原理及功能应用,包括电阻、压敏电阻、电容、电感、二极管、三极管、MOS管、晶振、光耦、IGBT、继电器、磁珠、可控硅和线性稳压器。每种器件从结构原理、工作特性到典型应用进行全面解析,如电阻的限流分压、电容的储能滤波、三极管的放大开关等。重点阐述了各器件在电路设计中的关键作用,如IGBT的功率控制、继电器的隔离保护、LDO的电压稳定等,并提供了实际电路应用案例。文章还整理了硬件工程师笔试面试相关的知识点和真题资源,为电子工程师提供全面的技术参考。
华为OD机试新系统真题 【查找最佳充电策略】
华为OD机试 新系统真题【查找最佳充电策略】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【查找最佳充电策略】多语言题解。
gdb tui 安装_gdb+gdbserver安装
1.下载下载最新的gdb-7.2.tar.gz2.简介GDB使用了autoconf/automake,因此编译时只需配置configure脚本的--target,--host,--prefix等参数就可实现方便的移植。--target:指定编译环境,一般设置为交叉编译器前缀,ix86-linux,arm-linux等--prefix;指定安装路径。--host:指定编译后文件运行平台,一般设置为交...
Android SystemUI——自定义状态栏和导航栏(十二)
通过前面的文章内容,我们了解了Android系统原生的状态栏StatusBar和车载系统状态栏CarStatusBar的启动流程以及视图构建流程,这里我们来简单的看一下自定义状态栏和导航栏视图的实现流程。
安装GDB和GDBSERVER
安装GDB和GDBSERVER 转自http://www.360doc.com/content/10/0407/17/155970_21971613.shtml 把GDBSERVER装入文件系统 转自http://www.arm9home.net/read.php?tid-1396.html 在mini2440上使用GDB远程调试哈哈,一直都没有发过有建设性的帖子,今次发个《在mini2440...
Android驱动工程师职位(侧重于Bringup、外设驱动调试、芯片平台经验)
本文摘要:深圳泓京纬科技招聘Android驱动工程师,要求具备Bootloader/LK/Linux Bringup经验,熟悉LPDDR/eMMC/UFS等存储设备调试。文章详细解析了Android系统架构、Linux驱动开发核心概念、设备树作用、串口调试方法等基础知识。重点介绍了存储驱动架构、性能优化和故障排查技巧,包括eMMC识别问题、UFS性能优化、NAND ECC错误处理等实战场景。同时涵盖芯片平台开发经验、跨部门协作调试方法,以及低温环境等特殊场景的问题解决方案。
26、特洛伊木马:威胁与防范
本文详细介绍了多种常见的特洛伊木马,包括RegForm、ProMail和远程访问特洛伊木马(RATs),并分析了其工作原理与危害。重点讲解了著名RATs如Back Orifice、SubSeven和The Thing的技术特点,揭示了黑客编写特洛伊木马的常用语言与方法。同时,提供了有效的防范策略,如谨慎获取软件、使用回滚程序、杀毒软件、防火墙及反特洛伊木马程序,并通过流程图展示了防御机制。旨在帮助用户识别威胁并加强系统安全防护。
gdb tui 安装_安装GDB和GDBSERVER
标签:安装GDB和GDBSERVER把GDBSERVER装入文件系统在mini2440上使用GDB远程调试哈哈,一直都没有发过有建设性的帖子,今次发个《在mini2440上使用GDB远程调试》,下面的东西虽算不上绝对原创,但是经过我试验和总结的,用NFS作根文件系统配合GDB为我们的开发和学习提供了很大的便利,希望大家会喜欢!arm-linux-gdb移植——PC端1. 到http://www....
基于opencv的鱼群检测和数量统计识别鱼群密度带界面
摘要:本项目利用OpenCV图像处理技术实现了视频鱼类自动检测计数系统。通过背景减除、形态学处理和轮廓检测等方法,在视频帧中标记鱼类并统计数量。系统包含视频读取、前景提取、轮廓分析、中心点跟踪等核心功能,可实时显示计数结果。适用于水产养殖、生态监测等领域,具有实用价值。未来可通过参数优化、引入深度学习和多目标跟踪技术进一步提升准确性。(147字)
gdb tui 安装_gdb gdbserver 的安装使用 | 学步园
GDB和gdbserver可以很方便的调试目标机应用程序,今天通过查阅相关资料我也实现了这项有非常意义的技术。我的环境如下,可参考,目前较新gdb版本支持的交叉编译器应该较多。主机linux:F9目标机:S3C2440目标机内核:2.6.30主机交叉编译器:EBAI4.3.2arm-linux-gdb、gdbserver版本7.2 (下载地址ftp.gnu.org/gnu/gdb/)调试程序:随...
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
Statistics and Machine Learning Toolbox
Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具
编译安装gdb+insight和gdbserver远程调试
编译安装gdb+insight和gdbserver远程调试arm开发板native应用程序下载gdb-6.8.tar.bz2http://ftp.cs.pu.edu.tw/Linux/sourceware/gdb/releases/一.编译安装gdbluther@gliethttp:~/gdb-6.8$ ./configure --target=arm-linux --enable-sim --p
假人有限元模型
假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用
GDB+GDBServer 安装、配置和调试说明
GDB+GDBServer 安装、配置和调试说明 去发现同类优质开源项目:https://gitcode.com/ 本文档提供了关于如何在嵌入式Linux系统中安装、配置和使用GDB+GDBServer进行应用程序调试的详细指导。在当前嵌入式系统开发环境中,针对应用程序的远程调试,GDB+GDBServer是一种非常常见且有效的方法。 概述 嵌入式Linux系统中,常见的远程调试方法有三种:ROM...
InTheHand.Net.Personal+BlueTooth4,蓝牙开发
项目中有蓝牙开发的必备dll,现在网上相关的文档博客不少,有的说的多有的说少,但是却很少有这两个dll,分享一下。
gdb 和gdbserver 的安装错误排除
这里我采用的系统是CentOs5.1 gdb-6.8 arm-linux-gcc 4.2.1下面说明安装gdb及gdbserver的过程,及错误处理:[root@JiaKun arm_tools_source]#mkdir arm-linux-gcc-tools_sources[root@JiaKun arm_tools_source]# cd arm-linux-gcc-
1722




被折叠的 条评论
为什么被折叠?



