NTUGIEE_EDA 板


LINE

※ 引述《tellux (寒川凝步)》之铭言: : 我现在弄的程式 : 跑一跑会出现问题 : 用gdb查 : 结果是 : Program received signal SIGSEGV, Segmentation fault. : CPaqpRegion::partition (this=0x8534390, isH=false, reg1=@0x8554fb8, reg2=@0x85 : 55004) : at stl_vector.h:462 : 462 stl_vector.h: No such file or directory. : in stl_vector.h : 在eda4 (gcc3.4.1)上make,在eda6上面run... : 有没有人知道这是怎麽回事呢 本来想回.......那就debug吧 :D 但是看样子你应该不大会用gdb! 我用gdb的几大步骤 (1) load coredump file (2) "bt" (3) "f OOXX", OOXX是由bt看到的数字 (4) "l" (5) "p A.B A->B....." bt--backtrack,看看calling stack的样子, main() call func1(), 再func1又call func2().... 那bt会看到 [0]main, [1]func1, [2]func2...... 以你的例子来说, 最後一个应该会在stl当中. f --frame,切换gdb所"看"到的环境, 切到calling的那一瞬间的环境, 这样可以在整个calling stack当中钻来钻去 XD l --list, 当然後列出source code, 是出事的那行的前後几行. 当然可以指定某档的某行(EX:列出main.c的23行,main.c:23) 不知道出事的行号? bt一下就又看到了. p--print, 印出这个frame环境可以看到的变数的值! 其他指令的话,可以喊救命......"help" 但是help只会列出大概的类型, 如下 (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 [...砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍...] 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. 你想知道breakpoints的东西时, 就喊help breakpoints! (gdb) help breakpoints Making program stop at certain points. List of commands: awatch -- Set a watchpoint for an expression break -- Set breakpoint at specified line or function catch -- Set catchpoints to catch events clear -- Clear breakpoint at specified line or function commands -- Set commands to be executed when a breakpoint is hit [...砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍砍...] Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. 对breakpoints中的clear有疑问, 就喊clear (gdb) help clear Clear breakpoint at specified line or function. Argument may be line number, function name, or "*" and an address. If line number is specified, all breakpoints in that line are cleared. If function is specified, breakpoints at beginning of function are cleared. If an address is specified, breakpoints at that address are cleared. With no argument, clears all breakpoints in the line that the selected frame is executing in. See also the "delete" command which clears breakpo 觉得我的"快快乐乐学不会gdb"无聊的话, 想离开就按q........ (gdb) q -- gdb的使用方法, 1) 东东有买一本gdb的书给Lab. 2) 我的桌上(书架)有一本很多年前的中文书, 当中一个chapter是gdb. 要借书,没问题. 只要让我知道书流落何方. 因为这本书也是我某不知名的学长的"赠"书.....Orz 3) 网路上的电子书: http://www.gnu.org/software/gdb/documentation/ 4) 不错的资料 http://www.study-area.org/cyril/opentools/opentools/book1.html 这份讲了一些UNIX上programming常用的工具的基本用法 5) ......给各位补充吧 XD --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.230.125 忘了补充, 有一种情况是我用gdb也查不来(应该是我功力太差 Orz ) 就是stack overflow! calling stack太小, 在程式的执行过程中, 被灌爆了 XD gdb会看到啥风景? 我忘了 Orz 只记得一切正常的样子,没问题的样子, 但那程式又coredump :O 当时"彰化"都念的几百遍 :P 还是找不到, 我是在running time, 下breakpoint, 看很久......zzzZZZZzzzz........ 到"bt"可以看到1XXX个frames时, 才猜出这是stack overflow的问题!
1F:推 bhlin:不晓得有没有装ddd? 不熟gdb的可以用ddd比较方便 11/07 19:51
2F:→ bhlin:http://www.gnu.org/software/ddd/ 11/07 19:54
3F:推 gwliao:我不会用DDD, 所以只能讲gdb的东西! 11/07 22:43
4F:推 gwliao:用gdb去debug几次, 就会发现....gdb简单的很! XD 11/07 22:46
※ 编辑: gwliao 来自: 140.112.230.125 (11/07 23:32)







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Soft_Job站内搜寻

TOP