简体   繁体   English

调试技术以进行远程调试

[英]Debugging techinques for remote debugging

gcc (GCC) 4.1.2 
c89
Red Hat Enterprise Linux Server release 5.4 
2.6.18-164.el5
GNU gdb Fedora (6.8-37.el5)

Compiling with the following debug flag -ggdb 使用以下调试标志-ggdb编译

I am looking at a way to debug on a remote server. 我正在寻找一种在远程服务器上进行调试的方法。

Currently I am debugging using gdb. 目前我正在使用gdb进行调试。

However, I want to print the contents of a structure to see what values the element have been assigned to. 但是,我想打印结构的内容以查看元素已分配给哪些值。

I can do this: 我可以做这个:

p media_description
$2 = (sdp_media_description_t *) 0xb7a80318

However, that just give me the memory address of the structure. 但是,这只是给我结构的内存地址。

Is there anywhere to print the elements of a structure? 是否有任何地方可以打印结构的元素?

Many thanks for any advice, 非常感谢任何建议,

===== Edit ====== =====编辑======

sdp_media_description_t *media_description = NULL;        
media_description = get_item(sdp_media_des_list, outer);

The above code should return a pointer to an instance of a structure. 上面的代码应返回一个指向结构实例的指针。

由于media_description显然是一个指针,因此您要打印它指向的结构:

p *media_description

Perhaps you have a pointer to a struct rather than a struct? 也许您有一个指向结构而不是结构的指针?

If that's the case you can just dereference the pointer when you print it, ie 如果是这种情况,您可以在打印时取消引用指针,即

p *media_description p * media_description

Also, if you don't want to work with gdb in console mode and have a graphical front end that you prefer, you should be able to use it remotely either via running gdbserver on the machine being debugged and runnning gdb on the development machine driven by the gui, or by running everything on the machine under test and using the remote capabilities of the X window system to display it on the machine you are sitting in front of 此外,如果您不想在控制台模式下使用gdb并拥有您喜欢的图形前端,您应该能够通过在正在调试的计算机上运行gdbserver并在开发计算机上运行gdb来远程使用它。通过gui或通过运行被测机器上的所有内容并使用X窗口系统的远程功能将其显示在您坐在前面的机器上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM