public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/66069] New: New -fkeep-all-method-instances
@ 2015-05-08  8:11 jan.kratochvil at redhat dot com
  2015-05-08  8:44 ` [Bug debug/66069] " jan.kratochvil at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-05-08  8:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66069

            Bug ID: 66069
           Summary: New -fkeep-all-method-instances
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
  Target Milestone: ---
            Target: x86_64-linux-gnu

For debugging (-O0 -g) code there could be a way to provide all instantiable
methods for TYPE when anything from template<TYPE> gets used.  The problem:

-------------------------------------------------------------------------------
1       #include <memory>
2       class C { public: int i; };
3       int main() {
4         std::unique_ptr<C> cp(new C());
5         return cp->i;
6       }
(gdb) p cp
$1 = std::unique_ptr<C> containing 0x603010
(gdb) p *cp
Could not find operator*.
-------------------------------------------------------------------------------
compiled-in:
std::unique_ptr<C, std::default_delete<C> >::get() const
std::unique_ptr<C, std::default_delete<C> >::get_deleter()
std::unique_ptr<C, std::default_delete<C> >::operator->() const
std::unique_ptr<C, std::default_delete<C> >::unique_ptr(C*)
std::unique_ptr<C, std::default_delete<C> >::~unique_ptr()
-------------------------------------------------------------------------------

The current workaround:
-------------------------------------------------------------------------------
1       #include <memory>
2       class C { public: int i; };
3       int main() {
4         std::unique_ptr<C> cp(new C());
5         __attribute__((unused)) const C &gdbstub(*cp);
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6         return cp->i;
7       }
(gdb) p *cp
$1 = (C &) @0x603010: {i = 0}
-------------------------------------------------------------------------------
added method:
std::unique_ptr<C, std::default_delete<C> >::operator*() const
-------------------------------------------------------------------------------

Similar problems are with operator[], operator-> for maps etc.


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

end of thread, other threads:[~2015-05-08 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08  8:11 [Bug debug/66069] New: New -fkeep-all-method-instances jan.kratochvil at redhat dot com
2015-05-08  8:44 ` [Bug debug/66069] " jan.kratochvil at redhat dot com
2015-05-08 13:04 ` manu at gcc dot gnu.org
2015-05-08 13:17 ` jan.kratochvil at redhat dot com

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).