public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* gdb.lookup_type problem with boost::multi_index::multi_index_container
@ 2013-01-24  1:54 Surya Kiran Gullapalli
  2013-01-29 11:58 ` Surya Kiran Gullapalli
  0 siblings, 1 reply; 2+ messages in thread
From: Surya Kiran Gullapalli @ 2013-01-24  1:54 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 2387 bytes --]

Hi,
I'm using gdb-7.5, on RHEL 6, compiled with gcc-4.7.2. I'm trying to
write a pretty printer for boost::multi_index and ran into problems
with gdb.lookup_type.

Attached code has the following declaration.

TestSet ts;

Now, at the gdb command prompt, I'm performing the following
operations (in python)

gdb >> python
> set_value = gdb.parse_and_eval('ts')
> set_type = set_value.type.strip_typedefs()
> t1 = set_type.template_argument(0) # Test
> t2 = set_type.template_argument(1) # boost::mult_index::indexed_by ....
> t3 = set_type.template_argument(2) # std::allocator<Test>
> node_type = gdb.lookup_type('boost::multi_index::detail::multi_index_node_type < %s, %s, %s >::type' % (t1, t2, t3))
> base = gdb.lookup_type ('boost::multi_index::detail::multi_index_base_type < %s, %s, %s >::type' % (t1, t2, t3))
> allocator = gdb.lookup_type('boost::detail::allocator::rebind_to<%s, %s>::type' % (t3, node_type))
> end

I'm getting the node_type correctly. But gdb is unable to get types
for 'base' and 'allocator'.

------------------------ The error for 'base' --------------------
Traceback (most recent call last):
  File "<string>", line 1, in <module>
gdb.error: No type named boost::detail::multi_index_base_type < Test,
boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::member<Test,
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>, &Test::s>, mpl_::na, mpl_::na>
, boost::multi_index::ordered_unique<boost::multi_index::tag<int,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_i
ndex::member<Test, int, &Test::i>, mpl_::na>,
boost::multi_index::ordered_unique<boost::multi_index::member<Test,
float, &Test::f>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na
, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
std::allocator<Test> >::type.
Error while executing Python code.
--------------------------------------------------------------

and a similar error for 'allocator'.
as boost::multi_index_container is derived from
boost::detail::multi_index_base_type, I'm expecting gdb to return a
valid type for the same.

Am I missing something here. ?

Thanks,
Surya

[-- Attachment #2: test.cxx --]
[-- Type: application/octet-stream, Size: 971 bytes --]

#include <string>
using namespace std;

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/random_access_index.hpp>

using namespace boost::multi_index;
using namespace boost;

struct Test
{
  Test (const string& ps, int pi, float pf)
    : s(ps), i(pi), f(pf)
  {
  }

  string s;
  int i;
  float f;
};

typedef multi_index_container <
  Test,
  indexed_by <
    ordered_unique < member <Test, string, &Test::s> >,
    ordered_unique < tag<int>,  member <Test, int, &Test::i> >,
    ordered_unique < member <Test, float, &Test::f> >
    >
  > TestSet;

int main(void)
{
  TestSet ts;
  ts.insert(Test("ABCDEF", 10, 1.0f));
  ts.insert(Test("Some String", 5, 2.0f));
  ts.insert(Test("PQRXYZ", 7, 0.3f));

  return 0;
}

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

* Re: gdb.lookup_type problem with boost::multi_index::multi_index_container
  2013-01-24  1:54 gdb.lookup_type problem with boost::multi_index::multi_index_container Surya Kiran Gullapalli
@ 2013-01-29 11:58 ` Surya Kiran Gullapalli
  0 siblings, 0 replies; 2+ messages in thread
From: Surya Kiran Gullapalli @ 2013-01-29 11:58 UTC (permalink / raw)
  To: gdb

Is there any other way to get the required type ?

Surya

On Thu, Jan 24, 2013 at 7:23 AM, Surya Kiran Gullapalli
<suryakiran.gullapalli@gmail.com> wrote:
> Hi,
> I'm using gdb-7.5, on RHEL 6, compiled with gcc-4.7.2. I'm trying to
> write a pretty printer for boost::multi_index and ran into problems
> with gdb.lookup_type.
>
> Attached code has the following declaration.
>
> TestSet ts;
>
> Now, at the gdb command prompt, I'm performing the following
> operations (in python)
>
> gdb >> python
>> set_value = gdb.parse_and_eval('ts')
>> set_type = set_value.type.strip_typedefs()
>> t1 = set_type.template_argument(0) # Test
>> t2 = set_type.template_argument(1) # boost::mult_index::indexed_by ....
>> t3 = set_type.template_argument(2) # std::allocator<Test>
>> node_type = gdb.lookup_type('boost::multi_index::detail::multi_index_node_type < %s, %s, %s >::type' % (t1, t2, t3))
>> base = gdb.lookup_type ('boost::multi_index::detail::multi_index_base_type < %s, %s, %s >::type' % (t1, t2, t3))
>> allocator = gdb.lookup_type('boost::detail::allocator::rebind_to<%s, %s>::type' % (t3, node_type))
>> end
>
> I'm getting the node_type correctly. But gdb is unable to get types
> for 'base' and 'allocator'.
>
> ------------------------ The error for 'base' --------------------
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> gdb.error: No type named boost::detail::multi_index_base_type < Test,
> boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::member<Test,
> std::basic_string<char, std::char_traits<char>, std::allocator<char>
>>, &Test::s>, mpl_::na, mpl_::na>
> , boost::multi_index::ordered_unique<boost::multi_index::tag<int,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::multi_i
> ndex::member<Test, int, &Test::i>, mpl_::na>,
> boost::multi_index::ordered_unique<boost::multi_index::member<Test,
> float, &Test::f>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na
> , mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
> std::allocator<Test> >::type.
> Error while executing Python code.
> --------------------------------------------------------------
>
> and a similar error for 'allocator'.
> as boost::multi_index_container is derived from
> boost::detail::multi_index_base_type, I'm expecting gdb to return a
> valid type for the same.
>
> Am I missing something here. ?
>
> Thanks,
> Surya

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

end of thread, other threads:[~2013-01-29 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24  1:54 gdb.lookup_type problem with boost::multi_index::multi_index_container Surya Kiran Gullapalli
2013-01-29 11:58 ` Surya Kiran Gullapalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).