English 中文(简体)
如何在含水层中减少C++运行方案?
原标题:How to debug a running C++ program in Linux?

我有一个问题,即把一个运行良好的C++方案分解到含水层。 如果方案拟订工作已经进行,并且可能中断,如何做到这一点。

我可以找到三种办法,但我对细节不甚了解,如果有人能够更深入地阐述,我会非常感谢。

(1) 我们可以通过具体说明进程ID来利用亚洲开发银行。

gdb -p PID

在这种情况下,这一条与<代码>之间的区别是什么?

2) 然而,我们可以使用国歌,我使用乌班图,不使用国歌,而只能使用国歌。

症状似乎没有太多信息,也没有这么多选择。

3) 根据目录核对详细信息。

在本案中,只是向国家投资争端解决局的名录。 然而,是否应当每年这样做?

最佳回答

我可以找到“<条码>-p,在 g子或文件上选择,但确实工作! 我多次在红海特和德比亚使用旧版本。

I m不确定由项目设计数据库(可改为<代码>/proc/<PID>/exe)具体发现的。 由于该文件没有描述,也许不是建议最多的方法,但我没有遇到任何问题。

<条码>gdb-p <PID> 和MS gdb 及其打字栏attach <PID>之间没有明显区别。

我个人喜欢<条码>ps x grep myprogram,以备PID。

问题回答

关于技术1,没有<代码>-p的旗帜,你仍然需要节目名称:

gdb prog PID

这样做与操作<代码>gdb prog,然后计及gdbattach pid之间没有任何区别。

Use ps -ef | grep <your program> to get the PID. Then run gdb <your program> <PID>. pstat is not a standard command. I ve only used it with Solaris.

e.g.

gayan@gayan:~/FE/bin> ./fe&
[1] 5866                                 
gayan@gayan:~/FE/bin> ps -ef | grep fe
gayan     5866  5836  2 10:19 pts/3    00:00:00 ./fe
gayan     5871  5836  0 10:19 pts/3    00:00:00 grep fe
gayan@gayan:~/FE/bin> gdb fe 5866
GNU gdb (GDB; openSUSE 11.1) 6.8.50.20081120-cvs       
Copyright (C) 2008 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 "i586-suse-linux".                                
For bug reporting instructions, please see:                                  
<http://bugs.opensuse.org/>...                                               
Attaching to program: /home/gayan/FE/bin/fe, process 5866

以上是公开的,但应在乌班图开展工作。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签