LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2010, 11:26 PM   #1
Alexlun
LQ Newbie
 
Registered: Apr 2008
Posts: 19

Rep: Reputation: 0
Question STL view on Suse during gdb debugging


Hi,
I wanna view the object value of some STL data when gdb debugging.

I download a script via goold, which discripted "STL GDB evaluators/views/utilities - 1.03", and then copy its content into .gdbinit.

However, some error occurs:
(gdb) pmap
Invalid type combination in equality test.
(gdb) help pmap
Prints std::map<TLeft and TRight> or std::multimap<TLeft and TRight> information. Works for std::multimap as well.
Syntax: pmap <map> <TtypeLeft> <TypeRight> <valLeft> <valRight>: Prints map size, if T defined all elements or just element(s) with val(s)
Examples:
pmap m - prints map size and definition
pmap m int int - prints all elements and map size
pmap m int int 20 - prints the element(s) with left-value = 20 (if any) and map size
pmap m int int 20 200 - prints the element(s) with left-value = 20 and right-value = 200 (if any) and map size

(gdb) pmap
Invalid type combination in equality test.
(gdb) pmap softportList
Invalid type combination in equality test.

(gdb) p softportList
$1 = {
_M_t = {
_M_impl = {
<std::allocator<std::_Rb_tree_node<std:air<const portNo_t, softportInfo_t> > >> = {
<__gnu_cxx::new_allocator<std::_Rb_tree_node<std:air<const portNo_t, softportInfo_t> > >> = {<No data fields>}, <No data fields>},
members of std::_Rb_tree<portNo_t,std:air<const portNo_t, softportInfo_t>,std::_Select1st<std:air<const portNo_t, softportInfo_t> >,std::less<portNo_t>,std::allocator<std:air<const portNo_t, softportInfo_t> > >::_Rb_tree_impl<std::less<portNo_t>, false>:
_M_key_compare = {
<std::binary_function<portNo_t,portNo_t,bool>> = {<No data fields>}, <No data fields>},
_M_header = {
_M_color = std::_S_red,
_M_parent = 0x0,
_M_left = 0x8097738,
_M_right = 0x8097738
},
_M_node_count = 0
}
}
}
I don't understand this, later I check its script and found gdb fail to analyse the "$argc", e.g. if $argc is 0, then gdb will execute "help pmap".

Is there anyone met the same case? How to resolve it?
As always, your experience and hints are most welcome.
Thanks in advance.
 
Old 06-25-2010, 11:31 PM   #2
Alexlun
LQ Newbie
 
Registered: Apr 2008
Posts: 19

Original Poster
Rep: Reputation: 0
by the way, my gdb info:
#>gdb -v
GNU gdb Red Hat Linux (6.1post-1.20040607.62rh)
 
Old 06-26-2010, 11:03 PM   #3
Alexlun
LQ Newbie
 
Registered: Apr 2008
Posts: 19

Original Poster
Rep: Reputation: 0
Hello,
Is there anyone has the same experience like me ?

the downloaded script can work well in untuban, however, it always be failure on Suse or redhat.
 
Old 06-26-2010, 11:29 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Probably Ubuntu 'gdb' is much newer, so try to build a newer 'gdb' or maybe there is a precooked RPM of it.
 
Old 06-27-2010, 12:37 AM   #5
Alexlun
LQ Newbie
 
Registered: Apr 2008
Posts: 19

Original Poster
Rep: Reputation: 0
Hi, Sergei Steshenko:
thanks for your feedback.

In fact, I found a similar case like belelow:
(gdb) define adder
Type commands for definition of "adder".
End with a line saying just "end".
>if $argc == 2
>print $arg0 + $arg1
>end
>end
(gdb) define adder_no_argc
Type commands for definition of "adder_no_argc".
End with a line saying just "end".
>printf "$arg0=%u, $arg1=%u\n", $arg0, $arg1
>print $arg0 + $arg1
>end
(gdb) adder 1 2
Invalid type combination in equality test.

(gdb) adder_no_argc 1 2
1=1, 2=2
$1 = 3
(gdb)

From the above contents, a conclusion that the current gdb does NOT see the $argc variable, it is the pointer that confuse me.

Here a url related to this issue: https://bugs.maemo.org/show_bug.cgi?id=6308 , I try to find a solution about this via google, but I fail to do it.

Is it really a bug for gdb or gcc?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
debugging with GDB jone kim Linux - General 2 04-13-2010 12:22 AM
gdb remote debugging problem unev_21 Linux - Software 1 10-26-2009 09:14 AM
Debugging Problem in Gdb akm3 Programming 5 01-01-2009 10:03 AM
Debugging c++ STL... santana Programming 1 10-12-2007 06:39 PM
Help debugging with gdb and core files moon.es Programming 1 05-28-2005 04:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration