From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10866 invoked by alias); 17 Mar 2019 12:39:59 -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 10853 invoked by uid 89); 17 Mar 2019 12:39:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=mystery, $11, stays, explain X-HELO: mailsec102.isp.belgacom.be Received: from mailsec102.isp.belgacom.be (HELO mailsec102.isp.belgacom.be) (195.238.20.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Mar 2019 12:39:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1552826395; x=1584362395; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=1s8RFijwgnNCCaqBytjJYTEBPaNFlXbRRPI6qmjQ4Lw=; b=rFjxnXzhj7zs7seOowkIzQh271ZBy0Qdlsyu1eJM8rAOlFzPbMBxwPdW gWC9ACwAfoPIG1q8o1ucTlKtIZx8MQ==; Received: from 147.122-130-109.adsl-dyn.isp.belgacom.be (HELO md) ([109.130.122.147]) by relay.skynet.be with ESMTP/TLS/AES256-GCM-SHA384; 17 Mar 2019 13:39:52 +0100 Message-ID: <1552826392.6197.11.camel@skynet.be> Subject: Re: How to load C++ pretty-printers From: Philippe Waroquiers To: Joel Brobecker , asmwarrior Cc: Eli Zaretskii , Simon Marchi , gdb@sourceware.org Date: Sun, 17 Mar 2019 12:39:00 -0000 In-Reply-To: <20190317110310.GA4414@adacore.com> References: <835zsjz0f8.fsf@gnu.org> <83sgvnx9g1.fsf@gnu.org> <83o96ayfky.fsf@gnu.org> <20190317110310.GA4414@adacore.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00048.txt.bz2 On Sun, 2019-03-17 at 07:03 -0400, Joel Brobecker wrote: > Hello Asmwarrior, > > On Sun, Mar 17, 2019 at 09:47:35AM +0800, asmwarrior wrote: > > On Sun Mar 17 2019 00:00:29 GMT+0800, Eli Zaretskii wrote: > > > So, for the record, I now have this in my ~/.gdbinit > > > > > > python import sys > > > python sys.path.insert(0, 'd:/usr/share/gcc-7.3.0/python') > > > source d:/usr/lib/gcc/mingw32/7.3.0/libstdc++.dll.a-gdb.py > > > > > > (The last line both imports the function register_libstdcxx_printers, > > > and calls that function.) > > > > Thanks Eli and Simon. > > > > I think I have followed this wiki page: https://sourceware.org/gdb/wiki/STLSupport > > And I just the svn command to check-out the latest Python libstdc++ > > printers in GCC trunk. So, that page should be updated, at least we > > can teach people how to use the python printer bundled with their GCC > > release. > > It is a fair comment. Would you volunteer to help us update it? Note that even with pretty printers working, c++ debugging stays a mystery for me (probably highly linked to my poor knowledge of C++): E.g. p current_program_space->added_solibs pretty printing works and gives: $11 = std::vector of length 13, capacity 16 = {0x56275a765a60,  ... But then:  p current_program_space->added_solibs[0] One of the arguments you tried to pass to operator[] could not be converted to what the function wants. (why is then GDB not telling me what the function wants ?). I am finally doing p (*(struct so_list*)0x56275a765a60) But that all looks like a 'backward' user experience: I have to explain to GDB what to do, instead of GDB just working, or at least GDB explaining me more clearly what I am doing wrong. Philippe