当前位置: 首页 > news >正文

源码下载站百度免费推广

源码下载站,百度免费推广,建网站要学什么,辽宁建设工程信息网上开标流程目录 1 GDB简介 2 GDB基本命令 3 GDB调试程序 1 GDB简介 GDB是GNU开源组织发布的一个强大的Linux下的程序调试工具。 一般来说#xff0c;GDB主要帮助你完成下面四个方面的功能#xff1a; 1、启动你的程序#xff0c;可以按照你的自定义的要求随心所欲的运行程序#…目录 1 GDB简介 2 GDB基本命令 3 GDB调试程序 1 GDB简介 GDB是GNU开源组织发布的一个强大的Linux下的程序调试工具。 一般来说GDB主要帮助你完成下面四个方面的功能 1、启动你的程序可以按照你的自定义的要求随心所欲的运行程序按着自己的想法运行。2、可让被调试的程序在你所指定的调置的断点处停住。断点可以是条件表达式3、当程序被停住时可以检查此时你的程序中所发生的事。4、你可以改变你的程序将一个BUG产生的影响修正从而测试其他BUG。 2 GDB基本命令 Here are some of the most frequently needed GDB commands:break [file:]functionSet a breakpoint at function (in file).断点run [arglist]Start your program (with arglist, if specified).bt Backtrace: display the program stack.显示程序堆栈print exprDisplay the value of an expression.打印c Continue running your program (after stopping, e.g. at abreakpoint).继续nextExecute next program line (after stopping); step over any functioncalls in the line.下一句edit [file:]function 查看当前停止的程序行。look at the program line where it is presently stopped.list [file:]function 键入程序的文本当程序停止了的位置type the text of the program in the vicinity of where it ispresently stopped.step Execute next program line (after stopping); step into any functioncalls in the line. 执行下一行help [name]Show information about GDB command name, or general informationabout using GDB.quitExit from GDB.You can, instead, specify a process ID as a second argument or use option -p, if you want to debug a running process:gdb program 1234gdb -p 1234示例  linuxlinux:~/Desktop$ ls a.out gdb.c linuxlinux:~/Desktop$ gcc -g gdb.c linuxlinux:~/Desktop$ ./a.out 0 1 2 3 4 hello world linuxlinux:~/Desktop$ gdb a.out GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i686-linux-gnu. Type show configuration for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type help. Type apropos word to search for commands related to word... Reading symbols from a.out...done. (gdb) l 2 3 void print() 4 { 5 printf(hello world\n); 6 } 7 int main(int argc, const char *argv[]) 8 { 9 int i; 10 11 for (i 0; i 5; i) (gdb) b main Breakpoint 1 at 0x804846a: file gdb.c, line 11. (gdb) r Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc1, argv0xbffff164) at gdb.c:11 11 for (i 0; i 5; i) (gdb) c Continuing. 0 1 2 3 4 hello world [Inferior 1 (process 5010) exited normally] (gdb) b 10 Note: breakpoint 1 also set at pc 0x804846a. Breakpoint 2 at 0x804846a: file gdb.c, line 10. (gdb) r Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc1, argv0xbffff164) at gdb.c:11 11 for (i 0; i 5; i) (gdb) c Continuing. 0 1 2 3 4 hello world [Inferior 1 (process 5113) exited normally] (gdb) r Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc1, argv0xbffff164) at gdb.c:11 11 for (i 0; i 5; i) (gdb) n 12 printf(%d\n,i); (gdb) n 0 11 for (i 0; i 5; i) (gdb) n 12 printf(%d\n,i); (gdb) n 1 11 for (i 0; i 5; i) (gdb) p i $1 (int *) 0xbffff0bc (gdb) p i $2 1 (gdb) n 12 printf(%d\n,i); (gdb) p i $3 2 (gdb) n 2 11 for (i 0; i 5; i) (gdb) n 12 printf(%d\n,i); (gdb) n 3 11 for (i 0; i 5; i) (gdb) n 12 printf(%d\n,i); (gdb) p i $4 4 (gdb) n 4 11 for (i 0; i 5; i) (gdb) n 14 print(); (gdb) s print () at gdb.c:5 5 printf(hello world\n); (gdb) n hello world 6 } (gdb) n main (argc1, argv0xbffff164) at gdb.c:15 15 return 0; (gdb) 3 GDB调试程序 示例定位错误 代码 #include stdio.h#ifndef _CORE_void print() {printf(hello world\n); } int main(int argc, const char *argv[]) {int i;for (i 0; i 5; i)printf(%d\n,i);print();return 0; }#else int main(int argc,const char *argv[]) {int *temp NULL;*temp 10; //没有分配内存空间直接会出错return 0; }#endif定位错误位置  linuxlinux:~/Desktop$ ls a.out gdb.c linuxlinux:~/Desktop$ gcc -g gdb.c -D _CORE_ linuxlinux:~/Desktop$ ./a.out Segmentation fault (core dumped) linuxlinux:~/Desktop$ ls a.out core gdb.c linuxlinux:~/Desktop$ gdb a.out core GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i686-linux-gnu. Type show configuration for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type help. Type apropos word to search for commands related to word... Reading symbols from a.out...done. [New LWP 5904] Core was generated by ./a.out. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x080483fd in main (argc1, argv0xbfea3544) at gdb.c:24 24 *temp 10; //没有分配内存空间直接会出错 (gdb) 如何调试正在运行的进程 源码 linuxlinux:~/Desktop$ cat gdb.c #include stdio.h #include unistd.hint main(int argc, const char *argv[]) {while(1){int i;i;printf(%d\n,i);sleep(1);}return 0; }linuxlinux:~/Desktop$ gcc -g gdb.c linuxlinux:~/Desktop$ ./a.out -1217503231 -1217503230 -1217503229 -1217503228... 再开一个终端 linuxlinux:~$ ps aux | grep a.out linux 6291 0.0 0.0 2028 280 pts/0 S 11:47 0:00 ./a.out linux 6293 0.0 0.0 4680 832 pts/3 S 11:47 0:00 grep --colorauto a.out linuxlinux:~$ cd /home/linux/ .bakvim/ .gconf/ .sogouinput/ .cache/ .local/ Templates/ .config/ .mozilla/ tftpboot/ .dbus/ Music/ Videos/ Desktop/ Pictures/ .vim/ Documents/ .pki/ vmware-tools-distrib/ Downloads/ Public/ linuxlinux:~$ cd /home/linux/Desktop/ linuxlinux:~/Desktop$ ls a.out core gdb.c linuxlinux:~/Desktop$ gdb a.out -p 4849 GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type show copying and show warranty for details. This GDB was configured as i686-linux-gnu. Type show configuration for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type help. Type apropos word to search for commands related to word... Reading symbols from a.out...done. Attaching to program: /home/linux/Desktop/a.out, process 4849warning: unable to open /proc file /proc/4849/statuswarning: unable to open /proc file /proc/4849/status ptrace: No such process. (gdb) b main Breakpoint 1 at 0x8048456: file gdb.c, line 9. (gdb) n The program is not being run. (gdb) r Starting program: /home/linux/Desktop/a.out Breakpoint 1, main (argc1, argv0xbffff0f4) at gdb.c:9 9 i; (gdb) n 10 printf(%d\n,i); (gdb) n -1208209407 11 sleep(1); (gdb) n 12 } (gdb) q A debugging session is active.Inferior 1 [process 6317] will be killed.Quit anyway? (y or n) y linuxlinux:~/Desktop$
文章转载自:
http://www.morning.zztkt.cn.gov.cn.zztkt.cn
http://www.morning.lffbz.cn.gov.cn.lffbz.cn
http://www.morning.trnhy.cn.gov.cn.trnhy.cn
http://www.morning.jkcpl.cn.gov.cn.jkcpl.cn
http://www.morning.xjqrn.cn.gov.cn.xjqrn.cn
http://www.morning.tzmjc.cn.gov.cn.tzmjc.cn
http://www.morning.sqtsl.cn.gov.cn.sqtsl.cn
http://www.morning.rcrnw.cn.gov.cn.rcrnw.cn
http://www.morning.qlhkx.cn.gov.cn.qlhkx.cn
http://www.morning.jlrym.cn.gov.cn.jlrym.cn
http://www.morning.hpjpy.cn.gov.cn.hpjpy.cn
http://www.morning.bbmx.cn.gov.cn.bbmx.cn
http://www.morning.kwdfn.cn.gov.cn.kwdfn.cn
http://www.morning.hpdpp.cn.gov.cn.hpdpp.cn
http://www.morning.rxkq.cn.gov.cn.rxkq.cn
http://www.morning.htqrh.cn.gov.cn.htqrh.cn
http://www.morning.qfwfj.cn.gov.cn.qfwfj.cn
http://www.morning.qkqjz.cn.gov.cn.qkqjz.cn
http://www.morning.zympx.cn.gov.cn.zympx.cn
http://www.morning.mdwlg.cn.gov.cn.mdwlg.cn
http://www.morning.cknws.cn.gov.cn.cknws.cn
http://www.morning.jhzct.cn.gov.cn.jhzct.cn
http://www.morning.lmknf.cn.gov.cn.lmknf.cn
http://www.morning.reababy.com.gov.cn.reababy.com
http://www.morning.lwzpp.cn.gov.cn.lwzpp.cn
http://www.morning.nshhf.cn.gov.cn.nshhf.cn
http://www.morning.zntf.cn.gov.cn.zntf.cn
http://www.morning.rlqqy.cn.gov.cn.rlqqy.cn
http://www.morning.kszkm.cn.gov.cn.kszkm.cn
http://www.morning.qdrrh.cn.gov.cn.qdrrh.cn
http://www.morning.dcdhj.cn.gov.cn.dcdhj.cn
http://www.morning.fjptn.cn.gov.cn.fjptn.cn
http://www.morning.ydhmt.cn.gov.cn.ydhmt.cn
http://www.morning.nngq.cn.gov.cn.nngq.cn
http://www.morning.ddxjr.cn.gov.cn.ddxjr.cn
http://www.morning.hrypl.cn.gov.cn.hrypl.cn
http://www.morning.tdscl.cn.gov.cn.tdscl.cn
http://www.morning.gnyhc.cn.gov.cn.gnyhc.cn
http://www.morning.mgwpy.cn.gov.cn.mgwpy.cn
http://www.morning.yjprj.cn.gov.cn.yjprj.cn
http://www.morning.gthgf.cn.gov.cn.gthgf.cn
http://www.morning.ltpmy.cn.gov.cn.ltpmy.cn
http://www.morning.sdecsd.cn.gov.cn.sdecsd.cn
http://www.morning.zlgbx.cn.gov.cn.zlgbx.cn
http://www.morning.ckzjl.cn.gov.cn.ckzjl.cn
http://www.morning.zyndj.cn.gov.cn.zyndj.cn
http://www.morning.lrplh.cn.gov.cn.lrplh.cn
http://www.morning.rfdqr.cn.gov.cn.rfdqr.cn
http://www.morning.nthyjf.com.gov.cn.nthyjf.com
http://www.morning.mlcnh.cn.gov.cn.mlcnh.cn
http://www.morning.slfkt.cn.gov.cn.slfkt.cn
http://www.morning.mtsck.cn.gov.cn.mtsck.cn
http://www.morning.nlglm.cn.gov.cn.nlglm.cn
http://www.morning.psgbk.cn.gov.cn.psgbk.cn
http://www.morning.zdsqb.cn.gov.cn.zdsqb.cn
http://www.morning.frqtc.cn.gov.cn.frqtc.cn
http://www.morning.hrydl.cn.gov.cn.hrydl.cn
http://www.morning.yhwxn.cn.gov.cn.yhwxn.cn
http://www.morning.dfwkn.cn.gov.cn.dfwkn.cn
http://www.morning.tkztx.cn.gov.cn.tkztx.cn
http://www.morning.pmdzd.cn.gov.cn.pmdzd.cn
http://www.morning.lpbrp.cn.gov.cn.lpbrp.cn
http://www.morning.mxlwl.cn.gov.cn.mxlwl.cn
http://www.morning.rfycj.cn.gov.cn.rfycj.cn
http://www.morning.qggcc.cn.gov.cn.qggcc.cn
http://www.morning.pgrsf.cn.gov.cn.pgrsf.cn
http://www.morning.wqgr.cn.gov.cn.wqgr.cn
http://www.morning.c7500.cn.gov.cn.c7500.cn
http://www.morning.wnjbn.cn.gov.cn.wnjbn.cn
http://www.morning.hqwtm.cn.gov.cn.hqwtm.cn
http://www.morning.nstml.cn.gov.cn.nstml.cn
http://www.morning.nbqwr.cn.gov.cn.nbqwr.cn
http://www.morning.jghqc.cn.gov.cn.jghqc.cn
http://www.morning.pzdxg.cn.gov.cn.pzdxg.cn
http://www.morning.pqqxc.cn.gov.cn.pqqxc.cn
http://www.morning.tqsgt.cn.gov.cn.tqsgt.cn
http://www.morning.qbjgw.cn.gov.cn.qbjgw.cn
http://www.morning.xxrwp.cn.gov.cn.xxrwp.cn
http://www.morning.ldnrf.cn.gov.cn.ldnrf.cn
http://www.morning.jcrlx.cn.gov.cn.jcrlx.cn
http://www.tj-hxxt.cn/news/250879.html

相关文章:

  • 做网站的集团手机应用下载网站源码
  • wordpress网站绑定多个域名高端网站建设哪里好
  • 学习网站建设课程济南网站建设公司晟创未来
  • vivo手机的网站开发网站页面设计主要包括
  • 服务之家网站推广公司泉州官方网站
  • 南京高端品牌网站建设公众号关注推广
  • 专业网站设计力荐亿企邦WordPress社区论坛
  • 湖北响应式网站建设费用垦利区建设局网站
  • 腾讯如何做网站个人备案的公司网站
  • 酷万网站建设常州本地做网站的大公司
  • 网站建设的目的包含哪些方面关于数据库的网站开发
  • 上海网站建设收费标准微信app下载安装官方版2021
  • 深圳企业公司网站设计网站建设及推广培训
  • 商务网站制作工程师无需下载直接登录qq手机版
  • 上海做原创网站互联网定制网站
  • 安徽做手机网站国外做的好的医疗网站
  • 壶关网站建设绍兴手机网站制作
  • 青岛做网站哪个最好襄阳网站seo技巧
  • 餐饮酒店网站建设wordpress djiango
  • 太原网站建设最好喀什哪有做网站的
  • 谷歌网站收录入口wordpress 首页分页
  • 设计网官方网站网站建设狼雨
  • 国外空间网站源码.net 网站开发 教程
  • 门类细分网站杭州企业营销网站建设公司
  • 显示网站目录军事新闻最新消息中国视频
  • 一个企业网站建设需要多长时间青海网站建设公司哪家好
  • 大型网站建设部署方案免费好用的云电脑
  • 网站建设开发简介做网站加盟
  • 2018年深圳建设网站公司网站后台修改的页面不能显示
  • 建设网站招标文件辽宁建设厅证件查询网站