From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23468 invoked by alias); 29 Jun 2009 00:07:17 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 23459 invoked by uid 22791); 29 Jun 2009 00:07:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: Project Archer Subject: $n for pretty-printed elements? Message-Id: <20090629000709.45C9C420F6@magilla.sf.frob.com> Date: Mon, 29 Jun 2009 00:07:00 -0000 X-SW-Source: 2009-q2/txt/msg00195.txt.bz2 Consider: (gdb) p _m_path $161 = std::list = { [0] = { > = {}, members of elfutils::dwarf::debug_info_entry::children_type::const_iterator: _m_stack = std::stack wrapping: std::deque with 1 elements = { { > = {}, members of elfutils::dwarf::debug_info_entry::raw_children_type::const_iterator: _m_die = { _m_die = { addr = 0x2aaab0005747, cu = 0x66ada0, abbrev = 0x674490, padding__ = 0 } } } } } } So that [0] = ... is real nice. But now I want to refer to that datum. For vanilla pretty-printing of plain types, I could use &_m_path[0] to refer to that. But std::list doesn't have operator[]--and even if it did, I really didn't want to do an inferior call for this. Inside there, that _m_stack = ... is real nice. But now I want to refer to that elfutils::dwarf::debug_info_entry::raw_children_type::const_iterator object or its _m_die field. What my gdb reflexes did was cast around for the handle on what I wanted. I knew it wasn't really "p &(_m_path[0]._m_stack.top()._m_die)", because of all the magic C++ inferior calls that implies (even if they could actually be done, which they can't), though that's what my fingers wanted to try. But my gdb hindbrain told me, "Fear the C++, find a $ you can trust." In my mind's eye it looked like: (gdb) p _m_path $161 = std::list = { [0] = $162 = { > = {}, members of elfutils::dwarf::debug_info_entry::children_type::const_iterator: _m_stack = std::stack wrapping: std::deque with 1 elements = { { $163 = > = {}, members of elfutils::dwarf::debug_info_entry::raw_children_type::const_iterator: _m_die = { _m_die = { addr = 0x2aaab0005747, cu = 0x66ada0, abbrev = 0x674490, padding__ = 0 } } } } } } and my fingers wanted to type "p &$163._m_die" but my eyeballs searching for that $nnn to fill in couldn't see it anywhere on the screen! Please help me, or my gdb hindbrain could shut down in horror and my fingers might go feral. If you were to go all sophisticated and make that $161_0 instead of $162, and $161_0_0 instead of $163, I would cope just fine. Thanks, Roland