From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19779 invoked by alias); 16 Mar 2019 12:41:22 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 19279 invoked by uid 89); 16 Mar 2019 12:41:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=sk:_Rb_tre, sk:_rb_tre, forward_list, multiset X-HELO: mail-pf1-f182.google.com Received: from mail-pf1-f182.google.com (HELO mail-pf1-f182.google.com) (209.85.210.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Mar 2019 12:41:20 +0000 Received: by mail-pf1-f182.google.com with SMTP id n125so8193570pfn.5 for ; Sat, 16 Mar 2019 05:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=8PbP3kofdJ05Q+HZ4g7eSMYdAGYCDDfvhFX8yaJfoQI=; b=raSJ9CEZckIThwOyqdC5u75iZbNuEURyOFZ0+cvahNEKYkx5NAFOS+hF3jH86Gc0Fc GTzCxcw+/rRqR8V8bDGo9TedXffcCgdIW06pCpolzFj30M1tlmjoDnIcemTIsDszmO4+ 4sWAMeoQIB4lIWn+IWrXcvHlCN9CUofNUi34u0XdK+5DgbVMDx6X/K4FZvCBVv7lKGNf d5+bOSgVk78kJx1nRxQQ5SlGZfBR0Xi3ZgoKhxbKRLOwR+BGJRlUL6N+PspCQfTGm9gH yvZgW4DSaAv52zxDgj8tk1NPsZ7RrdOXfVntkqp43zQAbC1DQqjD/BiKqkmhU3zDwu0l wBHQ== Return-Path: Received: from [0.0.0.0] ([103.219.192.78]) by smtp.googlemail.com with ESMTPSA id d26sm7685600pfn.86.2019.03.16.05.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Mar 2019 05:41:18 -0700 (PDT) Subject: Re: How to load C++ pretty-printers To: Eli Zaretskii , gdb@sourceware.org References: <835zsjz0f8.fsf@gnu.org> From: asmwarrior Message-ID: Date: Sat, 16 Mar 2019 12:41:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:54.0) Gecko/20100101 Thunderbird/54.0a1 MIME-Version: 1.0 In-Reply-To: <835zsjz0f8.fsf@gnu.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-03/txt/msg00037.txt.bz2 On Sat Mar 16 2019 16:30:19 GMT+0800, Eli Zaretskii wrote: > I have a question regarding loading the C++ pretty-printers provided > by GCC. This might be specific to MS-Windows, not sure. > > So I have the C++ pretty-printers installed in > d:/usr/share/gcc-7.3.0/python/libstdcxx/v6. I start GDB to debug > itself. The "info pretty-printer" command says: > > (top-gdb) info pretty-printer > global pretty-printers: > builtin > mpx_bound128 > objfile D:\gnu\gdb-8.2\gdb\gdb.exe pretty-printers: > type_lookup_function > > This doesn't seem to mention the GCC-provided C++ pretty-printers. So > I start the inferior GDB running: > > (top-gdb) start --config > > After that, "info pretty-printers" still shows no C++ pretty-printers. > OK, me thinks, this could be because libstdc++ is statically linked > into GDB, so I load the pretty-printers by hand: > > (top-gdb) source d:/usr/share/gcc-7.3.0/python/libstdcxx/v6/printers.py Under My Windows 7 system, I'm using such commands(I put them in a my.gdb script file) to load and register the pretty printers. I put the libstdcxx folder in the same folder as the my.gdb file. set auto-load safe-path $debugdir;$datadir/auto-load python import sys sys.path.insert(0, '') from libstdcxx.v6.printers import register_libstdcxx_printers # load other pretty printers end And here is the result of info pretty-printer command global pretty-printers: .* bound builtin mpx_bound128 libstdc++-v6 __gnu_cxx::_Slist_iterator __gnu_cxx::__7::_Slist_iterator __gnu_cxx::__7::__normal_iterator __gnu_cxx::__7::slist __gnu_cxx::__normal_iterator __gnu_cxx::slist __gnu_debug::_Safe_iterator std::_Deque_const_iterator std::_Deque_iterator std::_List_const_iterator std::_List_iterator std::_Rb_tree_const_iterator std::_Rb_tree_iterator std::__7::_Deque_const_iterator std::__7::_Deque_iterator std::__7::_List_const_iterator std::__7::_List_iterator std::__7::_Rb_tree_const_iterator std::__7::_Rb_tree_iterator std::__7::__cxx11::basic_string std::__7::basic_string std::__7::bitset std::__7::deque std::__7::forward_list std::__7::list std::__7::map std::__7::multimap std::__7::multiset std::__7::priority_queue std::__7::queue std::__7::set std::__7::shared_ptr std::__7::stack std::__7::tuple std::__7::unique_ptr std::__7::unordered_map std::__7::unordered_multimap std::__7::unordered_multiset std::__7::unordered_set std::__7::vector std::__7::weak_ptr std::__cxx11::basic_string std::__cxx1998::_Deque_const_iterator std::__cxx1998::_Deque_iterator std::__cxx1998::_List_const_iterator std::__cxx1998::_List_iterator std::__cxx1998::__7::_Deque_const_iterator std::__cxx1998::__7::_Deque_iterator std::__cxx1998::__7::_List_const_iterator std::__cxx1998::__7::_List_iterator std::__cxx1998::__7::bitset std::__cxx1998::__7::deque std::__cxx1998::__7::forward_list std::__cxx1998::__7::list std::__cxx1998::__7::map std::__cxx1998::__7::multimap std::__cxx1998::__7::multiset std::__cxx1998::__7::set std::__cxx1998::__7::unordered_map std::__cxx1998::__7::unordered_multimap std::__cxx1998::__7::unordered_multiset std::__cxx1998::__7::unordered_set std::__cxx1998::__7::vector std::__cxx1998::bitset std::__cxx1998::deque std::__cxx1998::forward_list std::__cxx1998::list std::__cxx1998::map std::__cxx1998::multimap std::__cxx1998::multiset std::__cxx1998::set std::__cxx1998::unordered_map std::__cxx1998::unordered_multimap std::__cxx1998::unordered_multiset std::__cxx1998::unordered_set std::__cxx1998::vector std::__debug::bitset std::__debug::deque std::__debug::forward_list std::__debug::list std::__debug::map std::__debug::multimap std::__debug::multiset std::__debug::priority_queue std::__debug::queue std::__debug::set std::__debug::stack std::__debug::unique_ptr std::__debug::unordered_map std::__debug::unordered_multimap std::__debug::unordered_multiset std::__debug::unordered_set std::__debug::vector std::__norm::_Deque_const_iterator std::__norm::_Deque_iterator std::__norm::_List_const_iterator std::__norm::_List_iterator std::basic_string std::bitset std::deque std::experimental::fundamentals_v1::__7::any std::experimental::fundamentals_v1::__7::basic_string_view std::experimental::fundamentals_v1::__7::optional std::experimental::fundamentals_v1::any std::experimental::fundamentals_v1::basic_string_view std::experimental::fundamentals_v1::optional std::forward_list std::list std::map std::multimap std::multiset std::priority_queue std::queue std::set std::shared_ptr std::stack std::tr1::__7::shared_ptr std::tr1::__7::unordered_map std::tr1::__7::unordered_multimap std::tr1::__7::unordered_multiset std::tr1::__7::unordered_set std::tr1::__7::weak_ptr std::tr1::shared_ptr std::tr1::unordered_map std::tr1::unordered_multimap std::tr1::unordered_multiset std::tr1::unordered_set std::tr1::weak_ptr std::tuple std::unique_ptr std::unordered_map std::unordered_multimap std::unordered_multiset std::unordered_set std::vector std::weak_ptr lookup_function If I remember correctly, there used to be a function call register_libstdcxx_printers() like below: from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None) But later, the "register_libstdcxx_printers (None)" is not needed any more. Asmwarrior