由买买提看人间百态

topics

全部话题 - 话题: gdb
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
d1
发帖数: 1213
1
what do you mean? mine is 10.7 and it runs fine.
unknown$ gdb
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 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 "x86_64-apple-darwin11.2.0".
For bug reporting instructions, please see:
<http://www.gnu... 阅读全帖
k****f
发帖数: 3794
2
一下子显示太多了,gdb窗口的行数太多了
怎么能够不关闭gdb,把gdb内的行全部清除了
就像term里面的clear一样,
gdb的断点信息实在不想去设置了,想用现在的。
g*********s
发帖数: 1782
3
来自主题: Programming版 - stl iterator in gdb
I have some code using stl container and algorithm to debug. Below is what I get:
tag is a vector with size 3, the content is 0, 1, 2.
(gdb) p tag.begin()
$3 = {_M_current = 0x8053008}
(gdb) p tag.end()
$4 = {_M_current = 0x8053014}
(gdb) p tag.size()
$5 = 3
(gdb) p (tag.end() - tag.begin())
Attempt to take address of value not located in memory.
Why "3" is not properly output?
(gdb) p std::find(tag.begin(), tag.end(), 2)
No symbol "find" in namespace "std".
f**********t
发帖数: 1001
4
来自主题: JobHunting版 - gdb打印stl的问题
http://wiki.codeblocks.org/index.php?title=Pretty_Printers
类似的方案试了好久,不成功
(gdb) info pretty-printer
global pretty-printers:
builtin
mpx_bound128
libstdc++-v6
__gnu_cxx::_Slist_iterator
__gnu_cxx::__7::_Slist_iterator
__gnu_cxx::__7::__normal_iterator
这个builtin不能被消除disable pretty-printer builtin
gdb -version
GNU gdb (GDB) 7.8.1
https://github.com/gdbinit/Gdbinit/blob/master/gdbinit 也不好用。"program
exited with code 126"
系统: mac os x yosemite
谢谢
w***g
发帖数: 5958
5
来自主题: Programming版 - 用vim + gdb 调试的人牛屄轰轰的
正确组合是 vim + gdb + 终端(mitbbs) + 浏览器(stackoverflow)
emacs应该没有整合term和浏览器. 大部分时间其实都花在了终端和
浏览器了, 10% on vim和命令行. 话在gdb上的时间不到1%, 是不是
整合无所谓了. 我没用过emacs下的gdb, 但是我试过各种号称整合
gdb的GUI, 都不经操.
y***w
发帖数: 44
6
来自主题: SanFrancisco版 - Linux 下用 gdb 如何debug java? (转载)
【 以下文字转载自 Java 讨论区 】
发信人: yuanw (l_tiger), 信区: Java
标 题: Linux 下用 gdb 如何debug java?
发信站: BBS 未名空间站 (Wed May 30 03:11:32 2012, 美东)
I have followed the instruction of the following page to compile and run.
http://gcc.gnu.org/java/gdb.html
From GDB, I could set a break point and stop at that break point. But I
could not print any value of the variables. When I tried to print the value
of a variable, there is an error print like the following:
No symbol "args" in current context
I could trace the p... 阅读全帖
t********l
发帖数: 106
7
【 以下文字转载自 SanFrancisco 讨论区 】
发信人: tianyagirl (呢喃), 信区: SanFrancisco
标 题: 【贴图】这个人的Emacs + GDB 是怎么做出来的?
发信站: BBS 未名空间站 (Tue Jul 31 08:15:02 2007)
左上角是gdb interactive buffer, 和在命令行上用gdb是一样的,可以看到第三行的
hello是main()里的输出。
右上角是当前函数的本地变量,可以看到g的值还没有赋,是一个任意值。
中间是源代码,其中有红色圆点的是设有断点的行,有白色三角的是当前行(下一步将
要执行的行)。设断点的话在这个buffer里移动到要设断点的行,然后C-x space。
左下角是函数调用栈。
右下角是断点信息。
大家用Emacs编译C++也是这么fancy么?这个效果是怎么搞出来的?
d*******d
发帖数: 2050
8
来自主题: Programming版 - 问个问题,关于gdb的
【 以下文字转载自 SanFrancisco 讨论区 】
发信人: dinohound (dino), 信区: SanFrancisco
标 题: 问个问题,关于gdb的
发信站: BBS 未名空间站 (Tue Sep 11 17:35:15 2007), 转信
在linux本机上用gdb/ddd debug程序,一切正常。
可是,如果用ssh/vnc remote登陆上去后,做同样的事情,gdb will give out the er
ror said"Program terminated with signal SIGTRAP"。
这个是为什么?//bow
c********e
发帖数: 383
9
来自主题: Programming版 - 问个问题,关于gdb的
info gdb
On most systems, GDB has no special support for debugging programs
which create additional processes using the `fork' function. When a
program forks, GDB will continue to debug the parent process and the
child process will run unimpeded. If you have set a breakpoint in any
code which the child then executes, the child will get a `SIGTRAP'
signal which (unless it catches the signal) will cause it to terminate.
However, if you want to debug the child process there is a workaround
whi
f******e
发帖数: 164
10
【 以下文字转载自 Linux 讨论区 】
发信人: francise (小飞猫), 信区: Linux
标 题: 如何GDB调试因pthread_cond_wait()阻塞的线程?
发信站: BBS 未名空间站 (Thu Apr 3 02:08:42 2008)
比如有两个线程1,2,主线程1执行到某处会pthread_cond_wait(),然后由线程2唤醒
,继续执行.
我用gdb调试时却出了问题,调试时主线程执行到pthread_cond_wait()函数处
,进入等待状态,ctrl+c后看到的线程信息如下:
(gdb) info thread
* 3 Thread 1026 (LWP 19165) 0x420292e5 in sigsuspend ()
from /lib/i686/libc.so.6
2 Thread 2049 (LWP 19164) 0x420e0037 in poll () from
/lib/i686/libc.so.6
b***y
发帖数: 2799
11
来自主题: Programming版 - [合集] gdb question
☆─────────────────────────────────────☆
ariverhorse (小河马) 于 (Fri Sep 30 11:02:58 2005) 提到:
when I debug c++ code using gdb, whenever i have some overloaded operator,
gdb will jump into the source code, samething happens when i have STL,
Is there any way to make gdb do not jump into the source? Bow!
以下是附件内容:
c*********t
发帖数: 2921
12
来自主题: Programming版 - 请教:如何在vim里运行gdb? (转载)
【 以下文字转载自 Linux 讨论区 】
发信人: cookiesweet (apple), 信区: Linux
标 题: 请教:如何在vim里运行gdb?
发信站: BBS 未名空间站 (Thu Jun 16 03:07:26 2011, 美东)
能不能就像在emacs里那样可以很方便的运行gdb, 当执行gdb 的 next, 就能看到源代
码在一个独立的窗口里自动的一行一行的跑。
在vim里面怎么弄?
有包子送!
谢谢!
b******n
发帖数: 592
13
来自主题: Programming版 - 请教:如何在vim里运行gdb? (转载)
use clewn..emacs has better integration..mostly you don't need to run it
in any editor. gdb can display the source code window..
http://resbook.wordpress.com/2010/11/19/display-source-in-gdb/
if you want to try clewn, you can follow this:
http://chunhao.net/blog/how-to-connect-vim-with-gdb-using-clewn
k**l
发帖数: 2966
14
来自主题: Programming版 - gdb debug c++的问题
公司的程序很长,我只改其中一段。现在总是crash (好像不是我改的部分出的问题),
因为要在server上测所以只好用gdb debug了。刚学gdb,这backtrace全是地址咋办---
或者这个suggest哪类地方的错?有什么(其他)办法可以看出哪一段程序出了错么?
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x4820c940 (LWP 21185)]
0x0000000103000000 in ?? ()
(gdb) bt
#0 0x0000000103000000 in ?? ()
#1 0x3b00483db16c0105 in ?? ()
#2 0x0000003101000000 in ?? ()
#3 0x000000002f685900 in ?? ()
#4 0x3701000000000000 in ?? ()
#5 0x0103000000003222 in ?? ()
#6 0x3db16c0106000000 in ?? ()
#7... 阅读全帖
t*****n
发帖数: 4908
15
来自主题: Programming版 - 用vim + gdb 调试的人牛屄轰轰的
我用了10年的gdb+eamcs,很顺手。没有必要搞什么多窗口的gdb。设断点,看变量,单
步等等,都非常方便。就是stl的vector,也有办法看。VS我也用。和gdb各有千秋。
s****t
发帖数: 220
16
来自主题: Unix版 - 一个关于GDB的问题
为什么我用GDB调试程序时,很多指令不能返回文件和具体行数的信息?
比如,我用了 breakpoint main 命令
按照关于GDB的帮助手册上,应该返回这样的信息:
Breakpoint 1 at 0x8049552: file xxxx.c, line 455
可是给我的返回信息却只有 Breakpoint 1 at 0x8049552
再比如,在程序运行出错时也应该返回所在的文件和所在的行数,
却也是只返回Ox8049552这种信息.
不知是GDB设置问题,还是在编译程序时哪里设置不对?
h*****g
发帖数: 9
17
When I used gdb debug C++ program, I encountered the follow problem.
Source code: myprogram.cc
executable code: myprogram
I used CC compiler to compile.
****************************
> gdb myprogram
> break myprogram.cc:myfunction
(Here, myfunction is a function in myprogram.cc)
Function "myfunction" not defined.
****************************
So the problem is that gdb always gives me "Function "myfunction" not defined"
message when I try to set a breakpoint at that function.
Is there anyone can
t********l
发帖数: 106
18
【 以下文字转载自 SanFrancisco 讨论区 】
发信人: tianyagirl (呢喃), 信区: SanFrancisco
标 题: 【贴图】这个人的Emacs + GDB 是怎么做出来的?
发信站: BBS 未名空间站 (Tue Jul 31 08:15:02 2007)
左上角是gdb interactive buffer, 和在命令行上用gdb是一样的,可以看到第三行的
hello是main()里的输出。
右上角是当前函数的本地变量,可以看到g的值还没有赋,是一个任意值。
中间是源代码,其中有红色圆点的是设有断点的行,有白色三角的是当前行(下一步将
要执行的行)。设断点的话在这个buffer里移动到要设断点的行,然后C-x space。
左下角是函数调用栈。
右下角是断点信息。
大家用Emacs编译C++也是这么fancy么?这个效果是怎么搞出来的?
d1
发帖数: 1213
19
gdb is not preinstalled with osx. but if you install xcode, they install an
apple version of gdb for you, which doesn't have tui enabled.
S**I
发帖数: 15689
20
You can compile gdb from source, which runs perfectly in 10.6 but not in 10.
7, which may need to-be-released gdb 7.4.
S**I
发帖数: 15689
21
I'm not saying gdb can't run; it has some problems when debugging on 10.7.
BTW, if you compiled gdb from source, gdbtui is built, too.
y***w
发帖数: 44
22
来自主题: Java版 - Linux 下用 gdb 如何debug java?
I have followed the instruction of the following page to compile and run.
http://gcc.gnu.org/java/gdb.html
From GDB, I could set a break point and stop at that break point. But I
could not print any value of the variables. When I tried to print the value
of a variable, there is an error print like the following:
No symbol "args" in current context
I could trace the program step by step, but I just could not print the value
of those variables. Could somebody tell me how to print the values of tho... 阅读全帖
g***r
发帖数: 281
23
来自主题: Linux版 - 在 vim 里用 gdb (on Linux)
请各位vim guru 推荐怎么用gdb ?
可以看stack trace, breakpoint, 而且可以link到source code 上.
周围同事大部分人用 emacs 貌似和 gdb integrate 的很好.
想问vim里应该也有类似的东西. 多谢 !
c*********t
发帖数: 2921
24
来自主题: Linux版 - 请教:如何在vim里运行gdb?
能不能就像在emacs里那样可以很方便的运行gdb, 当执行gdb 的 next, 就能看到源代
码在一个独立的窗口里自动的一行一行的跑。
在vim里面怎么弄?
有包子送!
谢谢!
s******c
发帖数: 1920
25
来自主题: Linux版 - 关于gdb一问
编译一个程序。如果configure 的时候 enable-static 那么segfault的时候用gdb就有
具体的debug信息(比如call stack 对应到lineno in file);
如果 enable-shared, gdb的时候就只有main有lineno,其他的就没有
请问如果编译成动态库是不是还要有些什么选项要打开?
现在用的是-g -ggdb 操作系统是MacOS10.7 (Lion)
w*s
发帖数: 7227
26
来自主题: Linux版 - gdb cann't display variable value
so i build the app with "-g" etc., i can set the breakpoint if just "gdb app
".
now i run the app directly, it crashed, got a core file.
run "gdb myapp mycore", "bt",
switch around frames, try to print the variables, but got sth. like
"cannot get the variable/symbol info" etc. (sorry just cannot remember the
exact message)
but "list" can list the source code.
any suggestions ?
again, thanks for all the help !
l*****l
发帖数: 171
27
来自主题: Programming版 - trouble using gdb debugging C/C++
I was using gdb to debug my C/C++ code under linux. I have trouble to display
the elements of a local array. For example:
(gdb) print myArray[0]
This always gives me the address of the first element, not the value.
If the array is dynamically allocated, then there is no problem.
Thanks ahead for your help!
s********h
发帖数: 286
28
来自主题: Programming版 - 又一个GDB的问题:关于显示数据
我在程序停止的时候用
print dz[j]
打印我的数据,dz是一个数组,j是index。打印出来的数据和实际不一样!
实际上,在我的程序中,也就是停止程序的前一个语句,已经让程序打印出来这个值:
fprintf(stderr, "dz[%d]=%g,",j,dz[j]);
显示的是
dz[5]=0.603372,
可是用GDB打印的结果却是
(gdb) print dz[j]
$3 = 36.7898712
我也试了打印其它格式,都不对,实在找不到问题在哪里了。
请问大家知道这是怎么回事吗?多谢先!!!
l*****c
发帖数: 1153
29
来自主题: Programming版 - 问个gdb的问题
刚刚开始用感到gdb。我的程序从一个文本文件读输入:
cat input.txt > myprogram
在gdb里面怎么run?
我试了run > output.txt是可以的,但是写cat input.txt > run是肯定不行了。
i******t
发帖数: 48
30
来自主题: Programming版 - gdb debugging issue求助
【 以下文字转载自 Linux 讨论区 】
发信人: inforest (IN FOREST), 信区: Linux
标 题: gdb debugging issue求助
发信站: BBS 未名空间站 (Thu Dec 20 18:47:58 2007), 转信
在gdb里设置断点break **.cpp:11
总是出现no source file named **.cpp
请问这是怎么回事,如何解决?用directory加了目录还是没用。
Thanks in advance.
d*****i
发帖数: 44
31
来自主题: Programming版 - 如何在gdb中遍历binary tree
工作中遇到一个难题,请高手指教.
条件:只有一个coredump,gdb,我可以找到coredump中binary tree的root
使用gdb中的command,convenience variable可以支持简单的variable,loop,if else.
但是不支持array,而且没有stack(all variable are global).
请问如何遍历?不管效率。谢谢
n**d
发帖数: 9764
32
来自主题: Programming版 - gdb in C++
Could we use gdb to debug C++ code?
What option do we have to use to compile the code?
What is difference to use gdb in C and C++?
h******e
发帖数: 26
33
来自主题: Programming版 - 请教一个GDB/DWARF2的问题
gdb是怎么把dwarf2的信息和源代码联系起来的?这个问题比较大,有没有哪位大牛来
点拨一下?
我现在的项目是做一个code coverage test(覆盖测试)的工具。我的思路是希望gdb
在监控/调试程序运行的时候能输出已经执行过程序的dwarf2信息,这样和object file
里完整的dwarf2信息比较就知道哪一部分程序运行过,哪一部分没有。这个思路如何?
g*********s
发帖数: 1782
34
来自主题: Programming版 - 多线程下的gdb core dump问题
多线程程序里有memory corruption,产生了core dump。用gdb -core core_file,然
后bt,看到crash的地方有些莫名其妙。是不是别的线程crash,但是core dump针对主
线程?
另外gdb->bt的结果能自动保存到文件里么?现在我是从屏幕上复制下来写到文件里,
没法自动化。
q*********9
发帖数: 8
35
来自主题: Programming版 - 多线程下的gdb core dump问题
info thread: to see what are the threads and thread numbers, my core dumps
always happen in the last thread.
thread #: (where '#' is the thread number) to change to the specified thread.
set logging on: -- log the gdb output to file gdb.txt in the current
directory
b***y
发帖数: 2799
36
来自主题: Programming版 - [合集] weird gdb problem
☆─────────────────────────────────────☆
mduchamp (MT) 于 (Tue Sep 6 18:42:48 2005) 提到:
I'm using gdb to debug my c++ codes. Here is the gdb version infomation.
z****e
发帖数: 2024
37
来自主题: Programming版 - interview problem about GDB (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: jacobhuang (jacob), 信区: JobHunting
标 题: interview problem about GDB
发信站: BBS 未名空间站 (Sun Apr 11 15:49:54 2010, 美东)
core dump happens when a program is executed. however, when running it in
GDB, there is no core dump. what may be the reason?
s********e
发帖数: 158
38
我在用gdb调试c++ template的时候没法设置确切的断点,比如我break foo.h:10 实际
设置到了foo.h:14,怎么操作都没法设置到第10行,但是单步调试next下一行都没有问
题,直接break到template函数的入口也没有问题,也可以next到我要设置断点的目标
行,可是就是不能直接设置到那一行,不知道具体是什么原因。这个问题严重的降低了
我的debug效率,google它也没有什么结果。我实际使用的是idb在gdb模式下。非常感
谢各位指教,谢谢。
s****a
发帖数: 238
39
来自主题: Programming版 - 用vim + gdb 调试的人牛屄轰轰的
网上可以搜到别人写的pretty print stl container的gdb脚本,拷贝到.gdb里面就可
以用
h*****g
发帖数: 9
40

Yeah, I did.
I guess it might be because I used template when I declared the function.
********************
template
void myfunction(Itemtype& first, Itemtype& second);
********************
After I took off the template, gdb can find the "myfunction" when the program
is compiled by g++. But if I use CC to compile, gdb gave the same message
"Funciton myfunction not defined"
So I don't know how to make it work for template.
Also, I don't understand why CC doesn't work for this.
T
a***u
发帖数: 72
41
来自主题: Computation版 - Linux下的 GDB怎么用啊?
gcc -g foo.c
gdb a.out
in gdb
run
to set break points,
l (to list)
break
run (or c to continue, s to step, n to next, ...)
print a (to print the varible a).
j********g
发帖数: 66
42
来自主题: JobHunting版 - interview problem about GDB
core dump happens when a program is executed. however, when running it in
GDB, there is no core dump. what may be the reason?
B*******1
发帖数: 2454
43
来自主题: JobHunting版 - interview problem about GDB
You mean there is core dump, but you could not see.
Or you mean the the program will not get core dump once you run GDB. If so,
it is timing problem and need to dig into the code and see how it interact w
ith other process and threads.
P*******b
发帖数: 1001
44
来自主题: JobHunting版 - 问个gdb调试的问题?
gdb怎么调试静态变量?
thanks
n*****g
发帖数: 178
45
请教会GDB的朋友,在core dump以后back trace,然后进去某个frame里看某个local变
量的值,这个frame不是最后crash的frame。请问在那个frame里print出来的local变量
,我如何知道它是在哪一个时候,哪一行的值?
c***k
发帖数: 1589
46
what do u mean? gdb console?
i**h
发帖数: 424
47
I would be very happy if my mingw gdb has a GUI.
D*******a
发帖数: 3688
48
is gdbtui the same as typing "layout" in gdb?
e***e
发帖数: 168
49
来自主题: Linux版 - gdb print constant string question
In C, if i have (void*) constVar, which I know it stores varchars, how can I
use gdb to print out the values?
e***e
发帖数: 168
50
For example, I set the following condition for break point 1:
gdb> condition 1 a == 233
That is only stop at break point 1 if variable a has value of 233.
Is there any way I can remove this condition after I hit the condition?
Since I want to stop at breakpoint 1 again.
Thanks!
1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)