Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* user defined function and passing types
@ 2010-09-10 14:41 Pawel K
  2010-09-10 15:59 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Pawel K @ 2010-09-10 14:41 UTC (permalink / raw)
  To: gdb

Hallo Group Members.

I have following user defined function:

define my_stl_list
  set $list = ($arg0)
  set $list_size = 0
  set $firstNode = $list._M_head
  set $curNode = $list._M_head._M_next
  while ($curNode != 0)
    printf "List Element %d: ", $list_size
    p ((const __gnu_cxx::_Slist_node<int> *)$curNode)->_M_data
    set $curNode = ($curNode)->_M_next
    set $list_size++
  end
end

As You can see, it displays contents of slist.
It's drawback is that it has hard coded type of list (const
__gnu_cxx::_Slist_node<int> *).
Is there a way to pass it as parameter to this macro?

best regards,
Pawel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-10 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-10 14:41 user defined function and passing types Pawel K
2010-09-10 15:59 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox