ant2009
ant2009

Reputation: 22616

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

I am looking at a way to debug on a remote server.

Currently I am debugging using 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.

Upvotes: 0

Views: 167

Answers (2)

Chris Stratton
Chris Stratton

Reputation: 40407

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

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

Upvotes: 1

caf
caf

Reputation: 239321

Since media_description is apparently a pointer, you want to print the structure it points to:

p *media_description

Upvotes: 1

Related Questions